From dc6a4407015acd0904b79a327e040b7e79cfa918 Mon Sep 17 00:00:00 2001 From: Carlos Panato Date: Fri, 6 Nov 2026 14:00:37 +0100 Subject: [PATCH 1/2] feat: use colored GitHub icons for extension status --- README.md | 3 +- assets/README.md | 19 ++++ assets/mark-github-mask.png | Bin 0 -> 7727 bytes assets/mark-github.svg | 1 + assets/octicons-commit.txt | 1 + public/icons/128.png | Bin 986 -> 3396 bytes public/icons/16.png | Bin 160 -> 414 bytes public/icons/32.png | Bin 267 -> 844 bytes public/icons/48.png | Bin 362 -> 1264 bytes public/icons/attention-16.png | Bin 0 -> 406 bytes public/icons/attention-24.png | Bin 0 -> 597 bytes public/icons/attention-32.png | Bin 0 -> 829 bytes public/icons/operational-16.png | Bin 0 -> 408 bytes public/icons/operational-24.png | Bin 0 -> 610 bytes public/icons/operational-32.png | Bin 0 -> 833 bytes public/icons/outage-16.png | Bin 0 -> 412 bytes public/icons/outage-24.png | Bin 0 -> 602 bytes public/icons/outage-32.png | Bin 0 -> 844 bytes public/icons/unknown-16.png | Bin 0 -> 414 bytes public/icons/unknown-24.png | Bin 0 -> 597 bytes public/icons/unknown-32.png | Bin 0 -> 844 bytes public/licenses/octicons-LICENSE.txt | 21 +++++ public/manifest.json | 6 +- scripts/icons.go | 98 +++++++++++++++++---- src/background/index.ts | 22 +---- src/domain.ts | 21 ++++- tests/e2e/extension.spec.ts | 124 ++++++++++++++++++++++----- 27 files changed, 256 insertions(+), 60 deletions(-) create mode 100644 assets/README.md create mode 100644 assets/mark-github-mask.png create mode 100644 assets/mark-github.svg create mode 100644 assets/octicons-commit.txt create mode 100644 public/icons/attention-16.png create mode 100644 public/icons/attention-24.png create mode 100644 public/icons/attention-32.png create mode 100644 public/icons/operational-16.png create mode 100644 public/icons/operational-24.png create mode 100644 public/icons/operational-32.png create mode 100644 public/icons/outage-16.png create mode 100644 public/icons/outage-24.png create mode 100644 public/icons/outage-32.png create mode 100644 public/icons/unknown-16.png create mode 100644 public/icons/unknown-24.png create mode 100644 public/icons/unknown-32.png create mode 100644 public/licenses/octicons-LICENSE.txt diff --git a/README.md b/README.md index baada4f..a3b0cce 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A small, local-first Chrome / Chromium extension for GitHub's published service health. Manifest V3, no account, no backend, no telemetry. -The first version includes the overall status, affected-first service list, active incidents and scheduled maintenance, a colored toolbar marker with textual badge, background polling, persistent cache, manual refresh, system/light/dark themes, and update interval settings. Only `storage`, `alarms`, and access to `https://www.githubstatus.com/*` are requested. +The first version includes the overall status, affected-first service list, active incidents and scheduled maintenance, a GitHub toolbar icon colored by status, background polling, persistent cache, manual refresh, system/light/dark themes, and update interval settings. Only `storage`, `alarms`, and access to `https://www.githubstatus.com/*` are requested. ## Build and install @@ -58,6 +58,7 @@ Playwright loads the built extension into a real Chromium profile. Tests replace - The default check interval is one minute; settings offer 1, 2, 5, or 10 minutes. Chrome can delay alarms during sleep. Freshness is checked whenever the worker or popup runs. - A failed check retains the last successful snapshot, marks it stale, and changes the toolbar to unknown. Expired data is never treated as fresh operational status. Cached service rows are labeled explicitly. +- The GitHub toolbar icon is green for operational status, yellow for degraded performance or maintenance, red for partial or major outages, and gray for unknown, stale, or failed checks. Attention/outage badges and tooltip text provide status information beyond color. The Chrome Extensions page uses a neutral GitHub icon. Icon sources and regeneration instructions are in [assets/README.md](assets/README.md). - Manual refresh respects the next permitted check time. Failed checks use exponential backoff with jitter and honor bounded `Retry-After` values. Requests time out after ten seconds, reject redirects, omit credentials, and cap response size at 1 MiB. - The summary API supplies unresolved incidents, not resolved incident history. This MVP does not request extra historical feeds or invent uptime metrics. - GitHub is the only configured source in this release. Multiple sources, GitLab, and runtime host permissions are deferred to later milestones. The normalized domain and provider interface are separate from the GitHub schema. diff --git a/assets/README.md b/assets/README.md new file mode 100644 index 0000000..7989877 --- /dev/null +++ b/assets/README.md @@ -0,0 +1,19 @@ +# GitHub icon source + +`mark-github.svg` is the official `mark-github-16` icon from [Primer Octicons](https://github.com/primer/octicons). The exact source revision is recorded in `octicons-commit.txt`. Its MIT license is bundled in `public/licenses/octicons-LICENSE.txt` and included in the extension package. + +`mark-github-mask.png` is a 512 × 512 black-on-white rasterization of that SVG. It is a build source, not a runtime asset. The Go generator converts coverage to transparency and produces neutral application icons plus green, yellow, red, and gray toolbar variants. PNGs are committed so building the extension does not require Go or browser-based asset generation. + +Regenerate the color variants from the mask with: + +```bash +go run scripts/icons.go +``` + +To regenerate the mask, use the installed Playwright Chromium (the same external tool used for browser tests): + +```bash +sed 's/width="16" height="16"/width="512" height="512"/' assets/mark-github.svg > /tmp/github-status-mark.svg +npm exec --no -- playwright screenshot --channel chromium --viewport-size '512,512' file:///tmp/github-status-mark.svg assets/mark-github-mask.png +go run scripts/icons.go +``` diff --git a/assets/mark-github-mask.png b/assets/mark-github-mask.png new file mode 100644 index 0000000000000000000000000000000000000000..ae692b31bbd127cccfa4c83d298dc3780eab6daf GIT binary patch literal 7727 zcmZvBc_5VE7x$gTzK<=kFDZLO$ueW?Swn;{%APGm)_Lqw*(nM`LM0R-iis8>Mj~6$ z#@J=e$jm#wzxR*#kN2qXv+xPg${Ry$32gq-=s#KoF@4t9_v~#d!dbCWIF3!)_o;9d4~eo)su;mT&fj(4Y8mN#1l(z?EP zujtUA1^iBW>!7Ilk%k-LnkXV)a=hjz;o=OWs@j#ZuT81m60n0zQ z7n^Giqf{>F;-<`(o#4KK0HfVdGq-0M0^5qNC&X)DWj_gpEFvSS( z-7EtQ&o|iPDHNkUS)%_)k*s0Y(dj ziLbA($D%!(I+EgdrwtuY7^~8yl+b+mxEUB9TR=QeG9pe+x=8Vw=zBIO|1-iL4J={T z)|C<*go${4=PHPDkPuWN81%=KOWGwQ*#qsO9cqK=h|e(VPBorMQ0fOO zLz`)Yo5*GooRZ(nW$2SejzbXx#r~vtT*LiUcgCDdr>dfs34^A9Rx!_Ikc$Y)1yt^R z4_qkGq&b1w9pmNgA*R73h91U7Z2rtV(#pccv<@81hSg;^}q% zeGg}2c-{*9*>@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2BG#%{pTQCr~H@+>|gWY2c5-Myo ztUY*8E4Vl~jcT}^g4c?G@t@pgl>A~XmpaAZdEdtmg^|5q1*4A{%>foK>WnEk#Mx~e ztv7NA{^ims_8p;Zhbo58?^Hz(<}mugv`A0%ln9zjJc;Uar<*F^zKYSuW+?N9BvxWW zi;_C@4$H+j)v}-d*R|G!(wZTh3)*mc{q}|CaW7^#V(#XF(mR>2s~ICkuh zy6{MBMq0tiu5*4M2t_deJ(0Vmr$tJVObWzYoX7R~Lx0U2`)3i}# z8-E|sjfn~IbXJK52Wy_mfuSc3M$kFD4GME@YZ$s*<)cxb_I$SCAzGRKZ{5iD&C`!x z;mvt$qP4SSX@_K>AwE}-K|Pz_2gA}#WuW6qeiD05!>KV(f4Q=z?-}F*dZwOtMwL?vgkr^W7d=YiR0uQYzmihtNX(GdT$gJNb1@|@cZ#MNJiPIkV0 z*}7};Jf41cbHq1g?!;}`< \ No newline at end of file diff --git a/assets/octicons-commit.txt b/assets/octicons-commit.txt new file mode 100644 index 0000000..70338d8 --- /dev/null +++ b/assets/octicons-commit.txt @@ -0,0 +1 @@ +b3e95564299217e1bcc6cd07d62e57d74fb9bc09 diff --git a/public/icons/128.png b/public/icons/128.png index 4b3f4845dd0bd974618761ac2cca650d01ba8587..1260b1de090eb4fa137fbcf61763314da9af80ca 100644 GIT binary patch delta 3394 zcmZ8kX*iUP0)1x;#*8du-!rva`2X zy$~GnP$LRQNpvfQUQ1gZFPqj0&h_{nadML5-?y2w_5DP1_x?gwqiUQOB;``db=W-INJ4(y+|5xa+~RM*G~4xp0}glJEc>ieibu zot-aF`sRnHr;8LR-&yJvh|BJd&lg_+hlo~r z>*)anDmdFzD?$ebqS3W4b+oT~EvO z=deW+doR%Py-^r-a5%FTPA>2RB@2k(&9yXlqQV`A9xn0b#y+4{EEzj~NbxNLvZ(jUWg>AH;%gE*SpYu7Ix6A$*zD#U_bhf-sn7sOx~ z$@euclX$R;0_T!>TUdbmwBxPx^SkpRPW2%N+Afpty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El>b@qy`N*`x?-5- zrvOhdY7(RuUjOc{zm|yAi)_+`2sL~BP&3plc!LDbOKO-jSCR* z#Hm(*0#E?G0wBP~0z^)&;>&=w{@loD&NHTR1z^Sw0w4eaAOHd&00JNY0w4eaY%aiG z0lfch34d$;dd5_)0FmF7tN4y#IRTilg8&GiCqTs1D(0U8Pyo#WL_2Y+r=J2)fae8J z_+3DRlc#X{&sfSAU?l(r__qsy1m_ZDfS*PHZy;IVUkae`eSkL@HTc_oM9cwb^gDFb zz;F8zG5-VW6(KA5W0jt_6st|G3|XMpyo9GMK!0YiZr=nl`Nu}3go!n^%qRc_xGn${ z(5gTSD+)jX>Iy&wG%C=_hyqZ6`T|ga*cG_Lh5}H4wgOOrm=(Co#Jryn_;KKO3BcqS zTV)=nfBoqnQUD}aC&7rl?-qd39*bfkr{Dkd4=n%^_(?EwuPy3@0e?RH;Q}DRTnT3E zt$(RpDDcO_pC$kjjFn*KUYhEK1HT{sbODf{PXdphuiq diff --git a/public/icons/16.png b/public/icons/16.png index 974ae105dff23897156df6260e8c02d80718acc2..d483d0838d752f5ba4dcf9d931c9581410f79d06 100644 GIT binary patch delta 388 zcmV-~0ek+S0iFYpBYy#9Nkl5~8CZ=C$=~8@^8aMMNQ2#Yj8Ax#<1@zCS)2M2EZ`dMVSjtBOTxDU4{;UC`Vw5h zF-$NmV}oh>7IC?Zb;>RrPksc?Z~$-c2ODt*TW|}fa2t;*!64_*Ieg5Dx-wS;!$=S< ztiskbPO{HgxSxAMw?*uHmRFU$!1v^R629ljmt%c3GD8GDoW z$$o4~9x)#x!F?Az#kcJL2F_qj=hR{P3Qr=oTDX`!J-~Tf=u~nzZ7a%vOYMhr7uRt% z-*+WO>65k=qm21?`=KYZua|g@Lpg{3=mam;qACdag%j9^cg=gtAL}Oe;3$5UqphGY i&e0++`d}?u{2c&IuSxOqc`5t=0000lpu_RmG6WA0000{IdjgLn&#j}7|Bc+M8XtC z7#HNDNQ8{f8^sNGQZ7Xb7orA{e8rHD82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f>36dnEXc*Z78w~-NWImJXek;g;mMY0LuMIWen}b9{>OV07*qoM6N<$g3714 A!2kdN literal 0 HcmV?d00001 diff --git a/public/icons/attention-24.png b/public/icons/attention-24.png new file mode 100644 index 0000000000000000000000000000000000000000..6a132e0f66bd2d7040c7e1fbdb0016620e3cf96a GIT binary patch literal 597 zcmV-b0;>IqP)t>|5Jihp0?$;dWLLuuwgd5WtqV1H4jcv^x{&dogM>N2W#C>Li^o_8w15l1|1Q=E#Nu~= zeJ*r>Vc=FNQVN_0wkrMtyi?r7xB703A>d4%z&2pN6W}zk0$2~+0FDC(fdjxX;JO-M zC2-C!0f&IiRb6z#f#6^DRG%h(bs$7@jO88l1AU6kc@EmZ0tZ6B4u4i)NVD-Bxagz} z#M#X_5eBnBZy_)aOgU)-AA!eCguX1$quG4#paYce^kf0g#u5h|V3~sqFI@f|n}GRF z+CUug1}DN)7I>lAoC}-^uX3RQUBFqrlR1$E?rY8rySM@@cA)~{t|P!+7ZO@o;0Z9P zIBw}G{enHRf{~)v7Xr6|H^6Qe6DEB*Ef74SIV@o#unTw%{E~_JW(Pk5uVju@JgWC* zcMxM#e~G^ki>w9~0XJ3894&I=njE>ZJ%{BXVPFr`O=~LdNsMm}62@hQ)Cq(|>;Nvw zMO*5yfz)AjxGH;?X%dL>L$>k4q96C jtZ@e=r~mR90KW$SQ@mm(Zs+e)00000NkvXXu0mjfPvrkx literal 0 HcmV?d00001 diff --git a/public/icons/attention-32.png b/public/icons/attention-32.png new file mode 100644 index 0000000000000000000000000000000000000000..dcc327cd25ff5b835ae5d9ea5e0dadb91f3d5f87 GIT binary patch literal 829 zcmV-D1H$}?P)5lImuUZKPz zlptOMCa4fiMKDrIC`l>V&3`o~JNw+8dvB%xb#C@rd!Kvu|Lncj;}qQ7NuQ#?lnmhh zQwfv^39L3)~4`Z-(Gb^J1V7 zSPAR^T7YN3XWiqLw*nXnYzIyNKY{bWLfwP5<1Ek^BH&hIm-a0xuhn+Qy$;LwlgL|B zggnhL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**W~u~Yd{-OZn!4ym&DkO+KY-`JE>%+5kN#-a wrH$)~985cy5EZn%&b`VnC~f*L?*Z^@0HHKwo|)8+iU0rr07*qoM6N<$f*CIlnER0Myz*E(HDr4(MT3-dGY;16P23z#rC`lt3A96Qp?s3ao2@D3d0>^-Fz*%6P?m^pe8fXd;aI3LH`xccKYCGj#2j%-o zEurSG9`ks!0gZ&SZRufa?j2NWu9$V3i#5c zJp2{11`A>6pufQ<1zT7e;58O7zLpn;JLai_FOvwZ9 zP4Q3>C19m z3jePiWV#ExFM*}N-@tU>E^tZ@oTihzL=}!NEqd$fn7206+y472V5@N04CR58+EV#+ zXmZ0jQ(|yb#Vv6J+_gb_=&s4i-;TuB1U3I_Qvz^R@_I8e5$I61x+8m&64D-Euf7lB zBcWd literal 0 HcmV?d00001 diff --git a/public/icons/outage-16.png b/public/icons/outage-16.png new file mode 100644 index 0000000000000000000000000000000000000000..5531b9b575f4bab47dc9f8a2152ac42de7f1fb29 GIT binary patch literal 412 zcmV;N0b~A&P)&S!N$tUMkz_;PuWUI%-Y86Efh<|LbA1>tRztuY%B~bHvW`k z$0T08H}Cacr_QP0`!#PC?|XjJ{oZr#Irn?+z0(`@4_X6Tu{Zfw{7b&dxSVwi^~{eQqBe@85`hEIXig<$MHOUXYmf_ z@CD20<0%f~Nv?}_UY5-3ImXw)uT<2wP7w^FKq%Ofhtx}nyD?X*TG))A*p@AA@20#` zGMbSrWABr1#Gd9MhV3je1G|buyHVgfmeO$mr;<;zGuWRza(+aCzj%xPdC!k<4Le%9 z4l`DG6S>vGt?VhT@&<0Ulw3^TrgGqR^Bsgez=T-_+vfB$=rFN{gl^@l>q>H4NJp=6t)cj0000(b09i-A>Q@^gL>=`%LG$?`O`rp7Y%Ix!=y_%C*cUI!#J22n+#z zK#yV{fhKSpc&1pPb(EZ7CvXZ_=Rg}g2aW>w9f+7?5-=aQ4BV-(c^d113E%=S&%t&A zY4cmaK?iD}0o=$%a)I-}cJZ&kJMl7mtN%@77&t5bcg$^cb(`-1&e+lS->c&<1g-;P zz_=3o0XPI40Tuw8v~C0N7D@dLPMrvg&$X6y(XeaZHE$;Kw(s7%jpv!2S!-tY%zEdYwPwBf56dUfjj1+A^c5@sCYlmKp{FNZ-0>e1BA5)!51oN^CU_|E^h{9f>4x?G8OQ@V z6-c6Vk*r!FHXDuyTD=EFXJ?p;l-5xhSlsbe4vV|;Oy1ygh}P`2tX#Fv+a~0IJ0^Ij zh#F9;+GnSyXM^`9cqok;V6~5tCggxV=dgu4RQs$oAqT|Wh#gS_+G7luq7a%bYvuPL zv_}ni40KEOc?cM8N(LCA>paA6xo58dF3et+?6X3yR2}XPa++Ltv^98W)|$Nrpg3=6 zRW7hcIoJn0|t%h{)Y@Me+>Xl W&XCqo7Fn_Y00005~8CZ=C$=~8@^8aMMNQ2#Yj8Ax# z<1@zCS)2M2EZ`dMVSBDi!nXqtaTUw@5?sMCOfW5DgK7E}ak-3j$}SvFegw~O0B`UI z8*v9)a0{n!8;>f%Am`9Ie9VfvGFJq{NDwWo!qzlSvd>w#pL;^LMeKZ*SCzcL_vC#N zzURr8V|{yxA!~~)fptZq-AM2rztgZ8dz1Icer!q}F&`qq7d*wc?EePNU`^-LVfqSB zBDPw%m_0qfd0gmJayV@(%79DlhjbU$aW>y~B}VC!wics|`FH!FC$q1Yc#T6jhyLgU zFV>FE**oSw`d&?i|CidVcewL%HpfJwSA};!1En55?08Ot+@$-2p`~Uy|07*qo IM6N<$f&x0gEC2ui literal 0 HcmV?d00001 diff --git a/public/icons/unknown-24.png b/public/icons/unknown-24.png new file mode 100644 index 0000000000000000000000000000000000000000..58cc3c83544a708c03ae57994671cc2ce198404e GIT binary patch literal 597 zcmV-b0;>IqP)!m?prP|D6et9lghavwF{T&|4H=SY zG~!XnkPM+13L!gLYqFi(d-MMiYu!I*?|tt%>%aHxvpNnPKFR+?hl2+60)0RiuuQd& zz!-2Jc&=L80^5Moz#10{>;z5#FMuP!W8cV_=^$Y?a20sauz2QLU>LXr%yO|#AQry| z>~*0H3;=gZky79yuto7#;JxA|zSFaD^#kYX1hxYEoB(Hm<-j`N77*=r0N4*42X3kX zRsa_~2{;IBs@mjJ4g~+JXZkhqn*$-5V+k%y%I4X!EB9`ZXFqfXhx= zKx zX#ugx>zxP_S>UBca}IC@nBhVL;+gZBlR1_J9%{@CySN4{a-jm@u7kiH7ZQfEz*Asc zah%eX`UksZ1%pMeF97ZWZ-HGdCXD-VS|E5-V_3ol+3_3Tw@l0@JNN~7Epx2mG0mHP zgSdwDN&G-8vIoP9Q8|J8(rV zI;;-sO&wN;>#~QbCV{wq%Cc@Cw+WPAdKAFS{-|qF?O6q>BmBK}%}x jHNHW~$$z{Dz@GsCea>Oh{a{IdjgLn&#j}7|Bc+M8XtC7#HNDNQ8{f8^sNGQZ7Xb7orA{e8rHD z82QN81veOxX(U`3h8SuXTKYfJZngG1`+eV$|9`)&=UHpLd;RxXdp+yf1#35K=69mN zj11uZQwfvb=PEn2z4mMG zC*eyogglKg((Vymf?8mxIS~|je$v4m|1u+j;lQ-eJFvtI52c=;2}(TQu+$fjuNm;! zsWr_O8)Kqjt&MF0Dipv&!e`Q7hE=yizPC5bYI<0QYU#A0UC$LN3 z2XT!14!EZr;GFE0HF((O9-FNx5{4oHH W%#P3>EU!QS0000= 1 || v < 0 || v >= 1 { + continue + } + p := color.GrayModel.Convert(mask.At(bounds.Min.X+int(u*float64(bounds.Dx())), bounds.Min.Y+int(v*float64(bounds.Dy())))).(color.Gray) + coverage += uint64(255 - p.Y) + } + } + pixel := tint + pixel.A = uint8((coverage + samples*samples/2) / (samples * samples)) + out.SetNRGBA(x, y, pixel) + } + } + f, err := os.Create(path) + if err != nil { + return err + } + if err := png.Encode(f, out); err != nil { + _ = f.Close() + return err + } + return f.Close() } diff --git a/src/background/index.ts b/src/background/index.ts index 24574f1..959b75f 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -4,7 +4,7 @@ import { ProviderError, type StatusProvider, } from "../providers/github.js"; -import { readCache, readSettings } from "../storage.js"; +import { emptyCache, readCache, readSettings } from "../storage.js"; import { fetchCache } from "./polling.js"; const alarmName = "github-refresh"; let inFlight: Promise | undefined; @@ -20,19 +20,8 @@ const authorizedProvider: StatusProvider = { }; async function updateToolbar(cache: Cache) { const state = toolbar(cache); - const canvas = new OffscreenCanvas(32, 32); - const ctx = canvas.getContext("2d")!; - ctx.fillStyle = state.color; - ctx.beginPath(); - ctx.arc(16, 16, 13, 0, Math.PI * 2); - ctx.fill(); - ctx.fillStyle = "#ffffff"; - ctx.font = "bold 23px sans-serif"; - ctx.textAlign = "center"; - ctx.textBaseline = "middle"; - ctx.fillText(state.text, 16, 17); await Promise.all([ - chrome.action.setIcon({ imageData: ctx.getImageData(0, 0, 32, 32) }), + chrome.action.setIcon({ path: state.icon }), chrome.action.setTitle({ title: state.title }), chrome.action.setBadgeText({ text: state.state === "operational" ? "" : state.text, @@ -76,10 +65,7 @@ function refresh(): Promise { } function run() { void refresh().catch(() => { - /* Storage/API failures must not leave a green badge. */ void chrome.action.setBadgeText( - { text: "?" }, - ); - void chrome.action.setTitle({ title: "GitHub: Status Unavailable" }); + void updateToolbar(emptyCache()).catch(() => {}); }); } chrome.alarms.onAlarm.addListener((alarm) => { @@ -124,5 +110,5 @@ void (async () => { await chrome.alarms.create(alarmName, { periodInMinutes: 1 }); run(); })().catch(() => { - void chrome.action.setBadgeText({ text: "?" }); + void updateToolbar(emptyCache()).catch(() => {}); }); diff --git a/src/domain.ts b/src/domain.ts index 3bcd464..dccf973 100644 --- a/src/domain.ts +++ b/src/domain.ts @@ -80,9 +80,9 @@ export const rank: Record = { }; export const colors: Record = { operational: "#238636", - maintenance: "#8250df", - degraded: "#9a6700", - partial_outage: "#9a6700", + maintenance: "#bf8700", + degraded: "#bf8700", + partial_outage: "#cf222e", major_outage: "#cf222e", unknown: "#6e7781", }; @@ -97,10 +97,23 @@ export function stale(cache: Cache, now = Date.now()): boolean { } export function toolbar(cache: Cache, now = Date.now()) { const state = stale(cache, now) ? "unknown" : cache.snapshot!.overall; + const icon = + state === "operational" + ? "operational" + : state === "unknown" + ? "unknown" + : state === "major_outage" || state === "partial_outage" + ? "outage" + : "attention"; return { state, color: colors[state], - text: state === "operational" ? "✓" : state === "unknown" ? "?" : "!", + icon: { + 16: `/icons/${icon}-16.png`, + 24: `/icons/${icon}-24.png`, + 32: `/icons/${icon}-32.png`, + }, + text: state === "operational" ? "" : state === "unknown" ? "?" : "!", title: `GitHub: ${labels[state]}${cache.snapshot && stale(cache, now) ? " · last known: " + labels[cache.snapshot.overall] : ""}`, }; } diff --git a/tests/e2e/extension.spec.ts b/tests/e2e/extension.spec.ts index 80abd5e..214bb86 100644 --- a/tests/e2e/extension.spec.ts +++ b/tests/e2e/extension.spec.ts @@ -41,6 +41,16 @@ test.beforeAll(async () => { { timeout: 15_000 }, ) .toBeTruthy(); + await worker.evaluate(() => { + const nativeFetch = globalThis.fetch.bind(globalThis); + Object.assign(globalThis, { statusFetch: nativeFetch }); + globalThis.fetch = (input, init) => { + const url = input instanceof Request ? input.url : String(input); + return url.startsWith("https://www.githubstatus.com/") + ? Reflect.get(globalThis, "statusFetch")(input, init) + : nativeFetch(input, init); + }; + }); }); test.afterAll(async () => { await context?.close(); @@ -49,10 +59,12 @@ test.afterAll(async () => { async function seed(state = "operational", indicator = "none") { await worker.evaluate( async (payload) => { - globalThis.fetch = async () => - new Response(JSON.stringify(payload), { - headers: { "content-type": "application/json" }, - }); + Object.assign(globalThis, { + statusFetch: async () => + new Response(JSON.stringify(payload), { + headers: { "content-type": "application/json" }, + }), + }); await chrome.storage.local.set({ cache: { failures: 0, nextAttemptAt: 0 }, }); @@ -113,9 +125,11 @@ test("degraded and outage status update the popup and toolbar", async () => { test("failed request retains cached rows and marks toolbar unknown", async () => { await seed(); await worker.evaluate(async () => { - globalThis.fetch = async () => { - throw new TypeError("offline"); - }; + Object.assign(globalThis, { + statusFetch: async () => { + throw new TypeError("offline"); + }, + }); const { cache } = await chrome.storage.local.get("cache"); cache.nextAttemptAt = 0; await chrome.storage.local.set({ cache }); @@ -131,19 +145,21 @@ test("failed request retains cached rows and marks toolbar unknown", async () => }); test("remote incident text is inert and unsafe links are omitted", async () => { await worker.evaluate(async (payload) => { - globalThis.fetch = async () => - Response.json({ - ...payload, - incidents: [ - { - id: "x", - name: "", - status: "investigating", - impact: "major", - shortlink: "javascript:alert(1)", - }, - ], - }); + Object.assign(globalThis, { + statusFetch: async () => + Response.json({ + ...payload, + incidents: [ + { + id: "x", + name: "", + status: "investigating", + impact: "major", + shortlink: "javascript:alert(1)", + }, + ], + }), + }); await chrome.storage.local.set({ cache: { failures: 0, nextAttemptAt: 0 }, }); @@ -188,3 +204,71 @@ test("expired cache is marked unknown even during a deferred refresh", async () expect(await worker.evaluate(() => chrome.action.getBadgeText({}))).toBe("?"); await page.close(); }); + +test("Chrome Extensions displays the packaged GitHub icon", async () => { + const page = await context.newPage(); + await page.goto("chrome://extensions/"); + const icon = page + .locator(`extensions-item[id="${extensionId}"]`) + .locator("img#icon"); + await expect(icon).toBeVisible(); + await expect + .poll(() => + icon.evaluate( + (img: HTMLImageElement) => img.complete && img.naturalWidth > 0, + ), + ) + .toBe(true); + await page.screenshot({ path: "test-results/chrome-extensions-icon.png" }); + await page.close(); +}); + +test("toolbar installs the correct colored GitHub PNGs for every health category", async () => { + await worker.evaluate(() => { + const original = chrome.action.setIcon.bind(chrome.action); + chrome.action.setIcon = async (details) => { + Object.assign(chrome.action, { lastIcon: details.path }); + await original(details); + }; + }); + for (const [state, variant, rgb] of [ + ["operational", "operational", [35, 134, 54]], + ["degraded_performance", "attention", [191, 135, 0]], + ["under_maintenance", "attention", [191, 135, 0]], + ["partial_outage", "outage", [207, 34, 46]], + ["major_outage", "outage", [207, 34, 46]], + ["unrecognized", "unknown", [110, 119, 129]], + ] as const) { + await seed(state); + const icon = await worker.evaluate(() => + Reflect.get(chrome.action, "lastIcon"), + ); + expect(icon).toEqual({ + 16: `/icons/${variant}-16.png`, + 24: `/icons/${variant}-24.png`, + 32: `/icons/${variant}-32.png`, + }); + const page = await context.newPage(); + await page.goto(`chrome-extension://${extensionId}/options.html`); + const image = await page.evaluate(async (name) => { + const bitmap = await createImageBitmap( + await (await fetch(`icons/${name}-32.png`)).blob(), + ); + const canvas = document.createElement("canvas"); + canvas.width = 32; + canvas.height = 32; + const ctx = canvas.getContext("2d")!; + ctx.drawImage(bitmap, 0, 0); + bitmap.close(); + return { + edge: Array.from(ctx.getImageData(0, 0, 1, 1).data), + ring: Array.from(ctx.getImageData(16, 3, 1, 1).data), + center: Array.from(ctx.getImageData(16, 16, 1, 1).data), + }; + }, variant); + expect(image.edge[3]).toBe(0); + expect(image.center[3]).toBe(0); + expect(image.ring).toEqual([...rgb, 255]); + await page.close(); + } +}); From 0f7bd28efdeb1515d4c05e2cfea554c23a733fd6 Mon Sep 17 00:00:00 2001 From: Carlos Panato Date: Fri, 6 Nov 2026 14:04:01 +0100 Subject: [PATCH 2/2] docs: clarify release installation folders and update steps --- README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a3b0cce..cece269 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,76 @@ A small, local-first Chrome / Chromium extension for GitHub's published service The first version includes the overall status, affected-first service list, active incidents and scheduled maintenance, a GitHub toolbar icon colored by status, background polling, persistent cache, manual refresh, system/light/dark themes, and update interval settings. Only `storage`, `alarms`, and access to `https://www.githubstatus.com/*` are requested. -## Build and install +## Install a release in Chrome + +Download a ready-to-use ZIP from [GitHub Releases](https://github.com/cpanato/github-status-extension/releases). You do not need Node.js, Go, npm, or a copy of the source repository to use a release. + +### Choose where to keep the extension + +Chrome loads an unpacked extension directly from the folder you select. **Keep that extracted folder in a permanent location while the extension is installed.** The ZIP can be deleted after extraction. + +Suggested locations for this project: + +| System | Suggested installation folder | +| ------- | ---------------------------------------- | +| macOS | `~/Applications/github-status-extension` | +| Linux | `~/.local/share/github-status-extension` | +| Windows | `%LOCALAPPDATA%\GitHubStatusExtension` | + +These are suggestions, not required Chrome locations. You can choose another permanent folder, including a directory on another drive. The destination is selected when you click **Load unpacked**; there is no installation-path setting inside the extension. Use the same folder for later updates. Chrome manages its own profile folders; you do not need to copy files into them. + +### Download, extract, and load + +1. Open the release you want to test. Under **Assets**, download `github-status-extension-.zip` and, optionally, its matching `.zip.sha256` checksum. The automatically generated **Source code** archives contain the development source, not the ready-to-use extension. +2. Create your permanent installation folder and extract the ZIP contents into it. +3. Check that `manifest.json` is directly inside that folder: + + ```text + github-status-extension/ + manifest.json + popup.html + options.html + background/ + icons/ + ui/ + ... + ``` + +4. Open `chrome://extensions` in Chrome and enable **Developer mode**. +5. Click **Load unpacked** and select the folder containing `manifest.json`. +6. Open Chrome's extensions menu (the puzzle icon), find **GitHub Status Indicator**, and pin it to the toolbar. Click the GitHub icon to view status; use the gear in the popup for preferences. + +On macOS, for example, after downloading the ZIP to Downloads: + +```bash +release_version=0.1.0-rc.3 # Replace with the version you downloaded. +extension_dir="$HOME/Applications/github-status-extension" # Change to your preferred folder. +mkdir -p "$extension_dir" +unzip "$HOME/Downloads/github-status-extension-$release_version.zip" -d "$extension_dir" +open "$extension_dir" +``` + +In Chrome, select that `github-status-extension` folder. In the folder picker, **Command–Shift–G** lets you paste its full path. For the suggested location, enter `~/Applications/github-status-extension`. + +For an optional checksum check on macOS, keep the ZIP and its checksum in the same directory and run: + +```bash +cd "$HOME/Downloads" +release_version=0.1.0-rc.3 # Replace with the version you downloaded. +shasum -a 256 -c "github-status-extension-$release_version.zip.sha256" +``` + +### Update an installed release + +1. Download the next release's ZIP and extract its contents into the **same installation folder**, replacing the existing extension files. Keep `manifest.json` at the same location; avoid adding a nested folder named after the new version. +2. Open `chrome://extensions`, find **GitHub Status Indicator**, and click its **Reload** button (the circular arrow). +3. Open **Details** to check the displayed version, then open the popup to confirm the update. Use **Reload** for updates rather than removing and re-adding the extension. + +Updates are manual while releases are installed this way. If you move or delete the extracted folder, Chrome can no longer load that installation. Choose the permanent location before the first install; keep Downloads and temporary build/worktree directories for downloads and development. + +This uses Chrome's documented [Load unpacked and Reload workflow](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world#load-unpacked), also used for local builds of extensions such as [Bitwarden](https://contributing.bitwarden.com/getting-started/clients/browser/) and [Stylus](https://github.com/openstyles/stylus/wiki/Install-Stylus-from-GitHub). + +## Build from source (development) Requires Node.js 26 LTS or newer and npm. The `.nvmrc` file selects Node 26 for local development and CI; run `nvm install && nvm use` if you use nvm. Bash, jq, zip, and shasum are used for packaging. @@ -13,7 +82,7 @@ npm ci --ignore-scripts npm run build ``` -Open `chrome://extensions`, enable **Developer mode**, choose **Load unpacked**, and select this worktree's `dist` directory. Pin **GitHub Status Indicator** to the toolbar. No login or configuration is needed. Open settings using the gear in the popup. +For development, open `chrome://extensions`, enable **Developer mode**, click **Load unpacked**, and select the generated `dist` directory inside your checkout/worktree. This directory contains `manifest.json`. Rebuild and click **Reload** after code changes. For an installation independent of the checkout, copy the contents of `dist` into your chosen permanent folder and follow the release installation steps above. ```bash npm run package @@ -29,7 +98,7 @@ The dedicated Release workflow runs only when a version tag is pushed; it has no The repository enables release immutability. Publication creates a draft, uploads every asset, downloads and verifies the uploaded package, and only then publishes the draft. Published assets and tags are never replaced. If publication fails, the release stays unpublished; fix the issue and cut a new RC instead of overwriting assets. Future cosign signatures must be included before publication. -To test a published RC, download and extract its ZIP, open `chrome://extensions`, enable **Developer mode**, and choose **Load unpacked** with the extracted directory. To verify the download, put the ZIP and checksum in the same directory and run `shasum -a 256 -c github-status-extension-0.1.0-rc.1.zip.sha256`. +To test a published RC, follow [Install a release in Chrome](#install-a-release-in-chrome) above. RC and stable ZIPs use the same installation and update procedure. To prepare an RC locally without publishing: