Compare commits

..
706 Commits
Author SHA1 Message Date
Svilen Markov 9de6843a2e Merge pull request #648 from glanceapp/dev
Create release / release (push) Has been cancelled
v0.8.0
2025-05-13 19:22:13 +01:00
Svilen Markov bd5cacd14a Update docs 2025-05-13 18:55:57 +01:00
Svilen Markov 96007e98bc Update docs 2025-05-13 17:35:16 +01:00
Svilen Markov ae409768ac Rename widget type 2025-05-13 17:10:28 +01:00
Svilen Markov baaf306ebf Add percentChange function 2025-05-11 21:09:12 +01:00
Svilen Markov 7bbf103e01 Add custom-api options and template requests 2025-05-11 15:49:21 +01:00
Svilen Markov 49c07f397e Don't escape safe URLs 2025-05-10 13:25:56 +01:00
Svilen Markov dd91a506fa Add todo widget 2025-05-08 16:59:02 +01:00
Svilen Markov 4ed8bef562 Update default light theme 2025-05-07 21:03:58 +01:00
Svilen Markov 8db6544400 Update favicon 2025-05-07 20:56:40 +01:00
Svilen Markov ca9e4d273b Fix popover error 2025-05-07 20:17:36 +01:00
Svilen Markov 9324da6a2f Change default light theme 2025-05-07 20:17:30 +01:00
Svilen Markov ce3a7ee29c Update auth stuff 2025-05-07 19:47:35 +01:00
Svilen Markov c9e6b774f3 Add head-widgets 2025-05-06 13:37:14 +01:00
Svilen Markov 9ffb2d9939 Change default light theme 2025-05-06 11:31:57 +01:00
Svilen Markov c5d4cf8f68 Allow hiding widget header 2025-05-06 10:52:46 +01:00
Svilen Markov 6b7d68d960 Add auth 2025-05-06 01:38:22 +01:00
Svilen Markov 0cb8a810e6 Remove transition on active 2025-05-05 13:50:55 +01:00
Svilen Markov 40ae263248 Add expiration to theme cookie 2025-05-05 13:46:36 +01:00
Svilen Markov bf97829814 Make theme cookie samesite lax 2025-05-05 13:30:14 +01:00
Svilen Markov b075607bac Make app icon bigger 2025-05-05 13:27:27 +01:00
Svilen Markov 56bdd2c9a3 Make repository widget links bigger on mobile 2025-05-05 13:15:51 +01:00
Svilen Markov 0f6e51ee5c Add new logo 2025-05-05 12:47:40 +01:00
Svilen Markov 1c5701fde5 Remove unused block 2025-05-05 11:04:40 +01:00
Svilen Markov 6c1c909c9d Make text non-selectable 2025-05-05 11:04:01 +01:00
Svilen Markov 26ab9c7b05 Auto detect favicon type and add fallback 2025-05-05 11:03:30 +01:00
Svilen Markov 176f14df70 Don't show background on hover 2025-05-05 10:58:22 +01:00
Svilen Markov 2d1e317c1f Reposition popover on scroll 2025-05-04 17:40:57 +01:00
Svilen Markov fcdea66a0f Hide popover on click 2025-05-04 17:40:49 +01:00
Svilen Markov 0e91958de5 Reduce text saturation of default light theme 2025-05-04 17:09:49 +01:00
Svilen Markov 6624b635df Increase contrast of default light theme 2025-05-04 17:05:20 +01:00
Svilen Markov 0612dc6f89 Use fmt.Errorf instead 2025-05-04 16:54:16 +01:00
Svilen Markov 0769f33653 Merge pull request #299 from hecht-a/theme_switcher
feat: theme switcher
2025-05-04 16:53:56 +01:00
Svilen Markov c2286f9a22 Update implementation 2025-05-04 16:49:20 +01:00
Svilen Markov a2d8410fec Merge remote-tracking branch 'upstream/dev' into theme_switcher 2025-04-29 19:03:41 +01:00
Svilen Markov a68805b55d Merge remote-tracking branch 'upstream/dev' into theme_switcher 2025-04-29 18:55:30 +01:00
Svilen Markov 8ca6879a1c Rename variable 2025-04-29 17:09:19 +01:00
Svilen Markov 1661f14adb Add timeout property 2025-04-29 17:08:36 +01:00
Svilen Markov 7d08eb312f Merge pull request #462 from charlesharries/rss-feed-conditional-requests
feat: Use conditional requests for RSS feeds
2025-04-29 10:42:28 +01:00
Svilen Markov 47340ed82a Merge branch 'dev' into rss-feed-conditional-requests 2025-04-29 10:39:19 +01:00
Svilen Markov 129441713b Refactor RSS widget 2025-04-29 10:37:46 +01:00
Svilen Markov a3e9510c1d Merge pull request #623 from mmshivesh/main
Minor design tweak, polishing up the polyline corners
2025-04-29 08:45:54 +01:00
Svilen Markov 328ba9a239 Merge branch 'main' into dev 2025-04-29 08:44:10 +01:00
Svilen Markov 3a3ff080ac Update returned err 2025-04-29 08:41:15 +01:00
Shivesh e2d3e1c04f Typed the wrong key- stroke-linecap instead of stroke-linejoin 2025-04-28 20:55:04 -04:00
Shivesh b3658bea09 Update markets.html
Ever so slightly improve the corner rounding of the polyline to make it more cohesive with the standard theming (slightly rounded corners etc.). Minor change, only visible at higher zoom levels.
2025-04-28 20:38:28 -04:00
Svilen Markov 1ad71f6974 Increase MaxIdleConnsPerHost 2025-04-28 20:01:12 +01:00
Svilen Markov 9dde306c0c Use limit query param in reddit widget 2025-04-28 18:49:10 +01:00
Svilen Markovands0ders d7a17aab01 Add reddit app auth #529
Co-authored-by: s0ders <39492740+s0ders@users.noreply.github.com>
2025-04-28 18:37:14 +01:00
Svilen Markov 65adf9b9c3 Add auto-invert option to icon fields 2025-04-28 16:27:08 +01:00
Svilen Markov aceb832645 Mention config schema in docs 2025-04-26 18:58:27 +01:00
Svilen Markov ec2f549295 Update property description 2025-04-26 18:56:25 +01:00
Svilen Markov 6e06c9c489 Bump results count to 20 #615 2025-04-26 18:12:25 +01:00
Svilen Markov 1862858c07 Merge pull request #453 from mike391/Add-support-configure-docker-containers-yaml
Feat: Added support for configuring Docker containers through glance.yaml instead of labels
2025-04-26 17:50:03 +01:00
Svilen Markov 306c28f203 Merge branch 'dev' into Add-support-configure-docker-containers-yaml 2025-04-26 17:44:34 +01:00
Svilen Markov bba2c5b20c Update label overrides implementation 2025-04-26 17:39:05 +01:00
Svilen Markov 18436e91e0 Docker containers: remote socket, category and running-only 2025-04-26 16:20:00 +01:00
Svilen Markov 77fb199cb3 Increase padding on mobile nav links 2025-04-26 16:20:00 +01:00
Svilen Markov 272bf1d2ad Merge pull request #594 from anxdpanic/error-responses
update error reporting for custom-api JSON validation
2025-04-24 09:06:05 +01:00
Svilen Markov ceebf34874 Use hex values & add theme_color in manifest.json
It looks like support for hsl color values within the manifest
is limited so we have to convert the colors to hex
2025-04-23 13:03:18 +01:00
Svilen Markov efd39e1f80 Merge pull request #602 from dvdpearson/dev
Dynamize manifest.json with configurable options
2025-04-23 12:25:09 +01:00
Svilen Markov 93c72f561b Also use app properties for apple-related elements 2025-04-23 12:18:46 +01:00
Svilen Markov 689e8f216c Rename function 2025-04-23 12:10:15 +01:00
Svilen Markov 4e4c3cfe64 Update dynamic manifest implementation 2025-04-23 12:09:33 +01:00
Svilen Markov e2112e0d83 Change HSL values to floats 2025-04-23 11:55:58 +01:00
Svilen Markov 44fca91089 Don't return if the err is a warning 2025-04-22 23:56:00 +01:00
Svilen Markov 4ae40cbd1e Merge branch 'main' into dev 2025-04-22 23:17:24 +01:00
Svilen Markov ea04aec0b4 Add target property to search widget
Create release / release (push) Has been cancelled
2025-04-22 23:07:07 +01:00
Svilen Markov b8e2717faf Add parseLocalTime function 2025-04-22 22:40:55 +01:00
David Pearson 333d40ed4f Dynamize manifest.json with configurable options 2025-04-20 10:00:17 -04:00
Svilen Markov cb3555f5ed Fix bug when making single request in job 2025-04-18 17:10:09 +01:00
anxdpanic 7a8f70db02 update error reporting for custom-api JSON validation
- show the request error on non-200 responses
2025-04-17 09:05:15 -04:00
Svilen Markov 1cf4f520f8 Merge pull request #578 from hitalos/dev
Support embed icons on bookmarks URLs
2025-04-15 21:58:24 +01:00
Svilen Markov e11ce5d3d0 Change the type of the field 2025-04-15 21:55:55 +01:00
Svilen Markov 502950709c Update sensors warning check 2025-04-15 04:08:05 +01:00
anxdpanic 2c3e14d84c [sensors] allow sensor readings when there are warnings 2025-04-15 04:07:50 +01:00
Svilen Markov 8e71afe158 Escape proxied request URL 2025-04-15 04:02:23 +01:00
Svilen Markov 44ea98fc41 Merge pull request #583 from anxdpanic/sensors
[sensors] allow sensor readings when there are warnings
2025-04-15 03:42:43 +01:00
Svilen Markov 5214fb9145 Update sensors warning check 2025-04-15 03:37:38 +01:00
anxdpanic 41e74ba9b5 [sensors] allow sensor readings when there are warnings 2025-04-14 09:05:18 -04:00
Svilen Markov 03b616622e Fix bug when making single request in job
Create release / release (push) Has been cancelled
2025-04-14 01:07:04 +01:00
Svilen Markov 50e1da01fe Add newline 2025-04-13 17:40:30 +01:00
Svilen Markov 0daa620b11 Merge branch 'main' into dev 2025-04-13 17:27:32 +01:00
Svilen Markov f8f50b26d8 Add mountpoint:info CLI command
Create release / release (push) Has been cancelled
2025-04-13 17:09:51 +01:00
Svilen Markov a3bc133bcb Maybe fix for missing mountpoint info 2025-04-13 16:52:17 +01:00
Svilen Markov 50dae22ff4 Add restart: unless-stopped 2025-04-13 16:15:59 +01:00
Svilen Markov 5a91154eab Document function 2025-04-13 16:08:04 +01:00
Ralph Ocdol d5b89d512a added unique to filter arrays with unique items in custom-api 2025-04-13 16:07:54 +01:00
Svilen Markov c4e4c62072 Merge pull request #580 from ralphocdol/unique-array-custom-api
added unique to filter arrays with unique items in custom-api
2025-04-13 16:04:16 +01:00
Svilen Markov 33b54ded4f Delete main.css 2025-04-13 16:01:54 +01:00
Svilen Markov 0d2f5a818b Merge branch 'dev' into unique-array-custom-api 2025-04-13 16:00:39 +01:00
Svilen Markov 8f217e6f01 Merge branch 'main' into dev 2025-04-13 15:58:10 +01:00
Svilen Markov 835d7767cb Merge remote-tracking branch 'upstream/main' into unique-array-custom-api 2025-04-13 15:54:52 +01:00
Svilen Markov 8892a39160 Document function 2025-04-13 15:52:16 +01:00
Ralph Ocdol db97871945 added unique to filter arrays with unique items in custom-api 2025-04-13 10:46:43 +08:00
Hítalo Silva 90254b92d2 Support embed icons on bookmarks URLs 2025-04-12 19:48:09 -03:00
Svilen Markov eeda2104a6 Only set title if attribute isn't set 2025-04-11 23:15:31 +01:00
Svilen Markov 97f43f88eb Only set title if attribute isn't set 2025-04-11 23:14:06 +01:00
Svilen Markov 793da48f5c Add rounded class 2025-04-11 22:35:40 +01:00
Svilen Markov 3177af9524 Add rounded class 2025-04-11 22:34:53 +01:00
Svilen Markov f99d22738c Add replaceMatches 2025-04-11 20:37:45 +01:00
Ralph Ocdol ea7124db52 feat: custom-api's replaceAll with regex support 2025-04-11 20:37:36 +01:00
Lucas L. b1247e5de6 Add filter on already seen links for RSS feeds 2025-04-11 20:34:47 +01:00
Svilen Markov 5ab962634e Fix sorting bug in twitch channels widget 2025-04-11 20:34:03 +01:00
Svilen Markov d99944dcff Avoid spinning up unnecessary goroutines for single data jobs 2025-04-11 20:33:24 +01:00
Svilen Markov 84f7286460 Make Get return decorated result
This may break existing widgets that rely on .Get returing a raw gjson.Result
2025-04-11 20:30:07 +01:00
Svilen Markov 920bcb06dc Print warnings when failing to get sensors 2025-04-11 19:34:49 +01:00
Svilen Markov 3679cc21ab Increase scale of everything on mobile
Create release / release (push) Has been cancelled
2025-04-10 00:44:55 +01:00
Svilen Markov 07e5626469 Add version & sensors:print cli commands 2025-04-10 00:39:08 +01:00
Svilen Markov 6bb6f87800 Fix diagnose command 2025-04-10 00:35:27 +01:00
Svilen Markov cb6b52ff4c Bump go version 2025-04-10 00:34:53 +01:00
Svilen Markov 03c377dff3 Update dependencies 2025-04-10 00:14:40 +01:00
Svilen Markov d9c934d3eb Merge pull request #494 from HtFilia/dev
Add filter on already seen links for RSS feeds
2025-04-09 17:15:11 +01:00
Svilen Markov 0bc31b0f31 Merge pull request #542 from ralphocdol/custom-api-replace-all-regex
Add replaceMatches
2025-04-09 17:07:43 +01:00
Svilen Markov 5a38c8dd2f Add replaceMatches 2025-04-09 17:05:18 +01:00
Svilen Markov 0e3f172032 Merge pull request #553 from Panonim/patch-1
Added Community Widgets Link to Readme.
2025-04-09 16:40:36 +01:00
Svilen Markov fd704419d9 Update readme links 2025-04-09 16:39:53 +01:00
Artur Flis 32ac72f592 Update README.md 2025-04-02 19:57:01 +02:00
Ralph Ocdol 15f20ffaeb feat: custom-api's replaceAll with regex support 2025-03-31 22:24:51 +08:00
Svilen Markov 9c77b87435 Merge pull request #486 from daot/main
Make clickable area for docker-containers widget items bigger
2025-03-30 14:57:16 +01:00
Svilen Markov d4d9e94f44 Make link hitbox take up full width 2025-03-30 14:53:59 +01:00
Svilen Markov 47cef2abf0 Merge pull request #499 from FranklyFuzzy/main
Added Dracula theme code and screenshot
2025-03-30 14:40:15 +01:00
Svilen Markov 0a5cdf380f Merge pull request #528 from diceroll123/patch-1
Fix typo
2025-03-30 14:39:39 +01:00
Svilen Markov 7f0e9b3289 Merge branch 'main' into dev 2025-03-29 18:01:15 +00:00
Svilen Markov 9da7967158 Update docs
Create release / release (push) Has been cancelled
2025-03-29 18:00:36 +00:00
Svilen Markov 964744a9ae Add offsetNow function 2025-03-29 17:57:43 +00:00
Svilen Markov 779304d035 Allow skipping JSON check and add JSONLines 2025-03-29 13:36:22 +00:00
Svilen Markov f15d7445bd Add concat function 2025-03-29 13:20:53 +00:00
Svilen Markov 26d68ba3fc Allow extension widget to specify title-url 2025-03-29 10:56:11 +00:00
Svilen Markov 9effff25df Increase z-index of mobile nav
This fixes the carousel gradient side
being above it since it also has z-index 10
2025-03-29 10:49:52 +00:00
Svilen Markov 958805a1fd Increase z-index of mobile nav
This fixes the carousel gradient side
being above it since it also has z-index 10
2025-03-29 10:49:37 +00:00
Svilen Markov dd74c173a5 More custom-api additions/tweaks
* Remove need to convert to int for math stuff
* Add `now` and `duration` functions
2025-03-28 23:34:49 +00:00
Svilen Markov bd020c93f5 Fix markets price precision 2025-03-28 14:11:17 +00:00
Steve C 75555f0426 Fix typo 2025-03-27 23:45:27 -04:00
Svilen Markov 4e6b14a467 Merge branch 'main' into dev 2025-03-26 19:46:16 +00:00
Svilen Markov 233de7fc37 Add new functions to custom-api widget
Create release / release (push) Has been cancelled
2025-03-26 19:44:35 +00:00
Svilen Markov c6e0230e5d Allow sending headers in extension widget 2025-03-26 17:59:41 +00:00
Svilen Markov ca2732668e Update docs 2025-03-26 17:58:52 +00:00
Svilen Markov 456b76ac96 Allow specifying method and request body 2025-03-26 17:58:35 +00:00
Svilen Markov a2c58bea82 Add parseRelativeTime function 2025-03-26 11:28:05 +00:00
Svilen Markov 7276b3d5ef Add allow-insecure to custom-api widget 2025-03-26 11:27:47 +00:00
Svilen Markov 1ef8315462 Only override extension url query if parameters property present 2025-03-26 11:27:12 +00:00
Svilen Markov 2f88ac419b Add parseTime to custom-api 2025-03-26 11:27:07 +00:00
Ralph OcdolandSvilen Markov cee7c85780 Add subrequests to custom-api (#385)
* feat: custom-api multiple API queries

* fix template check

* refactor

* Update implementation & docs

* Swap statement

* Update docs

---------

Co-authored-by: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com>
2025-03-26 11:26:16 +00:00
Svilen Markov b2c5205035 Add support for bool in query params fields 2025-03-26 11:25:47 +00:00
Svilen Markov 2be59c3eb6 Fix failing to parse empty response body in custom api widget 2025-03-26 11:25:34 +00:00
Svilen Markov 176fc896ae Also apply to extension widget 2025-03-26 11:24:43 +00:00
Svilen Markov a943555d86 Add note to docs 2025-03-26 11:24:27 +00:00
Svilen Markov 58bbfbbc42 Make query parameters field reusable 2025-03-26 11:24:15 +00:00
Ralph Ocdol 026b644630 feat: add parameters and array parameters support 2025-03-26 11:24:08 +00:00
FranklyFuzzy 1483b355af Update themes.md
Added Dracula theme with screenshot
2025-03-23 14:16:09 -04:00
FranklyFuzzy 6a5bb635bb Add files via upload 2025-03-23 14:14:54 -04:00
Lucas L. 18241136e3 Add filter on already seen links for RSS feeds 2025-03-22 19:59:00 +01:00
Svilen Markov 6fb6467b07 Fix sorting bug in twitch channels widget 2025-03-22 11:02:06 +00:00
Svilen Markov 83f0d16904 Increase scale on mobile 2025-03-21 23:40:23 +00:00
‮daot 0e0aca3844 Update docker-containers.html 2025-03-21 18:08:15 -05:00
Svilen Markov 97b52792ef Fix CSS issues on mobile due to order of declarations 2025-03-21 14:04:43 +00:00
Svilen Markov 0680c5ff9c Bump contrast of progress value 2025-03-21 13:50:33 +00:00
Svilen Markov f1f0158238 Add parseRelativeTime function 2025-03-20 23:49:09 +00:00
Svilen Markov bca3617116 Add allow-insecure to custom-api widget 2025-03-20 23:02:17 +00:00
Svilen Markov 55ae674e0b Add desktop-navigation-width property 2025-03-20 22:54:39 +00:00
Svilen Markov 46eb610d26 Fix typo 2025-03-20 22:54:39 +00:00
Svilen Markov bfc2e9c7fb Reduce contrast of progress bar values 2025-03-20 22:54:39 +00:00
Svilen Markov ffedd9eaf9 Merge pull request #480 from stripedew/dev
Add Kagi and Startpage as search engines
2025-03-20 19:37:08 +00:00
Svilen Markov 1512718d41 Update readme
Added "Common issues"
2025-03-20 19:27:29 +00:00
Svilen Markov e566dcd0d9 Make config variables matching stricter
This prevents strings such as ${whatever} from getting
confused for env variables and resulting in config errors
2025-03-20 16:57:56 +00:00
Svilen Markov 43b8f8f31b Split CSS into multiple files
This shouldn't result in anything breaking,
will require thorough testing
2025-03-20 16:57:55 +00:00
stripedew 768f700719 Update configuration.md 2025-03-20 12:02:33 +00:00
stripedew ab1faedadf Update widget-search.go 2025-03-20 12:01:26 +00:00
stripedew fa325bd519 Update configuration.md
Added Kagi
2025-03-20 11:53:59 +00:00
Svilen Markov 568876fc4f Merge pull request #476 from jpinz/dev
Add bing and perplexity as search engines
2025-03-19 20:00:54 +00:00
Julian d506604918 Add bing and perplexity as search engines 2025-03-19 16:25:10 +00:00
Svilen Markov 7c9f79f243 Merge pull request #466 from ralphocdol/dns-stats-pihole-default-title-url
make title-url of pihole and pihole-v6 default to /admin
2025-03-18 13:13:46 +00:00
Svilen Markov a77d0ce5c0 Move behavior within the widget init
Otherwise we create a global getWidgetTitleURL
function that sounds a little too generic and vague
2025-03-18 13:11:19 +00:00
Ralph Ocdol 55685e6854 make title-url of pihole and pihole-v6 default to /admin 2025-03-18 11:02:26 +08:00
Svilen Markov 4731b90899 Merge pull request #456 from slashformotion/slashformotion/refactor
refacto: remove duplicate
2025-03-17 20:49:10 +00:00
Charles Harries f36527995e feat: Use conditional requests for RSS feeds 2025-03-17 19:06:32 +00:00
Svilen Markov fd5cf98072 Refactor config variables and add new features
* Can now use Docker secrets
* Can now read files who's path is provided by an env var
2025-03-17 17:37:51 +00:00
slashformotion 844e32a11e refacto: remove duplicate 2025-03-17 16:26:43 +01:00
Svilen Markov 82cb0143f2 Only override extension url query if parameters property present 2025-03-17 14:16:47 +00:00
MikeC 51e70347e4 Add Documentation 2025-03-17 07:09:31 -04:00
MikeC 075bdfdc23 Add ability to convert docker container names to humanreadable names 2025-03-17 06:58:11 -04:00
MikeC e84edb3e30 Add support to configure docker containers in yaml 2025-03-17 06:53:08 -04:00
Svilen Markov 2bde4656ed Merge branch 'main' into dev 2025-03-17 03:01:06 +00:00
Svilen Markov 0b2cfc45c1 Docker containers accessibility improvements
Create release / release (push) Has been cancelled
2025-03-17 02:06:32 +00:00
Svilen Markov c8be41ce6c Reduce contrast of calendar dates 2025-03-17 00:45:23 +00:00
Svilen Markov ec2f710d06 Use constant for the prefix 2025-03-16 23:17:07 +00:00
Svilen Markov 71112173b9 Fix title link not opening in new tab 2025-03-16 23:15:19 +00:00
Svilen Markov 1615c20e66 Change custom api int64 types to int
Some of Go's native template functions return int and
having to juggle between int and int64 might get messy
so we'll try to stick to having a single int type
2025-03-16 01:32:35 +00:00
Svilen Markov fbcea12786 Add more info to logged message 2025-03-16 01:25:13 +00:00
Svilen Markov 047d13afd1 Fix summary triangle showing on Safari 2025-03-16 01:24:56 +00:00
Svilen Markov 4c1165533c Define service strings as consts to avoid forgetting to change them in all places
Create release / release (push) Has been cancelled
2025-03-15 19:41:08 +00:00
Svilen Markov 14bdcf71fe Remove debug code 2025-03-15 19:10:21 +00:00
Svilen Markov 1b3f022b2d Rename service to reduce ambiguity
Create release / release (push) Has been cancelled
2025-03-15 19:03:48 +00:00
Svilen Markov b6d93a7f09 Merge pull request #371 from KallanX/enhancement/add-support-pihole-v6
Enhancement/add support pihole v6
2025-03-15 18:45:22 +00:00
Svilen Markov 4b2438c298 Refactor DNS stats widget 2025-03-15 18:42:58 +00:00
Svilen Markov 3b79c8e09f Remove symbol-link-template 2025-03-15 10:27:39 +00:00
Svilen Markov d22ac6a7a4 Add parseTime to custom-api 2025-03-13 00:55:31 +00:00
Svilen Markov 2f50f5ef34 Merge branch 'main' into dev 2025-03-12 18:04:16 +00:00
Svilen Markov d7bbf2b8e2 Accessibility improvements
Create release / release (push) Has been cancelled
2025-03-12 18:01:35 +00:00
Svilen Markov b8df34309f Add note to docs about page width 2025-03-12 18:01:35 +00:00
Svilen Markov 278fa3c397 Add gap between domain and percent 2025-03-12 18:01:35 +00:00
Svilen Markov 6f48ee98e5 Uppercase currency before looking for matching symbol #365 2025-03-12 18:01:35 +00:00
Svilen Markov 14db59318c Avoid spinning up unnecessary goroutines for single data jobs 2025-03-12 10:35:54 +00:00
Svilen Markov f9b3deaff2 Simplify worker num with min 2025-03-12 10:35:54 +00:00
Ralph OcdolandSvilen Markov c265e42220 Add subrequests to custom-api (#385)
* feat: custom-api multiple API queries

* fix template check

* refactor

* Update implementation & docs

* Swap statement

* Update docs

---------

Co-authored-by: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com>
2025-03-12 10:30:29 +00:00
Svilen Markov c0bdf1551d Add support for bool in query params fields 2025-03-10 09:56:47 +00:00
Ralph OcdolandSvilen Markov e373eeeed3 fix: full width clickable link for monitor-site (#405)
* feat: full width clickable link for monitor-site

* refactor

* Use grow instead of width-100

---------

Co-authored-by: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com>
2025-03-10 09:49:38 +00:00
Svilen Markov 774b0c104b Merge pull request #399 from KadoBOT/patch-1
Update configuration.md
2025-03-08 09:46:37 +00:00
Ricardo Ambrogi fbd4d9a74e Update configuration.md
Correct `title` to `name`.

I'm unsure if `title` is also accepted, I haven't tested it. Please close this PR if this fix is not valid.
2025-03-07 09:07:10 +01:00
Svilen Markov 6c8859863a Add description property to bookmarks widget links 2025-03-02 00:09:28 +00:00
Svilen Markov 31ecd91f7c Fix failing to parse empty response body in custom api widget 2025-03-01 23:43:33 +00:00
Svilen Markov 474255c985 Tweak error message 2025-03-01 23:38:29 +00:00
Svilen Markov 652f9ceb5c Merge pull request #378 from ralphocdol/custom-api-array-parameters
feat: add parameters and array parameters support
2025-03-01 23:36:29 +00:00
Svilen Markov 49668d4ba9 Also apply to extension widget 2025-03-01 23:30:20 +00:00
Svilen Markov acddaf07db Add note to docs 2025-03-01 23:29:56 +00:00
Svilen Markov 8da26ab409 Make query parameters field reusable 2025-03-01 23:29:28 +00:00
Svilen Markov 3f2fefe4f7 Merge pull request #382 from legoraft/main
Added gruvbox theme
2025-03-01 22:44:22 +00:00
Legoraft fb8513bc9f Added gruvbox theme code and screenshot 2025-03-01 14:19:36 +01:00
Legoraft e4ec958edb Added gruvbox screenshot 2025-03-01 14:17:17 +01:00
Ralph Ocdol 948289a038 feat: add parameters and array parameters support 2025-02-28 08:48:07 +08:00
Keith Carichner Jr 78ad88a245 Merge pull request #1 from ralphocdol/fix-graph
Fix Graph and move SID to header
2025-02-27 10:33:20 -05:00
Ralph Ocdol 99660aeee8 Fix Graph and move SID to header 2025-02-27 23:02:10 +08:00
Svilen Markov ce293ed891 Prevent infinite config include recursion 2025-02-27 07:22:18 +00:00
Svilen Markov 2738613344 Improve error message when widget type not specified 2025-02-27 07:12:07 +00:00
Svilen Markov 5d12d934b8 Use new range syntax 2025-02-27 07:11:44 +00:00
Svilen Markov 19a89645a1 Add support for nested includes 2025-02-27 07:11:03 +00:00
Keith Carichner Jr 65a412eb59 Pushing latest. Add ability to fetch series data from new api. 2025-02-26 16:20:43 -05:00
Svilen Markov 9df9673e84 Add alternative include syntax
Also make it the new recommended way for doing includes
2025-02-25 02:25:01 +00:00
Keith Carichner Jr 2002ed1c9c Pushing latest changes. 2025-02-24 13:52:27 -05:00
Svilen Markov 9c98c6d0c4 Merge branch 'main' into dev 2025-02-22 13:33:17 +00:00
Svilen Markov 488a1f6070 Update link to point to repo instead of pkg.go.dev 2025-02-22 13:32:50 +00:00
Svilen Markov 4d6600b0a3 Merge pull request #367 from ejsadiarin/dev
feat(monitor): add basic-auth feature for protected sites
2025-02-22 13:30:09 +00:00
Svilen Markov dac0d15e78 Update implementation 2025-02-22 13:29:00 +00:00
Svilen Markov 1e12d937aa Merge pull request #372 from DavisYe/main
Correct document
2025-02-22 12:58:56 +00:00
Keith Carichner Jr e643a44b59 Pushing latest fixes to handle the two different JSON responses. 2025-02-20 14:54:11 -05:00
DavisYe 7319870289 Correct the docker compose environment format of GITHUB_TOKEN in the configuration document. 2025-02-20 21:30:34 +08:00
Keith Carichner Jr 72c1ebf66d Minor README adjustment. 2025-02-19 23:23:22 -05:00
Keith Carichner Jr 008c4a3ab7 Removing SID check func. 2025-02-19 23:04:45 -05:00
Keith Carichner Jr 38d3d11571 Attempting to add support for Pi-hole v6. 2025-02-19 17:30:14 -05:00
ejsadiarin 5b45751c67 docs(monitor): add documentation for basic-auth feature 2025-02-19 17:40:56 +08:00
ejsadiarin c00d937f4c feat(monitor): add basic-auth feature for protected sites
this closes [issue #316](https://github.com/glanceapp/glance/issues/316)

Furthermore, this could be expanded to also pass the configured basic
auth credentials to the request when the user clicks on the specific
monitor widget
2025-02-19 17:28:13 +08:00
Svilen Markov d4565acfe7 Markets widget rate limit fix
Create release / release (push) Has been cancelled
2025-02-19 02:25:07 +00:00
Svilen Markov 16129c53bd Merge pull request #358 from rubiojr/rubiojr/reload-on-rename2
Auto-reload config file on RENAME
2025-02-19 01:25:08 +00:00
Svilen Markov cbf1961510 Don't try to get sensor info on openbsd 2025-02-17 23:48:16 +00:00
Svilen Markov c76a4d4be7 Increase docker containers widget timeout 2025-02-17 23:45:57 +00:00
Svilen Markov c33fe45d4c Merge branch 'main' into dev 2025-02-17 23:27:42 +00:00
Svilen Markov e355c643f4 Merge pull request #339 from KevinFumbles/dev
Added Technitium Service Option to DNS-Stats Widget
2025-02-17 23:20:54 +00:00
Svilen Markov fcccb7eb38 Update error message 2025-02-17 23:20:38 +00:00
Svilen Markov f9209406fb Reduce duplication of constants 2025-02-17 23:18:27 +00:00
Svilen Markov facbf6f529 Remove mention of env variable syntax 2025-02-17 23:08:36 +00:00
Svilen Markov 27af0400c0 Tweak impl for handling config renames 2025-02-17 22:28:10 +00:00
Sergio Rubio 76a80ff034 Add clarifying comment 2025-02-17 19:17:49 +01:00
Sergio Rubio f7f333ad52 Auto-reload config file on RENAME
Some editors (like Vim), create a temp file when saving, then replace
the file being edited with the temp file. This causes the FS notify
event to be RENAME, not WRITE, so auto-reload misses this.

In addition to that, the file is removed from the watcher and the
auto-reload functionality stops working entirely after the first RENAME.

https://github.com/fsnotify/fsnotify/issues/255 describes this.
2025-02-17 19:08:54 +01:00
Svilen Markov 0ce45e32aa Update dashboard icons repo
Create release / release (push) Has been cancelled
2025-02-15 14:59:20 +00:00
Svilen Markov abeb11c8a6 Add hide-mountpoints-by-default prop for server-stats 2025-02-15 14:43:25 +00:00
Svilen Markov e01af4adec Delay changing popover display
Previously would make the popover visible and then reposition
it on the next frame in order to avoid getting called recursively
due to the observer, however this causes the scrollbar to appear
if it wasn't already visible for a single frame which is janky.

This change fixes that.
2025-02-15 13:53:13 +00:00
Svilen Markov 3043a0bd15 Rework getting host info (#340) 2025-02-15 13:46:58 +00:00
Kevin 94806ed45d Added blocked domains count for Technitium 2025-02-12 16:05:38 -05:00
Kevin baee94ed1d Added configuration documentation for Technitium dns-stats service 2025-02-12 15:58:21 -05:00
Kevin 0c8358beaa Added Technitium as a valid service for dns-stats widget 2025-02-12 15:58:05 -05:00
Svilen Markov 232cab01f8 Fix typo 2025-02-10 23:15:12 +00:00
Svilen Markov b301953249 Update docs 2025-02-10 20:38:50 +00:00
Svilen Markov bb9cb03c8a Fix index out of range
Create release / release (push) Has been cancelled
2025-02-10 11:22:48 +00:00
Svilen Markov d8a4d39849 Merge pull request #330 from glanceapp/release/v0.7.0
Create release / release (push) Has been cancelled
Release/v0.7.0
2025-02-09 19:07:48 +00:00
Svilen Markov 0d6966726e Update pull request template 2025-02-09 18:45:23 +00:00
Svilen Markov bb26725c67 Include pkg dir when building docker image 2025-02-09 18:21:23 +00:00
Svilen Markov 103fe5718b Tidy mod 2025-02-09 18:15:50 +00:00
Svilen Markov a0d1bf1788 Bump versions 2025-02-09 18:04:25 +00:00
Svilen Markov 37f35281b4 Add server-stats widget 2025-02-09 17:52:22 +00:00
Svilen Markov 306fb3cb33 Add new calendar and deprecate old 2025-02-09 17:47:20 +00:00
Svilen Markov 24a6107171 Update config docs 2025-02-09 17:33:20 +00:00
Svilen Markov e495fbfd99 Remove comment 2025-02-09 17:33:07 +00:00
Svilen Markov da6fbc4995 Update custom-api doc 2025-02-09 17:32:55 +00:00
Svilen Markov 8d673e1229 Update readme 2025-02-09 17:32:43 +00:00
Svilen Markov d8c7d02f5e Add custom-api examples 2025-02-09 05:33:08 +00:00
Svilen Markov 8331c4b305 Add Exists function 2025-02-09 05:32:30 +00:00
Svilen Markov 5a06f4788b Return NaN instead of 0 when dividing by 0 2025-02-09 05:32:05 +00:00
Svilen Markov 827171e206 Add upgrade guide 2025-02-09 03:04:29 +00:00
Svilen Markov c3f3fa9876 Update readme 2025-02-09 00:40:19 +00:00
Svilen Markov 825ef84da5 Add comment 2025-02-09 00:39:51 +00:00
Svilen Markov 4445d46f61 Add example glance.yml to docs 2025-02-09 00:39:36 +00:00
Svilen Markov c583057d45 Allow specifying playlists separately 2025-02-09 00:31:53 +00:00
Svilen Markov 982f3ee2a1 Add issue templates 2025-02-07 11:11:58 +00:00
Svilen Markov cd1e4e9f91 Update update warn link 2025-02-07 11:06:44 +00:00
Svilen Markov 33f8e6d144 Update notice page 2025-02-07 11:06:20 +00:00
Svilen Markov af70cc83ba Add preserve-order and limit props to RSS widget 2025-02-07 11:05:53 +00:00
Svilen Markov 8b731fd9e5 Invert colors in docs image 2025-02-07 11:01:46 +00:00
Svilen Markov a0c697b982 Only ignore glance*.yml in root dir 2025-02-07 11:00:58 +00:00
Svilen Markov 21a6fe407b Remove println 2025-02-04 03:55:41 +00:00
Svilen Markov 1c1a7b3e27 Change label from title to name 2025-02-02 13:02:59 +00:00
Svilen Markov 61fd5481cc Update custom API 2025-02-02 13:02:46 +00:00
Svilen Markov d400b27545 Fix observer console errors 2025-01-22 16:59:10 +00:00
Svilen Markov ec9d455d18 Merge pull request #307 from Mystically11/add-prereleases-to-releases
feat: Add option to include GitHub repository pre-releases in releases widget
2025-01-17 20:18:47 +00:00
Svilen Markov 8a75f303bb Remove extra whitespace 2025-01-17 20:16:55 +00:00
Svilen Markov 0ce706e02e Update releases widget 2025-01-17 20:14:07 +00:00
Svilen Markov 3076593021 Merge remote-tracking branch 'upstream/release/v0.7.0' into add-prereleases-to-releases 2025-01-17 19:35:46 +00:00
Svilen Markov a83389bb7d Merge pull request #314 from JeckDev/release/v0.7.0
feat: add alternate link (error-url) for monitor widget sites
2025-01-17 19:10:41 +00:00
Svilen Markov ee1cde8a04 Update monitor widget 2025-01-17 19:09:49 +00:00
HECHT Axel 62e9c32082 feat: theme switcher 2025-01-15 12:19:50 +01:00
Svilen Markov a9efe88461 Revert points abbreviation 2025-01-15 07:49:08 +00:00
Jeck c8200f2972 Added error-url parameter to monitor sites 2025-01-14 21:32:04 -08:00
Svilen Markov 80b43d3e0c Further simplify points abbreviation implementation 2025-01-14 11:58:26 +00:00
Svilen Markov a7e235441b Simplify points abbreviation implementation 2025-01-14 11:55:52 +00:00
Svilen Markov bb80637e72 Only hide comment count if there's a target URL 2025-01-14 11:35:02 +00:00
Svilen Markov 8fb5de4e87 Remove whitespace in template 2025-01-14 10:48:35 +00:00
Svilen Markov 1c03f0a07a Update forum post templates
* Use approx number for points & comments
* Hide comments when limited on horizontal space
* Abbreviate "points" to "pts" when limited on horizontal space
* Don't let domain wrap
2025-01-14 10:41:46 +00:00
Svilen Markov b4ac96ccaf Remove whitespace in template & increase popover max width 2025-01-13 10:47:55 +00:00
Svilen Markov 5723fbdea5 Add markets widget link templates & automatic name 2025-01-12 04:21:47 +00:00
Svilen Markov 260bc15577 Remove reddit widget title forward slash prefix 2025-01-11 22:31:45 +00:00
Svilen Markov 59bfe3e835 Add vertical-list style for videos widget 2025-01-11 19:48:06 +00:00
Svilen Markov 086fac4120 Fix monitor widget showing incorrect status icon 2025-01-11 17:59:07 +00:00
Mystically 46bc36ad4a oops 2025-01-09 21:20:11 +01:00
Mystically ed477e8cc6 add option to include github prereleases 2025-01-09 21:19:13 +01:00
Svilen Markov 8b878149d4 Update docs 2025-01-09 17:17:56 +00:00
Svilen Markov db512419ea Add new text color class 2025-01-07 15:34:58 +00:00
Svilen Markov 491bc65a38 Add target property on bookmarks widget 2025-01-07 10:45:54 +00:00
Svilen Markov 94ec286de6 Add codeblock highlighting 2025-01-06 21:28:53 +00:00
Svilen Markov 108c83588c Allow using a standard HTTP proxy in reddit widget 2025-01-06 20:40:46 +00:00
Svilen Markov abbb4950a5 Fix HTML entities in RSS item titles 2025-01-04 07:49:29 +00:00
Svilen Markov 0fe0b34898 Merge pull request #298 from hecht-a/add_search_placeholder
feat: add possibility to set search input placeholder
2025-01-04 03:47:51 +00:00
HECHT Axel 8ad7d4be0a feat: add possibility to set search input placeholder 2025-01-03 19:36:43 +01:00
Svilen Markov ac7f3805d4 Add custom unmarshalling for pihole queries stats
+ hide-graph and hide-top-domains options for DNS stats widget
2024-12-28 14:17:48 +00:00
Svilen Markov e524dd111e Merge pull request #286 from DallasHoff/mobile-style-fixes-0.7.0
Mobile style fixes
2024-12-26 17:04:21 +00:00
Svilen Markov 4a14709f13 Tweak iOS fixes 2024-12-26 17:02:15 +00:00
Svilen Markov 85b8ee493e Update dependencies
Create release / release (push) Has been cancelled
2024-12-26 13:24:40 +00:00
Svilen Markov e546488aeb Fix broken reddit video & nsfw post thumbnails 2024-12-26 13:20:03 +00:00
Svilen Markov 0702e0abd3 Fix broken reddit video thumbnail URLs 2024-12-26 13:16:38 +00:00
Dallas Hoffman 29318005b2 Mobile style fixes 2024-12-24 14:42:28 -05:00
Svilen Markov b4b61c94d7 Merge branch 'main' into release/v0.7.0 2024-12-22 14:34:11 +00:00
Svilen Markov f18620d890 Add note about extension URL query parameters 2024-12-22 14:32:56 +00:00
Svilen Markov eb86c3fb79 Allow setting same-tab and hide-arrow on bookmark groups 2024-12-22 14:22:11 +00:00
Svilen Markov f89fc2ee1d Preserve formatting of non-html extension widget content 2024-12-22 13:44:41 +00:00
Svilen Markov 495eaa0a37 Add Widget-Content-Frameless option to extension widget 2024-12-22 13:31:26 +00:00
Svilen Markov b44b7b80ff Don't use sprintf for relative time attribute 2024-12-20 11:41:48 +00:00
Svilen Markov c8ff5362a3 Update dependencies 2024-12-19 23:05:47 +00:00
Svilen Markov d575a0a29f Remove console.log 2024-12-18 12:47:30 +00:00
Svilen Markov 2e1134fdfb Properly handle future timestamps for relative time 2024-12-18 11:30:17 +00:00
Svilen Markov ab6ae15836 Add automatic native titles to all truncateable elements 2024-12-17 23:34:32 +00:00
Svilen Markov a4840c7365 Remove unnecessary variables 2024-12-17 00:30:34 +00:00
Svilen Markov dbcc13a5cf Allow inserting env variables anywhere in the config 2024-12-16 23:59:25 +00:00
Svilen Markov 8d2639b349 Allow RSS feed URLs to be specified by env variables 2024-12-16 14:08:47 +00:00
Svilen Markov 889b034a79 Rename struct 2024-12-16 14:07:37 +00:00
Svilen Markov e49145023f Don't escape user-defined URLs 2024-12-16 14:05:52 +00:00
Svilen Markov ae1fb05607 Better convention for safe template types 2024-12-16 13:58:58 +00:00
Svilen Markov 80a957bc5b Change extension user-defined title to take precedence 2024-12-15 15:04:33 +00:00
Svilen Markov 24f93d8258 Merge pull request #275 from glanceapp/release/v0.6.3
Create release / release (push) Has been cancelled
Release/v0.6.3
2024-12-11 18:56:48 +00:00
Svilen Markov 01016e08d2 Merge branch 'main' into release/v0.6.3 2024-12-11 18:53:40 +00:00
Svilen Markov 949fde1517 Fix edge case in weather widget graph 2024-12-11 18:50:34 +00:00
Svilen Markov 804cf9916b Change simple icons provider and always use latest version 2024-12-11 18:47:30 +00:00
Svilen Markov ef24680baf Fix overlap issues in weather and dns-stats widgets 2024-12-11 18:38:09 +00:00
Svilen Markov d4b1d240b9 Fix releasing page mutex during template execution 2024-12-08 14:55:53 +00:00
Svilen Markov 448c795982 Properly close code block in docs 2024-12-07 16:47:58 +00:00
Svilen Markov 7f667e2d1c Allow using env variables in monitor and bookmarks widget URLs 2024-12-07 16:40:09 +00:00
Svilen Markov a1afdb0c63 Allow digits in env variable names 2024-12-07 16:17:09 +00:00
Svilen Markov ee1d7599d5 Add note to preconfigured pages doc 2024-12-07 09:28:36 +00:00
Svilen Markov 8adad18198 Move variable definition outside of closure 2024-12-07 09:20:01 +00:00
Svilen Markov 49a0758aae Fix trying to load incorrect thumbnail if post marked nsfw 2024-12-07 08:57:51 +00:00
Svilen Markovandvishalkadam47 e3bdc73013 Allow specifying playlist in videos widget
Co-authored-by: vishalkadam47 <vishal@jeevops.com>
2024-12-06 10:54:14 +00:00
Svilen Markov 1922e1e895 Increase RSS widget workers 2024-12-06 10:54:14 +00:00
Svilen Markov 7ee8e7c8d2 Merge pull request #242 from CremaLuca/main
feat: HEALTHCHECK in Dockerfile
2024-12-05 13:33:01 +00:00
Svilen Markov e5106c0704 Merge branch 'release/v0.7.0' into main 2024-12-05 13:32:16 +00:00
Svilen Markov 80331aa217 Also add healthcheck to the other Dockerfile 2024-12-05 13:31:25 +00:00
Svilen Markov 84537e6884 Update status icons 2024-12-04 08:19:24 +00:00
Svilen Markov f7062115bc Add support for selfhst icons 2024-12-04 08:11:18 +00:00
Svilen Markov 24f9f20eb7 Reduce list gap 2024-12-03 22:11:51 +00:00
Svilen Markov 217c6f2ed0 Remove container created time 2024-12-03 20:13:23 +00:00
Svilen Markov 82490ef5dd Merge pull request #261 from baranovskis/release/v0.7.0
Docker widget
2024-12-03 19:10:15 +00:00
Svilen Markov fcda017c39 Update docker containers widget 2024-12-03 19:04:43 +00:00
Svilen Markov 0c36925783 Fix off by 1px popover triangle 2024-12-03 16:52:28 +00:00
Svilen Markov fcb67e62c5 Change widget error header icon to SVG 2024-12-03 16:51:33 +00:00
Svilen Markov 0651a2886e Merge latest changes 2024-12-03 13:59:20 +00:00
Svilen Markov d876f4cb39 Add allow-insecure for dns-stats widget 2024-11-30 14:24:56 +00:00
Svilen Markov b5259d1a98 Rename variables & interface 2024-11-30 14:24:19 +00:00
Svilen Markov ffe053ffc5 Even more config watcher fixes 2024-11-30 12:54:19 +00:00
Svilen Markov 1785af4749 More config watcher fixes 2024-11-30 12:37:56 +00:00
Svilen Markov 98b4b7330e Further fixes for config file watcher 2024-11-30 12:23:57 +00:00
Svilen Markov f68e5ae9ef Optimize cache control header assignment in file server 2024-11-30 11:16:07 +00:00
Svilen Markov b3e73ce86a Move log outside of func 2024-11-30 10:59:58 +00:00
Svilen Markov 02cbb5f812 Fix CS 2024-11-30 10:48:33 +00:00
Svilen Markov 1d9ae72c81 Rename variables 2024-11-29 22:58:05 +00:00
Svilen Markov d6470ae814 Somewhat working fix for config watcher 2024-11-29 21:45:50 +00:00
Svilen Markov a816d1a913 Update error messages 2024-11-29 21:12:10 +00:00
Svilen Markov 2c03316f86 Update error 2024-11-29 21:06:58 +00:00
Svilen Markov d19214a390 Update error messages 2024-11-29 20:52:09 +00:00
Svilen Markov 03035d1a2d Move template vars 2024-11-29 20:45:33 +00:00
Svilen Markov 6886716e67 Add comment 2024-11-29 18:28:10 +00:00
Svilen Markov 6165308c23 Fix random overlapping issues after browser update... wtf? 2024-11-29 17:34:25 +00:00
Svilen Markov 77a9469ff8 Add console message about new config location 2024-11-29 17:11:07 +00:00
Svilen Markov 2dce9b4c48 Listen on all interfaces 2024-11-29 17:03:52 +00:00
Svilen Markov 74e05763f7 Re-add tzdata 2024-11-29 16:45:18 +00:00
Svilen Markov a4185fde07 Rename file 2024-11-29 16:41:15 +00:00
Svilen Markov ebb519e6d8 Capitalize console messages 2024-11-29 16:38:16 +00:00
Svilen Markov 90fbba600f Restructure & refactor codebase 2024-11-29 16:34:15 +00:00
Svilen Markov 4bd4921131 Merge pull request #267 from xendke/calendar-start-day
Optionally start calendar weeks on Sunday
2024-11-26 17:02:26 +00:00
Juan Xavier Gomez 44ee813c6f simplify cal weekday index 2024-11-25 15:49:28 -05:00
Juan Xavier Gomez 3e467c5021 optionally start calendar weeks on sunday 2024-11-25 13:04:52 -05:00
Svilen Markov 2b0dd3ab99 Refactor 1/2 + new stuff
* Refactor CLI
* Add config:print command
* Add diagnose command
* Allow including other files in config
* Watch for file changes and automatically restart server
2024-11-24 15:39:14 +00:00
Andrejs Baranovskis 2618346a32 Rewrote docker client to reduce dependencies ♻️ 2024-11-20 17:03:37 +01:00
Andrejs Baranovskis eacbb14279 Added docker widget with documentation 2024-11-19 17:58:55 +01:00
Andrejs Baranovskis c8570d07ef Added debugging Dockerfile 2024-11-19 17:31:42 +01:00
Svilen Markov 7e345dd1f9 Add comment 2024-11-17 10:18:11 +00:00
Svilen Markov afe6ad6bfc Don't focus new tab on middle click
This is more in line with how the browser behaves on middle click
2024-11-17 10:06:54 +00:00
Svilen Markov af4c1e8514 Prevent default on middle click 2024-11-17 09:57:46 +00:00
Svilen Markov d4fecd1dd8 Fix middle mouse click 2024-11-17 09:49:56 +00:00
Svilen Markov 79779eb721 Restore title-url functionality on group titles 2024-11-17 09:36:46 +00:00
Svilen Markov 6af666b58c Reduce margin 2024-11-16 15:00:05 +00:00
Svilen Markov 42872136a0 Reduce gap 2024-11-16 11:52:09 +00:00
Svilen Markov aca7b2ac5f Reduce status icon size 2024-11-16 11:45:23 +00:00
Svilen Markov a646f19b3f Make monitor widget compact style title size dynamic 2024-11-16 11:25:29 +00:00
Svilen Markov 9c5298aebf Add compact style for monitor widget 2024-11-16 11:10:46 +00:00
Svilen Markov c6b07852fe Clear search input on submission 2024-11-16 08:29:58 +00:00
Svilen Markov 40d3053df9 Merge pull request #249 from ralphocdol/default-expand-mobile-navigation
Default expand mobile navigation
2024-11-16 07:21:25 +00:00
Svilen Markov 5e576a58e9 Merge branch 'release/v0.7.0' into default-expand-mobile-navigation 2024-11-16 07:20:49 +00:00
Svilen Markov 4d63b5dda1 Update docs 2024-11-16 07:17:06 +00:00
Svilen Markov c1efd3f68b Fix formatting 2024-11-16 07:15:26 +00:00
Svilen Markov 2841cc67e8 Merge pull request #255 from 2q2code/main
Add Dashboard Icons support
2024-11-16 07:00:00 +00:00
Svilen Markov becf34b0d9 Merge branch 'release/v0.7.0' into main 2024-11-16 06:49:11 +00:00
Svilen Markov 1bba915aef Update docs 2024-11-16 06:37:09 +00:00
Svilen Markov f7239137d6 Update icons implementation to use custom type 2024-11-16 06:37:05 +00:00
Doc Em d656986413 Add DashboardIcon (PNG) Support
- Refactored to make better naming sense
- Added capability to select between the PNG and SVG offerings of DashboardIcons
2024-11-14 20:06:54 +11:00
2Q2C0DE d0c4e9d846 Add Dashboard Icons prefix support
- defined new type IconSource and constants, presently supporting:
  - LocalFile
  - SimpleIcon
  - DashboardIcon
- added new field to bookmarks and monitors to hold IconSource
- adjusted IsSimpleIcon to get truthiness from IconSource field
- generalised `toSimpleIconIfPrefixed` into `toRemoteResourceIconIfPrefixed`,
  adding support for `walkxcode`'s dashboard icons via CDN (svg)
2024-11-14 18:30:41 +11:00
Svilen Markov bacb607d90 Allow using env variables in custom API URL 2024-11-03 04:46:24 +00:00
Svilen Markov 3914e24b3d Update twitch channel stream preview popover 2024-11-01 22:57:34 +00:00
Svilen Markov 4582be1da5 Allow changing horizontal offset of popover 2024-11-01 22:57:06 +00:00
Svilen Markov c3c7f8b14f Allow changing max columns on split columns widget 2024-10-31 18:23:56 +00:00
Svilen Markov 863d4f117b Merge pull request #251 from ehaughee/market-name-hovertext
Add title prop to Market Name for full text of truncated names on hover
2024-10-30 23:57:11 +00:00
Eric Haughee 35038ed56b Add title prop to Market Name for full text of truncated names on hover 2024-10-30 15:25:19 -07:00
Svilen Markov c4149f5d94 Merge pull request #248 from oliver-mitchell/fix-non-whole-hour-timezone-display-on-clock
fix: non-whole-hour timezones now correctly shown on Clock widget
2024-10-30 15:48:24 +00:00
Svilen Markov de2db71e54 Simplify clock zone diff text and add title for more details 2024-10-30 15:30:34 +00:00
Svilen Markov 2e3ed896cc Give clock time min width to avoid inconsistent layout for 12 hour format 2024-10-30 15:25:30 +00:00
Ralph Ocdol f6f352e9e0 fix: indention 2024-10-29 18:15:28 +08:00
Ralph Ocdol 33dede8abc feat: added auto expand mobile page navigation 2024-10-29 18:13:24 +08:00
Oliver Mitchell 1e2e66ecf7 fix: non-whole-hour timezones now correctly shown on Clock
Timezones that used non-whole-hour definitions (ie. Australia/ACDT) not correctly shown on the Clock widget. This fix changes how the difference is calculated to account for both minutes, and hours.

Due to the change, the text shown for relative timezone differences also had to be changed.
2024-10-29 00:00:37 +10:30
Svilen Markov 6e5140d859 Allow specifying headers in RSS feeds 2024-10-21 23:49:09 +01:00
Svilen Markov 84a7f90129 Add custom API widget 2024-10-21 23:27:25 +01:00
Luca Crema aff02c2def Added HEALTHCHECK to Dockerfile 2024-10-18 14:07:24 +02:00
Svilen Markov 2dd5b29303 Remove unused class 2024-10-18 11:10:00 +01:00
Svilen Markov bc8f17393a Fix simple icons URL 2024-10-18 10:54:34 +01:00
Svilen Markov 72f78f1c8d Merge pull request #240 from cmeadowstech/alt-status-codes
Add alternative status code option to monitor widget
2024-10-18 10:53:18 +01:00
Svilen Markov 201b4ca1e8 Use AltStatusCodes for HasFailing check 2024-10-18 10:51:46 +01:00
Cody Meadows 04811a0658 Merge remote-tracking branch 'upstream/release/v0.7.0' into alt-status-codes
Update to current release
2024-10-17 22:01:56 +00:00
Cody Meadows ee94d6aa89 Add alternative status code prameter 2024-10-17 21:58:18 +00:00
Svilen Markov 3382cd6208 Show twitch stream preview and title on avatar hover 2024-10-17 21:53:07 +01:00
Svilen Markov 56f9ec1d10 Include title in twitch channel data 2024-10-17 21:37:32 +01:00
Svilen Markov 1b42312d02 Fix edge case in popover 2024-10-17 21:36:41 +01:00
Svilen Markov 8a41a9f506 Improve formatting of request body 2024-10-17 21:36:22 +01:00
Svilen Markov 18bb2d7501 Change simple icons provider 2024-10-16 10:58:09 +01:00
Svilen Markov 6f8e576c9b Add fallback-content-type property 2024-10-16 10:52:57 +01:00
Svilen Markov e5bb102ab1 Add split-column widget 2024-10-15 18:05:29 +01:00
Svilen Markov 13700fe2b2 Change masonry options source 2024-10-15 16:04:22 +01:00
Svilen Markov 3cfbe65855 Make the first full column the primary on mobile rather than the last 2024-10-15 15:58:30 +01:00
Svilen Markov ab0b11cc92 Add masonry layout functionality 2024-10-13 18:33:26 +01:00
Svilen Markov 17c8071de9 Extract group widget functionality into generic widget container 2024-10-13 18:30:47 +01:00
Svilen Markov 1fe7f61ec8 Change environment variables behavior
* Can now be inserted anywhere in the string
* Can now insert multiple environment variables in a single string
* Can now be escaped if prefixed with \
2024-10-13 17:12:59 +01:00
Svilen Markov ea3b8124fc Remove unused class 2024-10-13 17:08:52 +01:00
Svilen Markov c41cfadb19 Merge pull request #231 from ehaughee/markets-sort-by-change
Add Markets sort-by: change to sort by percent change
2024-10-04 11:09:59 +01:00
Eric Haughee e434fe0847 Add Markets sort-by: change to sort by percent change 2024-10-03 11:26:33 -07:00
Svilen Markov 8a8aaa752e Fix edge case in weather widget
If the temperature for the entire day is the same the range is 0, divide by 0 no bueno
2024-10-02 10:40:25 +01:00
Svilen Markov 4420d1df2c Bump versions & update dependencies 2024-10-01 15:47:56 +01:00
Svilen Markov d90d39933a Merge pull request #228 from Dakhtara/patch-1
Fix typo on configuration for search autofocus property description
2024-10-01 15:28:42 +01:00
Anthony 7e38ab624a Update configuration.md 2024-10-01 08:59:11 +02:00
Svilen Markov 9a36187333 Add /api/healthz endpoint
Create release / release (push) Has been cancelled
2024-09-30 00:42:19 +01:00
Svilen Markov b0c4d70628 Fix bug with collapsible grids inside of group widget
Also move utils to new file
2024-09-30 00:42:19 +01:00
Svilen Markov d5fa6424c1 Fix bookmark icons shrinking when text wraps 2024-09-30 00:42:19 +01:00
Svilen Markov 07fe5b3cb1 Merge pull request #224 from SimJunYou/piholePrivacy
DNS Stats widget - fix Pihole privacy edge case
2024-09-30 00:31:00 +01:00
Svilen Markov 672547cd07 Switch to using custom type for pihole's top blocked domains 2024-09-30 00:24:44 +01:00
SimJunYou 28167403a4 Cover edge case when Pihole's privacy settings are enabled 2024-09-19 17:43:43 +08:00
Svilen Markov eaf08d42dd Merge pull request #220 from paricbat/main
Add important details about the server.base-url property
2024-09-16 08:35:33 +01:00
Veronika Bušová bae95a5e07 Add important details about the server.base-url property 2024-09-15 00:29:46 +02:00
Svilen Markov db1ed9e257 Fix & refactor adguard stats
Create release / release (push) Has been cancelled
2024-09-10 05:38:14 +01:00
Svilen Markov adef35049f Add warning when pihole doesn't return expected data points 2024-09-10 05:38:14 +01:00
Svilen Markov bd9abf2e52 Fix mobile nav links wrapping 2024-09-10 05:38:14 +01:00
Svilen Markov aa74c00fd4 Merge pull request #210 from micash545/main
releases: Add support for Codeberg
2024-09-08 19:36:20 +01:00
Svilen Markov a68a907fa7 Update SVG 2024-09-08 19:35:01 +01:00
Svilen Markov 1a05d6d03a Don't export function 2024-09-08 19:34:43 +01:00
micash 60f4183057 add codeberg releases 2024-09-08 16:59:24 +02:00
Svilen Markov 04c3afc850 Document center-vertically property 2024-09-08 06:25:06 +01:00
Svilen Markov 066e512844 Merge pull request #206 from glanceapp/release/v0.6.0
Create release / release (push) Has been cancelled
Release/v0.6.0
2024-09-08 04:18:11 +01:00
Svilen Markov d60457afaf Merge branch 'main' into release/v0.6.0 2024-09-08 04:17:23 +01:00
Svilen Markov f5a788220e Add link to Discord server 2024-09-08 01:13:26 +01:00
Svilen Markov 2fd5edc6e4 Update CSS 2024-09-08 00:43:26 +01:00
Svilen Markov 26716d0b89 Add preconfigured pages 2024-09-08 00:39:48 +01:00
Svilen Markov 3e0f57d0c7 Update README images 2024-09-07 23:13:15 +01:00
Svilen Markov 5347717f3d Ignore all yml files starting with glance 2024-09-07 23:12:12 +01:00
Svilen Markov 6b0a569998 Limit width of widgets 2024-09-06 21:45:03 +01:00
Svilen Markov 4476391287 Fix missing class 2024-09-06 20:33:04 +01:00
Svilen Markov 16a9d8c244 Update group widget styling 2024-09-06 20:32:20 +01:00
Svilen Markov bbda9a0ee8 Add single-line-titles property to RSS widget 2024-09-04 23:02:16 +01:00
Svilen Markov 776fdcc6ce Merge branch 'release/v0.6.0' into features 2024-09-03 00:26:33 +01:00
Svilen Markov f76e06ec57 Fix videos widget channel URL 2024-09-01 02:27:09 +01:00
Svilen Markov 3a9cff697b Add and fix monitor widget class 2024-08-31 18:51:59 +01:00
Svilen Markov e6979c77e3 Update dynamic columns & remove the need to specify style 2024-08-31 18:37:08 +01:00
Svilen Markov 99866507f5 Fix overflowing text in monitor widget 2024-08-31 17:35:53 +01:00
Svilen Markov cf0dd07c21 Add center-vertically property 2024-08-31 17:35:38 +01:00
Svilen Markov b9bf8c6c96 Fix version formatting in releases widget 2024-08-30 16:19:20 +01:00
Svilen Markov 725d0da15d Add show-failing-only property to the monitor widget 2024-08-29 21:14:50 +01:00
Svilen Markov 37164070d2 Merge branch 'release/v0.6.0' into features 2024-08-29 20:06:40 +01:00
Svilen Markov d7bd34531f Merge pull request #77 from aharivel/github-commit
Add last Github commits
2024-08-29 18:19:19 +01:00
Svilen Markov 71ca1753ef Update repository widget last commits 2024-08-29 18:18:38 +01:00
Svilen Markov c6bfbf4ac1 Merge branch 'release/v0.6.0' into github-commit 2024-08-29 17:40:14 +01:00
Svilen Markov a27fde72ee Fix group widget 2024-08-27 21:41:18 +01:00
Svilen Markov 785f6a36bf Increase assets cache time 2024-08-27 17:29:31 +01:00
Svilen Markov 1a4c12d851 Fix hardcoded release icons 2024-08-27 17:17:41 +01:00
Svilen Markov b484e32b08 Improve dockerhub releases 2024-08-27 05:19:35 +01:00
Svilen Markov 303438834b Merge pull request #165 from Fumesover/release/v0.6.0
releases: Add support for gitlab
2024-08-27 03:37:45 +01:00
Svilen Markov 70b7b7615a Fix capitalization 2024-08-27 03:36:36 +01:00
Svilen Markov 5c42e60faf Update docs 2024-08-27 03:35:35 +01:00
Svilen Markov 48ef60e0eb Add todo 2024-08-27 03:33:37 +01:00
Svilen Markov 01af97ddab Allow fetching releases from multiple sources 2024-08-27 03:26:16 +01:00
Svilen Markov 038794fa1c Merge pull request #75 from realdavidops/main
Allow some branding customization.
2024-08-27 00:18:04 +01:00
Svilen Markov ffb1bccb10 Move default logo text to the template 2024-08-27 00:15:55 +01:00
Svilen Markov 371eb3bee6 Change styling of custom logo 2024-08-27 00:14:31 +01:00
Svilen Markov 466d935d02 Update docs 2024-08-27 00:09:35 +01:00
Svilen Markov 7ffca9c3f1 Allow setting custom footer 2024-08-27 00:09:26 +01:00
Svilen Markov a5981b3106 Fix RSS thumbnails where feed image is absolute 2024-08-26 23:50:37 +01:00
Svilen Markov 1df080983a Add DNS Stats widget 2024-08-22 23:11:45 +01:00
Svilen Markov 822b72eee4 Delay showing next popover by 2 frames
This resets the CSS animation so it can be played again, otherwise it gets skipped
2024-08-22 22:44:27 +01:00
Svilen Markov 014abdcc00 Allow setting text-align on popovers 2024-08-22 22:43:41 +01:00
Svilen Markov b35cc437d3 Remove unused functions 2024-08-22 22:43:10 +01:00
Svilen Markov 7ce87c7168 Merge pull request #197 from ccjjxl/bugfix_rss
Fix RSS item link empty <link/>
2024-08-22 11:16:33 +01:00
ccjjxl 2a3f8eedf6 Fix RSS item link empty <link/> 2024-08-22 17:24:00 +08:00
Svilen Markov 895c3f2f97 Allow changing popover anchor 2024-08-20 16:19:21 +01:00
Svilen Markov 8860f4591b Allow showing popover above & tweaks 2024-08-20 13:29:44 +01:00
Svilen Markov 984f26807e Remove duplicate rule & add non-prefixed line-clamp 2024-08-19 14:24:05 +01:00
Svilen Markov 88c58e6108 Add <details> styling 2024-08-19 14:03:48 +01:00
Svilen Markov 83c7c4a14a Add popover functionality 2024-08-19 02:15:22 +01:00
Svilen Markov b4a4df480e Add utility classes 2024-08-18 18:26:56 +01:00
Svilen Markov 9843b4d218 Fix armv7 docker image 2024-08-15 13:33:42 +01:00
Svilen Markov c1251af597 Tidy up 2024-08-11 14:13:00 +01:00
Svilen Markov 7d09b8bf1b Fix reddit crossposts & add show-flairs property 2024-08-11 14:04:18 +01:00
Svilen Markov f57bdeec12 Update branding config 2024-08-10 19:43:50 +01:00
Svilen Markov 9899f6b761 Merge branch 'release/v0.6.0' into main 2024-08-10 18:47:39 +01:00
Svilen Markov 328e10b89f Don't show error if RSS feeds didn't return any items 2024-08-10 18:01:54 +01:00
Svilen Markov b37f8a8375 Merge pull request #194 from glanceapp/backport-fixes
Create release / release (push) Has been cancelled
Backport fixes from v0.6.0 to v0.5.0
2024-08-09 16:08:30 +01:00
Svilen Markov 139937f887 Fix missing RSS thumbnail images 2024-08-09 16:03:24 +01:00
Wyatt Gill b8b90451b6 Use GitHub's latest release API endpoint
The current releases widget uses the releases endpoint to pull the 10
most recent releases and filter them to find the latest release. This
causes a problem when a repository's latest release is outside of the 10
most recent (e.g. 10 prereleases):

ERROR No live release found repository=cross-seed/cross-seed url="https://api.github.com/repos/cross-seed/cross-seed/releases?per_page=10"

This is no longer a problem when using the latest release endpoint which
grabs the latest release, ignoring draft releases and prereleases.
2024-08-09 16:02:15 +01:00
Svilen Markov c9a2aff6a6 Fix search input color 2024-08-09 16:01:15 +01:00
Svilen Markov b25b117717 Reduce mb on widget header 2024-08-09 11:25:11 +01:00
Svilen Markov e174fd731c Fix size-title-dynamic class 2024-08-08 16:55:46 +01:00
Svilen Markov 34e6d463be Make forum post title size dynamic 2024-08-08 16:37:41 +01:00
Svilen Markov 808169f43c Make horizontal scrollbars thinner 2024-08-08 16:00:41 +01:00
Svilen Markov 82b6531a07 Add funding 2024-08-07 19:18:17 +01:00
Svilen Markov 917e2cabfc Merge branch 'main' into release/v0.6.0
Create release / release (push) Has been cancelled
2024-08-07 19:03:12 +01:00
Svilen Markov a981025679 Merge pull request #108 from wfg/github-actions
Create release workflow
2024-08-07 18:58:13 +01:00
Svilen Markov f9ea2d73e1 Tidy up previous build files 2024-08-07 18:50:06 +01:00
Svilen Markov a5728e9407 Update release workflow 2024-08-07 18:47:50 +01:00
Svilen Markov 404a2acc8f Remove extra margin from mobile nav offset 2024-08-07 11:16:30 +01:00
Svilen Markov 7bf61ee8ed Remove app name from title 2024-08-07 04:05:10 +01:00
Svilen Markov bf1cc47525 Fix & increase offset of loading indicator 2024-08-05 23:16:32 +01:00
Svilen Markov 74ad27d5fb Rejig CSS 2024-08-05 22:50:44 +01:00
Svilen Markov 60b73aff24 Merge pull request #167 from CremaLuca/main
feat: serving behind reverse proxy
2024-08-05 14:12:20 +01:00
Svilen Markov 4de465e544 Add some foolproofery 2024-08-05 14:11:19 +01:00
Svilen Markov e1161b9227 Refactor base-url & add documentation 2024-08-05 14:08:16 +01:00
Svilen Markov c2cdd0fa08 Merge branch 'release/v0.6.0' into main 2024-08-05 13:26:46 +01:00
Svilen Markov b365a03e71 Allow hiding desktop navigation 2024-08-05 12:42:41 +01:00
Svilen Markov 2e629efc7f Remove link from footer 2024-08-05 12:28:08 +01:00
Svilen Markov fcaa2bef6e Vertically center loading indicator 2024-08-05 12:15:55 +01:00
Svilen Markov 3b2a9fedef Move footer to bottom of viewport 2024-08-05 12:00:20 +01:00
Svilen Markov 64256f2638 Fix value 2024-08-05 11:40:32 +01:00
Svilen Markov 5c8122d93b Fix extra margin at bottom of page 2024-08-05 11:17:46 +01:00
Svilen Markov 6ffb95779d Don't force scrollbar when not needed 2024-08-05 11:12:25 +01:00
Svilen Markov af975d0e7f Bump versions 2024-08-05 00:00:11 +01:00
Svilen Markov 34b2b88cf3 Merge branch 'main' into release/v0.6.0 2024-08-04 23:46:28 +01:00
Svilen Markov 3fea166274 Add page width customizability 2024-08-04 23:40:58 +01:00
Svilen Markov 233b905492 Merge pull request #177 from MrExplode/monitor-urls
Different monitor urls
2024-08-04 20:55:02 +01:00
Svilen Markov 7afad765cb Use hyphen instead of underscore 2024-08-04 20:54:30 +01:00
MrExplode 39663cb594 Document monitor URL changes 2024-08-03 14:14:42 +02:00
MrExplode 457e0539fa Allow empty check URL 2024-08-03 14:14:24 +02:00
MrExplode 871ba619a3 Add separate URL for monitor check 2024-08-03 14:06:52 +02:00
Svilen Markov f5427310e8 Document include-shorts 2024-08-03 04:25:07 +01:00
Svilen Markov e4435252f4 Merge pull request #176 from 3rd/release/v0.6.0
feat: add no_shorts option for YouTube feeds
2024-08-03 04:05:56 +01:00
Svilen Markov a66aa74c7f Invert property 2024-08-03 04:04:02 +01:00
Svilen Markov 3949e15f77 Remove previous scuffed attempt at filtering shorts 2024-08-03 04:03:16 +01:00
Svilen Markov acaf50bf8a Use author > name instead of title
This is because the playlist response returns the name of the playlist in the title,
which meant that the channel name was always "Videos"
2024-08-03 04:02:23 +01:00
3rd 09eedc08c1 feat: add no_shorts option for YouTube feeds 2024-08-02 23:39:27 +03:00
Svilen Markov 738bcf8bcb Add group widget 2024-08-01 21:34:07 +01:00
Svilen Markov 795caa5d9d Allow widgets to handle HTTP requests 2024-08-01 18:26:38 +01:00
Svilen Markov c041197f3f Merge pull request #173 from DVDAndroid/dvd/assets-fixes
Fix crash when using a custom CSS file; fix error 404 for manifest.json
2024-07-26 16:30:55 +01:00
dvdandroid 0730789cb3 Fix crash when using a custom CSS file; fix error 404 for manifest.json 2024-07-25 16:57:10 +02:00
Svilen Markov 1eb0fbd2c9 Merge pull request #171 from DVDAndroid/dvd/twich-nocategory-fix
Fix incorrect LiveSince if API returned no game
2024-07-25 00:42:59 +01:00
Svilen Markov 0484122b7f Merge pull request #172 from DVDAndroid/dvd/clickable-twitch-avatar
Make Twitch avatar clickable
2024-07-25 00:42:46 +01:00
dvdandroid 7bc9c704d1 Don't render "empty" game category 2024-07-24 21:50:00 +02:00
dvdandroid c9efdc2c16 Fix incorrect LiveSince if API returned no game
(streamer can stream without a category/game associated)
2024-07-24 21:38:35 +02:00
dvdandroid e0dee998d4 Make Twitch avatar clickable 2024-07-23 23:17:28 +02:00
Svilen Markov e09ea60616 Update dependencies 2024-07-15 21:59:51 +01:00
Svilen Markov 7cab07fa01 Bump alpine version 2024-07-15 21:59:51 +01:00
Svilen Markov 5a62a8afe9 Add autofocus property to search widget 2024-07-15 21:59:51 +01:00
CremaLuca 23d6d41148 fix(serve): using paths without base url 2024-07-10 15:40:35 +02:00
Luca Crema a07fbfd7b7 Added baseurl somewhere 2024-07-10 15:35:25 +02:00
Svilen Markov 1411268e35 Merge pull request #80 from c0smicdev/main
Add Kanagawa Dark theme
2024-07-03 19:51:42 +01:00
Svilen Markov 9bda88edbd Merge pull request #145 from ssrtw/rss-feed-enhance
Rss feed enhance
2024-07-03 19:49:32 +01:00
Svilen Markov 16da25898f Prevent users from modifying internal property 2024-07-03 19:48:58 +01:00
Svilen Markov 88ae2b8e83 Merge pull request #164 from dracarys18/main
fix: allow custom bangs without an argument
2024-07-03 19:26:54 +01:00
Albin Parou 7d1ede8c91 releases: Add support for gitlab 2024-07-03 08:20:02 +02:00
dracarys18 3805f8b156 fix: allow custom bangs without an argument 2024-07-03 02:46:16 +05:30
Svilen Markov 39f40670d0 Fix missing RSS thumbnail images 2024-06-29 17:17:27 +01:00
Svilen Markov 514cf2b81c Allow setting widget title URL 2024-06-29 16:10:43 +01:00
Svilen Markov 4dbb5975c0 Allow setting custom CSS classes for individual widgets 2024-06-29 15:55:17 +01:00
Svilen Markov b327e59ab1 Allow specifying a custom lobsters URL or instance 2024-06-29 15:43:07 +01:00
Svilen Markov 917d51e54b Make script a module 2024-06-29 15:20:26 +01:00
Svilen Markov 122d05346b Change caching mechanism 2024-06-29 15:20:26 +01:00
c0smic 645802981e Update theme preview 2024-06-14 16:56:33 +00:00
c0smic 0348a2475c Delete preview of old version 2024-06-14 16:55:44 +00:00
ssrtw a2b7f59dc9 fix: correct title handling for RSS items without titles 2024-06-13 03:13:57 +00:00
ssrtw c23dc93c7a feat: use description as fallback for RSS items without titles 2024-06-12 15:36:29 +00:00
ssrtw d3e3667405 fix: add detailed mode flag to fix RSS logic conflict 2024-06-12 03:28:43 +00:00
Svilen Markov d4ed5afe93 Merge pull request #134 from wfg/github-latest-release-fix
Use GitHub's latest release API endpoint
2024-06-11 20:43:35 +01:00
Svilen Markov 790ecef1c1 Merge pull request #137 from ralphocdol/search-new-tab-property
feat: added property new-tab to type: search
2024-06-11 20:34:05 +01:00
Svilen Markov edb59ffdc6 Small change to implementation for new tab 2024-06-11 20:30:10 +01:00
Svilen Markov e137038586 Fix overflowing text 2024-06-11 01:16:39 +01:00
Svilen Markov 761eb343f9 Fix search input color 2024-06-11 00:35:26 +01:00
Svilen Markov 6c15c907bf Remove clock from preconfigured page 2024-06-11 00:17:25 +01:00
ralphocdol 06b21e3d27 feat: added property new-tab to type: search 2024-06-09 21:18:56 +08:00
Wyatt Gill 263d2e6f30 Use GitHub's latest release API endpoint
The current releases widget uses the releases endpoint to pull the 10
most recent releases and filter them to find the latest release. This
causes a problem when a repository's latest release is outside of the 10
most recent (e.g. 10 prereleases):

ERROR No live release found repository=cross-seed/cross-seed url="https://api.github.com/repos/cross-seed/cross-seed/releases?per_page=10"

This is no longer a problem when using the latest release endpoint which
grabs the latest release, ignoring draft releases and prereleases.
2024-06-07 16:27:13 -05:00
Svilen Markov c97fec66f4 Update dependencies 2024-06-04 23:42:40 +01:00
Wyatt Gill d5cf881d7a Produce example 2024-06-03 16:16:43 -05:00
Wyatt Gill 050d3e6cd2 Add release workflow using GoReleaser 2024-06-03 16:16:43 -05:00
Svilen Markov 757f68c872 Increase lobsters widget cache time 2024-06-03 00:46:26 +01:00
Svilen Markov b83bf9bc09 Merge pull request #121 from glanceapp/release/v0.5.0
Release v0.5.0
2024-06-02 20:17:50 +01:00
Svilen Markov 8d96e883d6 Update readme 2024-06-02 20:14:35 +01:00
Svilen Markov 75079a981b Add HTML widget 2024-06-02 19:01:20 +01:00
Svilen Markov e8043be107 Add lobsters widget preview 2024-06-02 18:44:27 +01:00
Svilen Markov c276f66017 Add tags to forum posts template 2024-06-02 18:44:17 +01:00
Svilen Markov db7df33b27 Bump versions 2024-06-02 18:24:54 +01:00
Svilen Markov 1b8e355944 Document extension widget 2024-06-02 18:24:54 +01:00
Svilen Markov 342ef90cbe Add extension widget 2024-06-02 18:21:03 +01:00
Svilen Markov b3be60acf6 Document collapse-after-rows property 2024-06-02 18:21:03 +01:00
Svilen Markov b58d3e2849 Document change detection widget 2024-06-02 18:21:03 +01:00
Svilen Markov 4206fb943d Document simple icons usage for monitor icons 2024-06-02 18:21:03 +01:00
Svilen Markov ee58ff40f1 Document allow-insecure property 2024-06-02 18:21:02 +01:00
Svilen Markov 21fd842bde Refactor monitor: allow insecure requests & use of simple icons 2024-06-02 18:21:02 +01:00
Svilen Markov b63b5eb262 Make converting string to simple icon url reusable 2024-06-02 18:21:02 +01:00
Svilen Markov 9c69509a19 Fix markets class 2024-06-02 18:21:02 +01:00
Svilen Markov 511147fb90 Document detailed-list RSS style 2024-06-02 18:21:02 +01:00
Svilen Markov 9ce0030482 Don't offset attachments 2024-06-02 18:21:02 +01:00
Svilen Markov 4164263639 Fix RSS item links without base domain 2024-06-02 18:21:02 +01:00
Svilen Markov 1bebb88d0e Rename Stocks to Markets
Also fix bug that would remove markets if a network request failed
and not show them again until Glance was restarted
2024-06-02 18:21:02 +01:00
Svilen Markov d2f5dbbc26 Fix weather widget making HTTP request as part of validation
Which would prevent app startup if there was no internet connection
2024-06-02 18:21:02 +01:00
Svilen Markov 2af6500028 Add utility class 2024-06-02 18:21:02 +01:00
Svilen Markov a7cf8be8c4 Lower gap between timezones 2024-06-02 18:21:02 +01:00
Svilen Markov 69b3e544bd Fix layout shift on image load 2024-06-02 18:21:02 +01:00
Svilen Markov 0c63c61db5 Position category details to top when tags missing 2024-06-02 18:21:02 +01:00
Svilen Markov 8dc34ddfa7 Merge pull request #56 from jonasknobloch/lobsters-widget
Add Lobsters widget
2024-06-02 18:20:36 +01:00
Svilen Markov 8efda0047c Merge branch 'release/v0.5.0' into lobsters-widget 2024-06-02 18:20:07 +01:00
Svilen Markov e3c17e0347 Merge branch 'main' into lobsters-widget 2024-06-02 18:19:06 +01:00
Svilen Markov 038c43bc09 Document lobsters widget 2024-06-02 18:17:20 +01:00
Svilen Markov 720549ec7e Allow specifying sort order and tags through config 2024-06-02 18:08:29 +01:00
Svilen Markov 3aa1f273b6 Add tags to dedicated field rather than to title 2024-06-02 17:51:49 +01:00
Svilen Markov 5105ebb870 Don't parse unused fields 2024-06-02 17:51:07 +01:00
Svilen Markov 0a55c12f4f Add tags to forum posts 2024-06-02 17:50:46 +01:00
Svilen Markov 67c20c3a5f Merge pull request #46 from knhash/change-detection
feat: add change detection module
2024-05-30 22:55:22 +01:00
Svilen Markov f4f7892123 Merge branch 'release/v0.5.0' into change-detection 2024-05-30 22:55:01 +01:00
Svilen Markov 00a93e466d Update change detection 2024-05-30 22:53:59 +01:00
c0smic d27993d2c9 fix: use negative color with higher contrast 2024-05-29 16:53:31 +00:00
c0smic bfc65d51e3 Merge branch 'glanceapp:main' into main 2024-05-29 16:50:18 +00:00
c0smicandSvilen Markov 3c29d38599 fix: Fix typo
Co-authored-by: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com>
2024-05-27 18:11:35 +00:00
Svilen Markov f8816ff227 Merge pull request #89 from NoxesP/patch-1
docs: update configuration.md
2024-05-25 04:23:06 +01:00
Svilen Markov a5be460c2e Merge pull request #69 from chand1012/search
Add Search Bar Widget
2024-05-25 04:00:20 +01:00
Svilen Markov e1e7853c34 Update search widget 2024-05-25 03:58:11 +01:00
Svilen Markov 3f862f67ab Merge branch 'release/v0.5.0' into search 2024-05-25 02:51:32 +01:00
Svilen Markov 4bb5b2641b Further attempts at making the rain look less scuffed 2024-05-25 02:38:49 +01:00
Svilen Markov f044fdf5dc Add utility classes 2024-05-25 02:38:49 +01:00
Svilen Markov d1be4637ad Fix registering resize event on wrong object 2024-05-25 02:38:49 +01:00
Svilen Markov d18f645c18 Add detailed-list style for RSS 2024-05-25 02:38:49 +01:00
Svilen Markov 6663360caa Don't add classes that are no longer needed 2024-05-25 02:38:48 +01:00
Svilen Markov c2d24ee4d9 Set background color in manifest 2024-05-25 02:38:48 +01:00
Svilen Markov 37471fcdc1 Remove extra new line 2024-05-25 02:38:48 +01:00
Svilen Markov 0f42567d98 Merge pull request #82 from yardenshoham/add-clock-widget
Add a clock widget
2024-05-25 02:32:18 +01:00
Svilen Markov 8148f09b9c Add more features to clock 2024-05-25 02:28:45 +01:00
NoxesP c270afb5e5 docs: update configuration.md
Won't admit how long it took for me to notice this in my glance.yml file after wondering why it wasn't working ahahah.

Small fix :)
2024-05-20 04:47:57 +03:00
Svilen Markov 6de0f73ec1 Fix build breaking because of missing build dir 2024-05-19 21:33:51 +01:00
Svilen Markov a80a34afb1 Merge pull request #83 from wfg/image-build-rework
Image build rework
2024-05-19 18:06:03 +01:00
Svilen Markov 584f813fc4 Merge pull request #87 from hex-developer/main
Fix column overflow
2024-05-19 18:01:21 +01:00
Svilen Markov a44056dc43 Remove other unnecessary shrinks 2024-05-19 18:00:08 +01:00
Svilen Markov c941c78ebf Truncate RSS channel name 2024-05-19 17:52:17 +01:00
Svilen Markov 9e9f001fdf Add newline at end of file 2024-05-19 17:51:59 +01:00
Svilen Markov 9060887694 Remove unnecessary shrink 2024-05-19 17:51:40 +01:00
Svilen Markov 6d9ea27e9f Merge branch 'release/v0.5.0' into main 2024-05-19 17:48:14 +01:00
Svilen Markov 4f4973157c Merge branch 'main' into release/v0.5.0 2024-05-19 17:46:21 +01:00
hex-developer 859a6d2f27 Fix column overflow 2024-05-19 15:52:13 +00:00
Wyatt Gill e3ad646bae Add .dockerignore to keep build context small 2024-05-18 17:42:02 -05:00
Wyatt Gill 53a661861a Build app in Dockerfile
This change makes it simpler and more convenient to build the app.
2024-05-18 17:41:21 -05:00
Yarden Shoham 4a27ec3271 Add a clock widget
It's a simple clock that shows the current time

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-05-18 22:40:33 +03:00
Svilen Markov 926de71274 Add PR template 2024-05-18 19:49:26 +01:00
Svilen Markov b0e57bae9f Merge pull request #81 from yardenshoham/correct-method-in-docs
Specify the correct method in the Monitor widget documentation
2024-05-18 19:19:14 +01:00
Svilen Markov 0bbb4573b2 Revert setTimeout for images
Reduces instances of cached images fading in by giving
the browser a bit more time to load them
2024-05-18 18:52:54 +01:00
Svilen Markov eeda28a287 Reduce reliance on setTimeout shenanigans 2024-05-18 18:43:11 +01:00
Yarden Shoham 59c55b96be Specify the correct method in the Monitor widget documentation
After 189b8895b0 we use `GET` instead of `HEAD`

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-05-18 18:02:12 +03:00
c0smic 060609e2cb Add Kanagawa Dark to themes 2024-05-18 14:25:08 +00:00
c0smic a1c48bf012 Use new Kanagawa Dark Image 2024-05-18 14:24:15 +00:00
c0smic a67fb66d2e Delete old Kanagawa Dark image 2024-05-18 14:23:32 +00:00
c0smic 3001f4845a Add new Kanagawa Dark image 2024-05-18 14:20:17 +00:00
c0smic 192c1ad669 Rename kanagawa dark preview image 2024-05-18 14:15:35 +00:00
c0smic 89ae8a3607 Add Kanagawa Dark Theme preview 2024-05-18 14:13:56 +00:00
Anthony Harivel 90d718c186 Add last Github commits
Signed-off-by: Anthony Harivel <aharivel@redhat.com>
2024-05-18 11:51:44 +02:00
David Leonard 3cfbe0c89b Allow some branding customization. 2024-05-17 14:37:05 -07:00
chand1012 8392b7a606 Fix some styling issues and query bug 2024-05-17 10:18:58 -04:00
chand1012 0f01a8eda5 Add search box 2024-05-15 20:04:08 -04:00
Shashank S 6cad5a8efb Merge remote-tracking branch 'origin' into change-detection 2024-05-13 03:32:52 +02:00
Jonas Knobloch c07a1ab636 Update default feed 2024-05-12 17:37:04 +02:00
Jonas Knobloch eb9f92f04a Update tag delimiter 2024-05-12 17:14:40 +02:00
Jonas Knobloch c05607934b Fetch posts via JSON endpoint 2024-05-12 17:14:04 +02:00
Jonas Knobloch 344f518991 Add Lobsters widget 2024-05-12 13:20:34 +02:00
Shashank S aa04904a72 feat: add diff, fix: configurable url 2024-05-09 08:32:27 +02:00
Shashank S 7adf624e95 feat: add change detection module 2024-05-08 11:47:25 +02:00
243 changed files with 18851 additions and 5437 deletions
+11
View File
@@ -0,0 +1,11 @@
# https://docs.docker.com/build/building/context/#dockerignore-files
# Ignore all files by default
*
# Only add necessary files to the Docker build context (Dockerfiles are always included implicitly)
!/build/
!/internal/
!/pkg/
!/go.mod
!/go.sum
!main.go
+1
View File
@@ -0,0 +1 @@
github: [glanceapp]
+37
View File
@@ -0,0 +1,37 @@
name: Bug report
description: Let us know if something isn't working as expected
labels: ["bug report"]
body:
- type: markdown
attributes:
value: |
> [!NOTE]
>
> Do not prefix your title with "[BUG]", "[Bug report]", etc., a label will be added automatically.
If you're unsure whether you're experiencing a bug or not, consider using the [Discussions](https://github.com/glanceapp/glance/discussions) or [Discord](https://discord.com/invite/7KQ7Xa9kJd) to ask for help.
Please include only the information you think is relevant to the bug:
* How did you install Glance? (Docker container, manual binary install, etc)
* Which version of Glance are you using?
* Include the relevant parts of your `glance.yml` if applicable (widget, data source, properties used, etc)
* Include any relevant logs or screenshots if applicable
* Is the issue specific to a certain browser or OS?
* Steps to reliably reproduce the issue
* Are you hosting Glance on a VPS?
* Anything else you think might be relevant
**No need to copy the above list into your description, it's just a guide to help you provide the most useful information.**
- type: textarea
id: description
validations:
required: true
attributes:
label: Description
- type: markdown
attributes:
value: |
Thank you for taking the time to submit a bug report.
+8
View File
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Discussions
url: https://github.com/glanceapp/glance/discussions
about: For help, feedback, guides, resources and more
- name: Discord
url: https://discord.com/invite/7KQ7Xa9kJd
about: Much like the discussions but more chatty
@@ -0,0 +1,33 @@
name: Feature request
description: Share your ideas for new features or improvements
labels: ["feature request"]
body:
- type: markdown
attributes:
value: |
> [!NOTE]
>
> Do not prefix your title with "[REQUEST]", "[Feature request]", etc., a label will be added automatically.
Please provide a detailed description of what the feature would do and what it would look like:
* What problem would this feature solve?
* Are there any potential downsides to this feature?
* If applicable, what would the configuration for this feature look like?
* Are there any existing examples of this feature in other software?
* If applicable, include any external documentation required to implement this feature
* Anything else you think might be relevant
**No need to copy the above list into your description, it's just a guide to help you provide the most useful information.**
- type: textarea
id: description
validations:
required: true
attributes:
label: Description
- type: markdown
attributes:
value: |
Thank you for taking the time to submit your idea.
+1
View File
@@ -0,0 +1 @@
<!-- If your pull request adds new features, changes existing ones or fixes any bugs, please use the dev branch as the base, otherwise use the main branch -->
+39
View File
@@ -0,0 +1,39 @@
name: Create release
permissions:
contents: write
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout the target Git reference
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: release
+2 -1
View File
@@ -1,4 +1,5 @@
/assets
/build
/playground
glance.yml
/.idea
/glance*.yml
+69
View File
@@ -0,0 +1,69 @@
project_name: glanceapp/glance
checksum:
disable: true
builds:
- binary: glance
env:
- CGO_ENABLED=0
goos:
- linux
- openbsd
- freebsd
- windows
- darwin
goarch:
- amd64
- arm64
- arm
- 386
goarm:
- 7
ldflags:
- -s -w -X github.com/glanceapp/glance/internal/glance.buildVersion={{ .Tag }}
archives:
-
name_template: "glance-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}"
files:
- nothing*
format_overrides:
- goos: windows
format: zip
dockers:
- image_templates:
- &amd64_image "{{ .ProjectName }}:{{ .Tag }}-amd64"
build_flag_templates:
- --platform=linux/amd64
goarch: amd64
use: buildx
dockerfile: Dockerfile.goreleaser
- image_templates:
- &arm64v8_image "{{ .ProjectName }}:{{ .Tag }}-arm64"
build_flag_templates:
- --platform=linux/arm64
goarch: arm64
use: buildx
dockerfile: Dockerfile.goreleaser
- image_templates:
- &armv7_image "{{ .ProjectName }}:{{ .Tag }}-armv7"
build_flag_templates:
- --platform=linux/arm/v7
goarch: arm
goarm: 7
use: buildx
dockerfile: Dockerfile.goreleaser
docker_manifests:
- name_template: "{{ .ProjectName }}:{{ .Tag }}"
image_templates: &multiarch_images
- *amd64_image
- *arm64v8_image
- *armv7_image
- name_template: "{{ .ProjectName }}:latest"
skip_push: auto
image_templates: *multiarch_images
+12 -7
View File
@@ -1,11 +1,16 @@
FROM alpine:3.19
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
FROM golang:1.24.2-alpine3.21 AS builder
WORKDIR /app
COPY build/glance-$TARGETOS-$TARGETARCH${TARGETVARIANT} /app/glance
COPY . /app
RUN CGO_ENABLED=0 go build .
FROM alpine:3.21
WORKDIR /app
COPY --from=builder /app/glance .
HEALTHCHECK --timeout=10s --start-period=60s --interval=60s \
CMD wget --spider -q http://localhost:8080/api/healthz
EXPOSE 8080/tcp
ENTRYPOINT ["/app/glance"]
ENTRYPOINT ["/app/glance", "--config", "/app/config/glance.yml"]
+10
View File
@@ -0,0 +1,10 @@
FROM alpine:3.21
WORKDIR /app
COPY glance .
HEALTHCHECK --timeout=10s --start-period=60s --interval=60s \
CMD wget --spider -q http://localhost:8080/api/healthz
EXPOSE 8080/tcp
ENTRYPOINT ["/app/glance", "--config", "/app/config/glance.yml"]
-7
View File
@@ -1,7 +0,0 @@
FROM alpine:3.19
WORKDIR /app
COPY build/glance /app/glance
EXPOSE 8080/tcp
ENTRYPOINT ["/app/glance"]
+390 -67
View File
@@ -1,113 +1,436 @@
<p align="center"><em>What if you could see everything at a...</em></p>
<h1 align="center">Glance</h1>
<p align="center"><a href="#installation">Install</a> • <a href="docs/configuration.md">Configuration</a> • <a href="docs/themes.md">Themes</a></p>
<p align="center"><a href="#installation">Install</a> • <a href="docs/configuration.md">Configuration</a> • <a href="https://discord.com/invite/7KQ7Xa9kJd">Discord</a> • <a href="https://github.com/sponsors/glanceapp">Sponsor</a></p>
<p align="center"><a href="https://github.com/glanceapp/community-widgets">Community widgets</a> • <a href="docs/preconfigured-pages.md">Preconfigured pages</a> • <a href="docs/themes.md">Themes</a></p>
![example homepage](docs/images/readme-main-image.png)
![](docs/images/readme-main-image.png)
### Features
#### Various widgets
## Features
### Various widgets
* RSS feeds
* Subreddit posts
* Weather
* Bookmarks
* Latest YouTube videos from specific channels
* Calendar
* Stocks
* iframe
* Twitch channels & top games
* GitHub releases
* Repository overview
* Site monitor
* Hacker News posts
* Weather forecasts
* YouTube channel uploads
* Twitch channels
* Market prices
* Docker containers status
* Server stats
* Custom widgets
* [and many more...](docs/configuration.md)
#### Themeable
![multiple color schemes example](docs/images/themes-example.png)
### Fast and lightweight
* Low memory usage
* Few dependencies
* Minimal vanilla JS
* Single <20mb binary available for multiple OSs & architectures and just as small Docker container
* Uncached pages usually load within ~1s (depending on internet speed and number of widgets)
#### Optimized for mobile devices
![mobile device previews](docs/images/mobile-preview.png)
### Tons of customizability
* Different layouts
* As many pages/tabs as you need
* Numerous configuration options for each widget
* Multiple styles for some widgets
* Custom CSS
#### Fast and lightweight
* Minimal JS, no bloated frameworks
* Very few dependencies
* Single, easily distributed <15mb binary and just as small docker container
* All requests are parallelized, uncached pages usually load within ~1s (depending on internet speed and number of widgets)
### Optimized for mobile devices
Because you'll want to take it with you on the go.
### Configuration
Checkout the [configuration docs](docs/configuration.md) to learn more. A [preconfigured page](docs/configuration.md#preconfigured-page) is also available to get you started quickly.
![](docs/images/mobile-preview.png)
### Installation
> [!CAUTION]
>
> The project is under active development, expect things to break every once in a while.
### Themeable
Easily create your own theme by tweaking a few numbers or choose from one of the [already available themes](docs/themes.md).
#### Manual
Checkout the [releases page](https://github.com/glanceapp/glance/releases) for available binaries. You can place the binary inside `/opt/glance/` and have it start with your server via a [systemd service](https://linuxhandbook.com/create-systemd-services/). To specify a different path for the config file use the `--config` option:
![](docs/images/themes-example.png)
<br>
## Configuration
Configuration is done through YAML files, to learn more about how the layout works, how to add more pages and how to configure widgets, visit the [configuration documentation](docs/configuration.md).
<details>
<summary><strong>Preview example configuration file</strong></summary>
<br>
```yaml
pages:
- name: Home
columns:
- size: small
widgets:
- type: calendar
first-day-of-week: monday
- type: rss
limit: 10
collapse-after: 3
cache: 12h
feeds:
- url: https://selfh.st/rss/
title: selfh.st
limit: 4
- url: https://ciechanow.ski/atom.xml
- url: https://www.joshwcomeau.com/rss.xml
title: Josh Comeau
- url: https://samwho.dev/rss.xml
- url: https://ishadeed.com/feed.xml
title: Ahmad Shadeed
- type: twitch-channels
channels:
- theprimeagen
- j_blow
- piratesoftware
- cohhcarnage
- christitustech
- EJ_SA
- size: full
widgets:
- type: group
widgets:
- type: hacker-news
- type: lobsters
- type: videos
channels:
- UCXuqSBlHAE6Xw-yeJA0Tunw # Linus Tech Tips
- UCR-DXc1voovS8nhAvccRZhg # Jeff Geerling
- UCsBjURrPoezykLs9EqgamOA # Fireship
- UCBJycsmduvYEL83R_U4JriQ # Marques Brownlee
- UCHnyfMqiRRG1u-2MsSQLbXA # Veritasium
- type: group
widgets:
- type: reddit
subreddit: technology
show-thumbnails: true
- type: reddit
subreddit: selfhosted
show-thumbnails: true
- size: small
widgets:
- type: weather
location: London, United Kingdom
units: metric
hour-format: 12h
- type: markets
markets:
- symbol: SPY
name: S&P 500
- symbol: BTC-USD
name: Bitcoin
- symbol: NVDA
name: NVIDIA
- symbol: AAPL
name: Apple
- symbol: MSFT
name: Microsoft
- type: releases
cache: 1d
repositories:
- glanceapp/glance
- go-gitea/gitea
- immich-app/immich
- syncthing/syncthing
```
</details>
<br>
## Installation
Choose one of the following methods:
<details>
<summary><strong>Docker compose using provided directory structure (recommended)</strong></summary>
<br>
Create a new directory called `glance` as well as the template files within it by running:
```bash
mkdir glance && cd glance && curl -sL https://github.com/glanceapp/docker-compose-template/archive/refs/heads/main.tar.gz | tar -xzf - --strip-components 2
```
*[click here to view the files that will be created](https://github.com/glanceapp/docker-compose-template/tree/main/root)*
Then, edit the following files as desired:
* `docker-compose.yml` to configure the port, volumes and other containery things
* `config/home.yml` to configure the widgets or layout of the home page
* `config/glance.yml` if you want to change the theme or add more pages
<details>
<summary>Other files you may want to edit</summary>
* `.env` to configure environment variables that will be available inside configuration files
* `assets/user.css` to add custom CSS
</details>
When ready, run:
```bash
docker compose up -d
```
If you encounter any issues, you can check the logs by running:
```bash
docker compose logs
```
<hr>
</details>
<details>
<summary><strong>Docker compose manual</strong></summary>
<br>
Create a `docker-compose.yml` file with the following contents:
```yaml
services:
glance:
container_name: glance
image: glanceapp/glance
restart: unless-stopped
volumes:
- ./config:/app/config
ports:
- 8080:8080
```
Then, create a new directory called `config` and download the example starting [`glance.yml`](https://github.com/glanceapp/glance/blob/main/docs/glance.yml) file into it by running:
```bash
mkdir config && wget -O config/glance.yml https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/glance.yml
```
Feel free to edit the `glance.yml` file to your liking, and when ready run:
```bash
docker compose up -d
```
If you encounter any issues, you can check the logs by running:
```bash
docker logs glance
```
<hr>
</details>
<details>
<summary><strong>Manual binary installation</strong></summary>
<br>
Precompiled binaries are available for Linux, Windows and macOS (x86, x86_64, ARM and ARM64 architectures).
### Linux
Visit the [latest release page](https://github.com/glanceapp/glance/releases/latest) for available binaries. You can place the binary in `/opt/glance/` and have it start with your server via a [systemd service](https://linuxhandbook.com/create-systemd-services/). By default, when running the binary, it will look for a `glance.yml` file in the directory it's placed in. To specify a different path for the config file, use the `--config` option:
```bash
/opt/glance/glance --config /etc/glance.yml
```
#### Docker
> [!IMPORTANT]
>
> Make sure you have a valid `glance.yml` file in the same directory before running the container.
To grab a starting template for the config file, run:
```bash
docker run -d -p 8080:8080 \
-v ./glance.yml:/app/glance.yml \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
glanceapp/glance
wget https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/glance.yml
```
Or if you prefer docker compose:
### Windows
Download and extract the executable from the [latest release](https://github.com/glanceapp/glance/releases/latest) (most likely the file called `glance-windows-amd64.zip` if you're on a 64-bit system) and place it in a folder of your choice. Then, create a new text file called `glance.yml` in the same folder and paste the content from [here](https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/glance.yml) in it. You should then be able to run the executable and access the dashboard by visiting `http://localhost:8080` in your browser.
<hr>
</details>
<details>
<summary><strong>Other</strong></summary>
<br>
Glance can also be installed through the following 3rd party channels:
* [Proxmox VE Helper Script](https://community-scripts.github.io/ProxmoxVE/scripts?id=glance)
* [NixOS package](https://search.nixos.org/packages?channel=unstable&show=glance)
* [Coolify.io](https://coolify.io/docs/services/glance/)
<hr>
</details>
<br>
## Common issues
<details>
<summary><strong>Requests timing out</strong></summary>
The most common cause of this is when using Pi-Hole, AdGuard Home or other ad-blocking DNS services, which by default have a fairly low rate limit. Depending on the number of widgets you have in a single page, this limit can very easily be exceeded. To fix this, increase the rate limit in the settings of your DNS service.
If using Podman, in some rare cases the timeout can be caused by an unknown issue, in which case it may be resolved by adding the following to the bottom of your `docker-compose.yml` file:
```yaml
networks:
podman:
external: true
```
</details>
<details>
<summary><strong>Broken layout for markets, bookmarks or other widgets</strong></summary>
This is almost always caused by the browser extension Dark Reader. To fix this, disable dark mode for the domain where Glance is hosted.
</details>
<details>
<summary><strong>cannot unmarshal !!map into []glance.page</strong></summary>
The most common cause of this is having a `pages` key in your `glance.yml` and then also having a `pages` key inside one of your included pages. To fix this, remove the `pages` key from the top of your included pages.
</details>
<br>
## FAQ
<details>
<summary><strong>Does the information on the page update automatically?</strong></summary>
No, a page refresh is required to update the information. Some things do dynamically update where it makes sense, like the clock widget and the relative time showing how long ago something happened.
</details>
<details>
<summary><strong>How frequently do widgets update?</strong></summary>
No requests are made periodically in the background, information is only fetched upon loading the page and then cached. The default cache lifetime is different for each widget and can be configured.
</details>
<details>
<summary><strong>Can I create my own widgets?</strong></summary>
Yes, there are multiple ways to create custom widgets:
* `iframe` widget - allows you to embed things from other websites
* `html` widget - allows you to insert your own static HTML
* `extension` widget - fetch HTML from a URL
* `custom-api` widget - fetch JSON from a URL and render it using custom HTML
</details>
<details>
<summary><strong>Can I change the title of a widget?</strong></summary>
Yes, the title of all widgets can be changed by specifying the `title` property in the widget's configuration:
```yaml
services:
glance:
image: glanceapp/glance
volumes:
- ./glance.yml:/app/glance.yml
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- 8080:8080
restart: unless-stopped
- type: rss
title: My custom title
- type: markets
title: My custom title
- type: videos
title: My custom title
# and so on for all widgets...
```
</details>
### Building from source
<br>
Requirements: [Go](https://go.dev/dl/) >= v1.22
## Feature requests
To build:
New feature suggestions are always welcome and will be considered, though please keep in mind that some of them may be out of scope for what the project is trying to achieve (or is reasonably capable of). If you have an idea for a new feature and would like to share it, you can do so [here](https://github.com/glanceapp/glance/issues/new?template=feature_request.yml).
Feature requests are tagged with one of the following:
* [Roadmap](https://github.com/glanceapp/glance/labels/roadmap) - will be implemented in a future release
* [Backlog](https://github.com/glanceapp/glance/labels/backlog) - may be implemented in the future but needs further feedback or interest from the community
* [Icebox](https://github.com/glanceapp/glance/labels/icebox) - no plans to implement as it doesn't currently align with the project's goals or capabilities, may be revised at a later date
<br>
## Building from source
Choose one of the following methods:
<details>
<summary><strong>Build binary with Go</strong></summary>
<br>
Requirements: [Go](https://go.dev/dl/) >= v1.23
To build the project for your current OS and architecture, run:
```bash
go build -o build/glance .
```
To run:
To build for a specific OS and architecture, run:
```bash
GOOS=linux GOARCH=amd64 go build -o build/glance .
```
[*click here for a full list of GOOS and GOARCH combinations*](https://go.dev/doc/install/source#:~:text=$GOOS%20and%20$GOARCH)
Alternatively, if you just want to run the app without creating a binary, like when you're testing out changes, you can run:
```bash
go run .
```
<hr>
</details>
### Building Docker image
<details>
<summary><strong>Build project and Docker image with Docker</strong></summary>
<br>
Build Glance with CGO disabled:
Requirements: [Docker](https://docs.docker.com/engine/install/)
To build the project and image using just Docker, run:
*(replace `owner` with your name or organization)*
```bash
CGO_ENABLED=0 go build -o build/glance .
docker build -t owner/glance:latest .
```
Build the image:
**Make sure to replace "owner" with your name or organization.**
```bash
docker build -t owner/glance:latest -f Dockerfile.single-platform .
```
Push the image to your registry:
If you wish to push the image to a registry (by default Docker Hub), run:
```bash
docker push owner/glance:latest
```
<hr>
</details>
<br>
## Contributing guidelines
* Before working on a new feature it's preferable to submit a feature request first and state that you'd like to implement it yourself
* Please don't submit PRs for feature requests that are either in the roadmap<sup>[1]</sup>, backlog<sup>[2]</sup> or icebox<sup>[3]</sup>
* Use `dev` for the base branch if you're adding new features or fixing bugs, otherwise use `main`
* Avoid introducing new dependencies
* Avoid making backwards-incompatible configuration changes
* Avoid introducing new colors or hard-coding colors, use the standard `primary`, `positive` and `negative`
* For icons, try to use [heroicons](https://heroicons.com/) where applicable
* Provide a screenshot of the changes if UI related where possible
* No `package.json`
<details>
<summary><strong><sup>[1] [2] [3]</sup></strong></summary>
[1] The feature likely already has work put into it that may conflict with your implementation
[2] The demand, implementation or functionality for this feature is not yet clear
[3] No plans to add this feature for the time being
</details>
<br>
## Thank you
To all the people who were generous enough to [sponsor](https://github.com/sponsors/glanceapp) the project and to everyone who has contributed in any way, be it PRs, submitting issues, helping others in the discussions or Discord server, creating guides and tools or just mentioning Glance on social media. Your support is greatly appreciated and helps keep the project going.
+1923 -122
View File
File diff suppressed because it is too large Load Diff
+464
View File
@@ -0,0 +1,464 @@
[Jump to function definitions](#functions)
## Examples
The best way to get an idea of how the templates work would be with a bunch examples. Here are the most common use cases:
JSON response:
```json
{
"title": "My Title",
"content": "My Content",
}
```
To access the two fields in the JSON response, you would use the following:
```html
<div>{{ .JSON.String "title" }}</div>
<div>{{ .JSON.String "content" }}</div>
```
Output:
```html
<div>My Title</div>
<div>My Content</div>
```
<hr>
JSON response:
```json
{
"author": "John Doe",
"posts": [
{
"title": "My Title",
"content": "My Content"
},
{
"title": "My Title 2",
"content": "My Content 2"
}
]
}
```
To loop through the array of posts, you would use the following:
```html
{{ range .JSON.Array "posts" }}
<div>{{ .String "title" }}</div>
<div>{{ .String "content" }}</div>
{{ end }}
```
Output:
```html
<div>My Title</div>
<div>My Content</div>
<div>My Title 2</div>
<div>My Content 2</div>
```
Notice the missing `.JSON` when accessing the title and content, this is because the range function sets the context to the current array element.
If you want to access the top-level context within the range, you can use the following:
```html
{{ range .JSON.Array "posts" }}
<div>{{ .String "title" }}</div>
<div>{{ .String "content" }}</div>
<div>{{ $.JSON.String "author" }}</div>
{{ end }}
```
Output:
```html
<div>My Title</div>
<div>My Content</div>
<div>John Doe</div>
<div>My Title 2</div>
<div>My Content 2</div>
<div>John Doe</div>
```
<hr>
JSON response:
```json
[
"Apple",
"Banana",
"Cherry",
"Watermelon"
]
```
Somewhat awkwardly, when the current context is a basic type that isn't an object, the way you specify its type is to use an empty string as the key. So, to loop through the array of strings, you would use the following:
```html
{{ range .JSON.Array "" }}
<div>{{ .String "" }}</div>
{{ end }}
```
Output:
```html
<div>Apple</div>
<div>Banana</div>
<div>Cherry</div>
<div>Watermelon</div>
```
To access an item at a specific index, you could use the following:
```html
<div>{{ .JSON.String "0" }}</div>
```
Output:
```html
<div>Apple</div>
```
<hr>
JSON response:
```json
{
"user": {
"address": {
"city": "New York",
"state": "NY"
}
}
}
```
To easily access deeply nested objects, you can use the following dot notation:
```html
<div>{{ .JSON.String "user.address.city" }}</div>
<div>{{ .JSON.String "user.address.state" }}</div>
```
Output:
```html
<div>New York</div>
<div>NY</div>
```
Using indexes anywhere in the path is also supported:
```json
{
"users": [
{
"name": "John Doe"
},
{
"name": "Jane Doe"
}
]
}
```
```html
<div>{{ .JSON.String "users.0.name" }}</div>
<div>{{ .JSON.String "users.1.name" }}</div>
```
Output:
```html
<div>John Doe</div>
<div>Jane Doe</div>
```
<hr>
JSON response:
```json
{
"user": {
"name": "John Doe",
"age": 30
}
}
```
To check if a field exists, you can use the following:
```html
{{ if .JSON.Exists "user.age" }}
<div>{{ .JSON.Int "user.age" }}</div>
{{ else }}
<div>Age not provided</div>
{{ end }}
```
Output:
```html
<div>30</div>
```
<hr>
JSON response:
```json
{
"price": 100,
"discount": 10
}
```
Calculations can be performed on either ints or floats. If both numbers are ints, an int will be returned, otherwise a float will be returned. If you try to divide by zero, 0 will be returned. If you provide non-numeric values, `NaN` will be returned.
```html
<div>{{ sub (.JSON.Int "price") (.JSON.Int "discount") }}</div>
```
Output:
```html
<div>90</div>
```
Other operations include `add`, `mul`, and `div`.
<hr>
JSON response:
```json
{
"posts": [
{
"title": "Exploring the Depths of Quantum Computing",
"date": "2023-10-27T10:00:00Z"
},
{
"title": "A Beginner's Guide to Sustainable Living",
"date": "2023-11-15T14:30:00+01:00"
},
{
"title": "The Art of Baking Sourdough Bread",
"date": "2023-12-03T08:45:22-08:00"
}
]
}
```
To parse the date and display the relative time (e.g. 2h, 1d, etc), you would use the following:
```
{{ range .JSON.Array "posts" }}
<div>{{ .String "title" }}</div>
<div {{ .String "date" | parseTime "rfc3339" | toRelativeTime }}></div>
{{ end }}
```
The `parseTime` function takes two arguments: the layout of the date string and the date string itself. The layout can be one of the following: "RFC3339", "RFC3339Nano", "DateTime", "DateOnly", "TimeOnly" or a custom layout in Go's [date format](https://pkg.go.dev/time#pkg-constants).
Output:
```html
<div>Exploring the Depths of Quantum Computing</div>
<div data-dynamic-relative-time="1698400800"></div>
<div>A Beginner's Guide to Sustainable Living</div>
<div data-dynamic-relative-time="1700055000"></div>
<div>The Art of Baking Sourdough Bread</div>
<div data-dynamic-relative-time="1701621922"></div>
```
You don't have to worry about the internal implementation, this will then be dynamically populated by Glance on the client side to show the correct relative time.
The important thing to notice here is that the return value of `toRelativeTime` must be used as an attribute in an HTML tag, be it a `div`, `li`, `span`, etc.
<hr>
In some instances, you may want to know the status code of the response. This can be done using the following:
```html
{{ if eq .Response.StatusCode 200 }}
<p>Success!</p>
{{ else }}
<p>Failed to fetch data</p>
{{ end }}
```
You can also access the response headers:
```html
<div>{{ .Response.Header.Get "Content-Type" }}</div>
```
<hr>
JSON response:
```json
{"name": "Steve", "age": 30}
{"name": "Alex", "age": 25}
{"name": "John", "age": 35}
```
The above format is "[ndjson](https://docs.mulesoft.com/dataweave/latest/dataweave-formats-ndjson)" or "[JSON Lines](https://jsonlines.org/)", where each line is a separate JSON object. To parse this format, you must first disable the JSON validation check in your config, since by default the response is expected to be a single valid JSON object:
```yaml
- type: custom-api
skip-json-validation: true
```
Then, to iterate over each object you can use `.JSONLines`:
```html
{{ range .JSONLines }}
<p>{{ .String "name" }} is {{ .Int "age" }} years old</p>
{{ end }}
```
Output:
```html
<p>Steve is 30 years old</p>
<p>Alex is 25 years old</p>
<p>John is 35 years old</p>
```
For other ways of selecting data from a JSON Lines response, have a look at the docs for [tidwall/gjson](https://github.com/tidwall/gjson/tree/master?tab=readme-ov-file#json-lines). For example, to get an array of all names, you can use the following:
```html
{{ range .JSON.Array "..#.name" }}
<p>{{ .String "" }}</p>
{{ end }}
```
Output:
```html
<p>Steve</p>
<p>Alex</p>
<p>John</p>
```
<hr>
In some instances, you may need to make two consecutive API calls, where you use the result of the first call in the second call. To achieve this, you can make additional HTTP requests from within the template itself using the following syntax:
```yaml
- type: custom-api
url: https://api.example.com/get-id-of-something
template: |
{{ $theID := .JSON.String "id" }}
{{
$something := newRequest (concat "https://api.example.com/something/" $theID)
| withParameter "key" "value"
| withHeader "Authorization" "Bearer token"
| getResponse
}}
{{ $something.JSON.String "title" }}
```
Here, `$theID` gets retrieved from the result of the first API call and used in the second API call. The `newRequest` function creates a new request, and the `getResponse` function executes it. You can also use `withParameter` and `withHeader` to optionally add parameters and headers to the request.
If you need to make a request to a URL that requires dynamic parameters, you can omit the `url` property in the YAML and run the request entirely from within the template itself:
```yaml
- type: custom-api
title: Events from the last 24h
template: |
{{
$events := newRequest "https://api.example.com/events"
| withParameter "after" (offsetNow "-24h" | formatTime "rfc3339")
| getResponse
}}
{{ if eq $events.Response.StatusCode 200 }}
{{ range $events.JSON.Array "events" }}
<div>{{ .String "title" }}</div>
<div {{ .String "date" | parseTime "rfc3339" | toRelativeTime }}></div>
{{ end }}
{{ else }}
<p>Failed to fetch data: {{ $events.Response.Status }}</p>
{{ end }}
```
*Note that you need to manually check for the correct status code.*
## Functions
The following functions are available on the `JSON` object:
- `String(key string) string`: Returns the value of the key as a string.
- `Int(key string) int`: Returns the value of the key as an integer.
- `Float(key string) float`: Returns the value of the key as a float.
- `Bool(key string) bool`: Returns the value of the key as a boolean.
- `Array(key string) []JSON`: Returns the value of the key as an array of `JSON` objects.
- `Exists(key string) bool`: Returns true if the key exists in the JSON object.
The following helper functions provided by Glance are available:
- `toFloat(i int) float`: Converts an integer to a float.
- `toInt(f float) int`: Converts a float to an integer.
- `toRelativeTime(t time.Time) template.HTMLAttr`: Converts Time to a relative time such as 2h, 1d, etc which dynamically updates. **NOTE:** the value of this function should be used as an attribute in an HTML tag, e.g. `<span {{ toRelativeTime .Time }}></span>`.
- `now() time.Time`: Returns the current time.
- `offsetNow(offset string) time.Time`: Returns the current time with an offset. The offset can be positive or negative and must be in the format "3h" "-1h" or "2h30m10s".
- `duration(str string) time.Duration`: Parses a string such as `1h`, `24h`, `5h30m`, etc into a `time.Duration`.
- `parseTime(layout string, s string) time.Time`: Parses a string into time.Time. The layout must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants). You can alternatively use these values instead of the literal format: "unix", "RFC3339", "RFC3339Nano", "DateTime", "DateOnly".
- `formatTime(layout string, s string) time.Time`: Formats a `time.Time` into a string. The layout uses the same format as `parseTime`.
- `parseLocalTime(layout string, s string) time.Time`: Same as the above, except in the absence of a timezone, it will use the local timezone instead of UTC.
- `parseRelativeTime(layout string, s string) time.Time`: A shorthand for `{{ .String "date" | parseTime "rfc3339" | toRelativeTime }}`.
- `add(a, b float) float`: Adds two numbers.
- `sub(a, b float) float`: Subtracts two numbers.
- `mul(a, b float) float`: Multiplies two numbers.
- `div(a, b float) float`: Divides two numbers.
- `formatApproxNumber(n int) string`: Formats a number to be more human-readable, e.g. 1000 -> 1k.
- `formatNumber(n float|int) string`: Formats a number with commas, e.g. 1000 -> 1,000.
- `trimPrefix(prefix string, str string) string`: Trims the prefix from a string.
- `trimSuffix(suffix string, str string) string`: Trims the suffix from a string.
- `trimSpace(str string) string`: Trims whitespace from a string on both ends.
- `replaceAll(old string, new string, str string) string`: Replaces all occurrences of a string in a string.
- `replaceMatches(pattern string, replacement string, str string) string`: Replaces all occurrences of a regular expression in a string.
- `findMatch(pattern string, str string) string`: Finds the first match of a regular expression in a string.
- `findSubmatch(pattern string, str string) string`: Finds the first submatch of a regular expression in a string.
- `sortByString(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a string key in either ascending or descending order.
- `sortByInt(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by an integer key in either ascending or descending order.
- `sortByFloat(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a float key in either ascending or descending order.
- `sortByTime(key string, layout string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a time key in either ascending or descending order. The format must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants).
- `concat(strings ...string) string`: Concatenates multiple strings together.
- `unique(key string, arr []JSON) []JSON`: Returns a unique array of JSON objects based on the given key.
- `percentChange(current float, previous float) float`: Calculates the percentage change between two numbers.
The following helper functions provided by Go's `text/template` are available:
- `eq(a, b any) bool`: Compares two values for equality.
- `ne(a, b any) bool`: Compares two values for inequality.
- `lt(a, b any) bool`: Compares two values for less than.
- `lte(a, b any) bool`: Compares two values for less than or equal to.
- `gt(a, b any) bool`: Compares two values for greater than.
- `gte(a, b any) bool`: Compares two values for greater than or equal to.
- `and(a, b bool) bool`: Returns true if both values are true.
- `or(a, b bool) bool`: Returns true if either value is true.
- `not(a bool) bool`: Returns the opposite of the value.
- `index(a any, b int) any`: Returns the value at the specified index of an array.
- `len(a any) int`: Returns the length of an array.
- `printf(format string, a ...any) string`: Returns a formatted string.
+164
View File
@@ -0,0 +1,164 @@
# Extensions
> [!IMPORTANT]
>
> **This document as well as the extensions feature are a work in progress. The API may change in the future. You are responsible for maintaining your own extensions.**
## Overview
With the intention of requiring minimal knowledge in order to develop extensions, rather than being a convoluted protocol they are nothing more than an HTTP request to a server that returns a few special headers. The exchange between Glance and extensions can be seen in the following diagram:
![](images/extension-overview.png)
If you know how to setup an HTTP server and a bit of HTML and CSS you're ready to start building your own extensions.
> [!TIP]
>
> By default, the extension widget has a cache time of 30 minutes. To avoid having to restart Glance after every extension change you can set the cache time of the widget to 1 second:
> ```yaml
> - type: extension
> url: http://localhost:8081
> cache: 1s
> ```
## Headers
### `Widget-Title`
Used to specify the title of the widget. If not provided, the widget's title will be "Extension".
### `Widget-Title-URL`
Used to specify the URL that will be opened when the widget's title is clicked. If the user has specified a `title-url` in their config, it will take precedence over this header.
### `Widget-Content-Type`
Used to specify the content type that will be returned by the extension. If not provided, the content will be shown as plain text.
### `Widget-Content-Frameless`
When set to `true`, the widget's content will be displayed without the default background or "frame".
## Content Types
> [!NOTE]
>
> Currently, `html` is the only supported content type. The long-term goal is to have generic content types such as `videos`, `forum-posts`, `markets`, `streams`, etc. which will be returned in JSON format and displayed by Glance using existing styles and functionality, allowing extension developers to achieve a native look while only focusing on providing data from their preferred source.
### `html`
Displays the content as HTML. This requires the user to have the `allow-potentially-dangerous-html` property set to `true`, otherwise the content will be shown as plain text.
#### Using existing classes and functionality
Most of the features seen throughout Glance can easily be used in your custom HTML extensions. Below is an example of some of these features:
```html
<p class="color-subdue">Text with subdued color</p>
<p>Text with base color</p>
<p class="color-highlight">Text with highlighted color</p>
<p class="color-primary">Text with primary color</p>
<p class="color-positive">Text with positive color</p>
<p class="color-negative">Text with negative color</p>
<hr class="margin-block-15">
<p class="size-h1">Font size 1</p>
<p class="size-h2">Font size 2</p>
<p class="size-h3">Font size 3</p>
<p class="size-h4">Font size 4</p>
<p class="size-base">Font size base</p>
<p class="size-h5">Font size 5</p>
<p class="size-h6">Font size 6</p>
<hr class="margin-block-15">
<a class="visited-indicator" href="#notvisitedprobably">Link with visited indicator</a>
<hr class="margin-block-15">
<a class="color-primary-if-not-visited" href="#notvisitedprobably">Link with primary color if not visited</a>
<hr class="margin-block-15">
<p>Event happened <span data-dynamic-relative-time="<unix timestamp>"></span> ago</p>
<hr class="margin-block-15">
<ul class="list-horizontal-text">
<li>horizontal</li>
<li>list</li>
<li>with</li>
<li>multiple</li>
<li>text</li>
<li>items</li>
</ul>
<hr class="margin-block-15">
<ul class="list list-gap-10 list-with-separator">
<li>list</li>
<li>with</li>
<li>gap</li>
<li>and</li>
<li>horizontal</li>
<li>lines</li>
</ul>
<hr class="margin-block-15">
<ul class="list collapsible-container" data-collapse-after="3">
<li>collapsible</li>
<li>list</li>
<li>with</li>
<li>many</li>
<li>items</li>
<li>that</li>
<li>will</li>
<li>appear</li>
<li>when</li>
<li>you</li>
<li>click</li>
<li>the</li>
<li>button</li>
<li>below</li>
</ul>
<hr class="margin-bottom-15">
<p class="margin-bottom-10">Lazily loaded image:</p>
<img src="https://picsum.photos/200" alt="" loading="lazy">
<hr class="margin-block-15">
<p class="margin-bottom-10">List of posts:</p>
<ul class="list list-gap-14 collapsible-container" data-collapse-after="5">
<li>
<a class="size-h3 color-primary-if-not-visited" href="#link">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, ipsa?</a>
<ul class="list-horizontal-text">
<li data-dynamic-relative-time="<unix timestamp>"></li>
<li>3,321 points</li>
<li>139 comments</li>
</ul>
</li>
<li>
<a class="size-h3 color-primary-if-not-visited" href="#link">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, ipsa?</a>
<ul class="list-horizontal-text">
<li data-dynamic-relative-time="<unix timestamp>"></li>
<li>3,321 points</li>
<li>139 comments</li>
</ul>
</li>
<li>
<a class="size-h3 color-primary-if-not-visited" href="#link">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, ipsa?</a>
<ul class="list-horizontal-text">
<li data-dynamic-relative-time="<unix timestamp>"></li>
<li>3,321 points</li>
<li>139 comments</li>
</ul>
</li>
</ul>
```
All of that will result in the following:
![](images/extension-html-reusing-existing-features-preview.png)
**Class names or features may change, once again, you are responsible for maintaining your own extensions.**
+105
View File
@@ -0,0 +1,105 @@
pages:
- name: Home
# Optionally, if you only have a single page you can hide the desktop navigation for a cleaner look
# hide-desktop-navigation: true
columns:
- size: small
widgets:
- type: calendar
first-day-of-week: monday
- type: rss
limit: 10
collapse-after: 3
cache: 12h
feeds:
- url: https://selfh.st/rss/
title: selfh.st
limit: 4
- url: https://ciechanow.ski/atom.xml
- url: https://www.joshwcomeau.com/rss.xml
title: Josh Comeau
- url: https://samwho.dev/rss.xml
- url: https://ishadeed.com/feed.xml
title: Ahmad Shadeed
- type: twitch-channels
channels:
- theprimeagen
- j_blow
- piratesoftware
- cohhcarnage
- christitustech
- EJ_SA
- size: full
widgets:
- type: group
widgets:
- type: hacker-news
- type: lobsters
- type: videos
channels:
- UCXuqSBlHAE6Xw-yeJA0Tunw # Linus Tech Tips
- UCR-DXc1voovS8nhAvccRZhg # Jeff Geerling
- UCsBjURrPoezykLs9EqgamOA # Fireship
- UCBJycsmduvYEL83R_U4JriQ # Marques Brownlee
- UCHnyfMqiRRG1u-2MsSQLbXA # Veritasium
- type: group
widgets:
- type: reddit
subreddit: technology
show-thumbnails: true
- type: reddit
subreddit: selfhosted
show-thumbnails: true
- size: small
widgets:
- type: weather
location: London, United Kingdom
units: metric # alternatively "imperial"
hour-format: 12h # alternatively "24h"
# Optionally hide the location from being displayed in the widget
# hide-location: true
- type: markets
markets:
- symbol: SPY
name: S&P 500
- symbol: BTC-USD
name: Bitcoin
- symbol: NVDA
name: NVIDIA
- symbol: AAPL
name: Apple
- symbol: MSFT
name: Microsoft
- type: releases
cache: 1d
# Without authentication the Github API allows for up to 60 requests per hour. You can create a
# read-only token from your Github account settings and use it here to increase the limit.
# token: ...
repositories:
- glanceapp/glance
- go-gitea/gitea
- immich-app/immich
- syncthing/syncthing
# Add more pages here:
# - name: Your page name
# columns:
# - size: small
# widgets:
# # Add widgets here
# - size: full
# widgets:
# # Add widgets here
# - size: small
# widgets:
# # Add widgets here
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 KiB

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 KiB

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+226
View File
@@ -0,0 +1,226 @@
# Preconfigured pages
Don't want to spend time configuring pages from scratch? No problem! Simply copy the config from the ones below.
Pull requests with your page configurations are welcome!
> [!NOTE]
>
> Pages must be placed under a top level `pages:` key, you can read more about that [here](configuration.md#pages).
## Startpage
![](images/startpage-preview.png)
<details>
<summary>View config (requires Glance <code>v0.6.0</code> or higher)</summary>
```yaml
- name: Startpage
width: slim
hide-desktop-navigation: true
center-vertically: true
columns:
- size: full
widgets:
- type: search
autofocus: true
- type: monitor
cache: 1m
title: Services
sites:
- title: Jellyfin
url: https://yourdomain.com/
icon: si:jellyfin
- title: Gitea
url: https://yourdomain.com/
icon: si:gitea
- title: qBittorrent # only for Linux ISOs, of course
url: https://yourdomain.com/
icon: si:qbittorrent
- title: Immich
url: https://yourdomain.com/
icon: si:immich
- title: AdGuard Home
url: https://yourdomain.com/
icon: si:adguard
- title: Vaultwarden
url: https://yourdomain.com/
icon: si:vaultwarden
- type: bookmarks
groups:
- title: General
links:
- title: Gmail
url: https://mail.google.com/mail/u/0/
- title: Amazon
url: https://www.amazon.com/
- title: Github
url: https://github.com/
- title: Entertainment
links:
- title: YouTube
url: https://www.youtube.com/
- title: Prime Video
url: https://www.primevideo.com/
- title: Disney+
url: https://www.disneyplus.com/
- title: Social
links:
- title: Reddit
url: https://www.reddit.com/
- title: Twitter
url: https://twitter.com/
- title: Instagram
url: https://www.instagram.com/
```
</details>
## Markets
![](images/markets-page-preview.png)
<details>
<summary>View config (requires Glance <code>v0.6.0</code> or higher)</summary>
```yaml
- name: Markets
columns:
- size: small
widgets:
- type: markets
title: Indices
markets:
- symbol: SPY
name: S&P 500
- symbol: DX-Y.NYB
name: Dollar Index
- type: markets
title: Crypto
markets:
- symbol: BTC-USD
name: Bitcoin
- symbol: ETH-USD
name: Ethereum
- type: markets
title: Stocks
sort-by: absolute-change
markets:
- symbol: NVDA
name: NVIDIA
- symbol: AAPL
name: Apple
- symbol: MSFT
name: Microsoft
- symbol: GOOGL
name: Google
- symbol: AMD
name: AMD
- symbol: RDDT
name: Reddit
- symbol: AMZN
name: Amazon
- symbol: TSLA
name: Tesla
- symbol: INTC
name: Intel
- symbol: META
name: Meta
- size: full
widgets:
- type: rss
title: News
style: horizontal-cards
feeds:
- url: https://feeds.bloomberg.com/markets/news.rss
title: Bloomberg
- url: https://moxie.foxbusiness.com/google-publisher/markets.xml
title: Fox Business
- url: https://moxie.foxbusiness.com/google-publisher/technology.xml
title: Fox Business
- type: group
widgets:
- type: reddit
show-thumbnails: true
subreddit: technology
- type: reddit
show-thumbnails: true
subreddit: wallstreetbets
- type: videos
style: grid-cards
collapse-after-rows: 3
channels:
- UCvSXMi2LebwJEM1s4bz5IBA # New Money
- UCV6KDgJskWaEckne5aPA0aQ # Graham Stephan
- UCAzhpt9DmG6PnHXjmJTvRGQ # Federal Reserve
- size: small
widgets:
- type: rss
title: News
limit: 30
collapse-after: 13
feeds:
- url: https://www.ft.com/technology?format=rss
title: Financial Times
- url: https://feeds.a.dj.com/rss/RSSMarketsMain.xml
title: Wall Street Journal
```
</details>
## Gaming
![](images/gaming-page-preview.png)
<details>
<summary>View config (requires Glance <code>v0.6.0</code> or higher)</summary>
```yaml
- name: Gaming
columns:
- size: small
widgets:
- type: twitch-top-games
limit: 20
collapse-after: 13
exclude:
- just-chatting
- pools-hot-tubs-and-beaches
- music
- art
- asmr
- size: full
widgets:
- type: group
widgets:
- type: reddit
show-thumbnails: true
subreddit: pcgaming
- type: reddit
subreddit: games
- type: videos
style: grid-cards
collapse-after-rows: 3
channels:
- UCNvzD7Z-g64bPXxGzaQaa4g # gameranx
- UCZ7AeeVbyslLM_8-nVy2B8Q # Skill Up
- UCHDxYLv8iovIbhrfl16CNyg # GameLinked
- UC9PBzalIcEQCsiIkq36PyUA # Digital Foundry
- size: small
widgets:
- type: reddit
subreddit: gamingnews
limit: 7
style: vertical-cards
```
</details>
+31
View File
@@ -53,6 +53,26 @@ theme:
primary-color: 97 13 80
```
### Gruvbox Dark
![screenshot](images/themes/gruvbox.png)
```yaml
theme:
background-color: 0 0 16
primary-color: 43 59 81
positive-color: 61 66 44
negative-color: 6 96 59
```
### Kanagawa Dark
![screenshot](images/themes/kanagawa-dark.png)
```yaml
theme:
background-color: 240 13 14
primary-color: 51 33 68
negative-color: 358 100 68
contrast-multiplier: 1.2
```
### Tucan
![screenshot](images/themes/tucan.png)
```yaml
@@ -62,6 +82,17 @@ theme:
negative-color: 209 88 54
```
### Dracula
![screenshot](images/themes/dracula.png)
```yaml
theme:
background-color: 231 15 21
primary-color: 265 89 79
contrast-multiplier: 1.2
positive-color: 135 94 66
negative-color: 0 100 67
```
## Light
### Catppuccin Latte
+57
View File
@@ -0,0 +1,57 @@
## Upgrading to v0.7.0 from previous versions
In essence, the `glance.yml` file has been moved from the root of the project to a `config/` directory and you now need to mount that directory to `/app/config` in the container.
### Before
Versions before v0.7.0 used a `docker-compose.yml` that looked like the following:
```yaml
services:
glance:
image: glanceapp/glance
volumes:
- ./glance.yml:/app/glance.yml
ports:
- 8080:8080
```
And expected you to have the following directory structure:
```plaintext
glance/
docker-compose.yml
glance.yml
```
### After
With the release of v0.7.0, the recommended `docker-compose.yml` looks like the following:
```yaml
services:
glance:
container_name: glance
image: glanceapp/glance
volumes:
- ./config:/app/config
ports:
- 8080:8080
```
And expects you to have the following directory structure:
```plaintext
glance/
docker-compose.yml
config/
glance.yml
```
## Why this change was necessary
1. Mounting a file rather than a directory is not common practice and leads to some issues, such as creating a directory if the file is not present, which has tripped up multiple people and caused unnecessary confusion
2. v0.7.0 added automatic reloads when the configuration file changes, which based on testing didn't work when mounting a single file
3. v0.7.0 added the ability to include config files, so you'd have to make this change anyways if you wanted to take advantage of that feature
Taking all of these into account, it felt like the right time to implement the change.
+19 -5
View File
@@ -1,19 +1,33 @@
module github.com/glanceapp/glance
go 1.22.0
go 1.24.2
require (
github.com/fsnotify/fsnotify v1.9.0
github.com/mmcdole/gofeed v1.3.0
golang.org/x/text v0.14.0
github.com/shirou/gopsutil/v4 v4.25.4
github.com/tidwall/gjson v1.18.0
golang.org/x/crypto v0.38.0
golang.org/x/text v0.25.0
gopkg.in/yaml.v3 v3.0.1
)
require (
github.com/PuerkitoBio/goquery v1.9.1 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/PuerkitoBio/goquery v1.10.3 // indirect
github.com/andybalholm/cascadia v1.3.3 // indirect
github.com/ebitengine/purego v0.8.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
github.com/mmcdole/goxpp v1.1.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
golang.org/x/net v0.24.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/net v0.40.0 // indirect
golang.org/x/sys v0.33.0 // indirect
)
+107 -12
View File
@@ -1,13 +1,32 @@
github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI=
github.com/PuerkitoBio/goquery v1.9.1/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY=
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/PuerkitoBio/goquery v1.10.1 h1:Y8JGYUkXWTGRB6Ars3+j3kN0xg1YqqlwvdTV8WTFQcU=
github.com/PuerkitoBio/goquery v1.10.1/go.mod h1:IYiHrOMps66ag56LEH7QYDDupKXyo5A8qrjIx3ZtujY=
github.com/PuerkitoBio/goquery v1.10.2 h1:7fh2BdHcG6VFZsK7toXBT/Bh1z5Wmy8Q9MV9HqT2AM8=
github.com/PuerkitoBio/goquery v1.10.2/go.mod h1:0guWGjcLu9AYC7C1GHnpysHy056u9aEkUHwhdnePMCU=
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I=
github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 h1:7UMa6KCCMjZEMDtTVdcGu0B1GmmC7QJKiCCjyTAWQy0=
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k=
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 h1:PpXWgLPs+Fqr325bN2FD2ISlRRztXibcX6e8f5FR5Dc=
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
github.com/mmcdole/gofeed v1.3.0 h1:5yn+HeqlcvjMeAI4gu6T+crm7d0anY85+M+v6fIFNG4=
github.com/mmcdole/gofeed v1.3.0/go.mod h1:9TGv2LcJhdXePDzxiuMnukhV2/zb6VtnZt1mS+SjkLE=
github.com/mmcdole/goxpp v1.1.1 h1:RGIX+D6iQRIunGHrKqnA2+700XMCnNv0bAOOv5MUhx8=
@@ -19,47 +38,123 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/shirou/gopsutil/v4 v4.25.1 h1:QSWkTc+fu9LTAWfkZwZ6j8MSUk4A2LV7rbH0ZqmLjXs=
github.com/shirou/gopsutil/v4 v4.25.1/go.mod h1:RoUCUpndaJFtT+2zsZzzmhvbfGoDCJ7nFXKJf8GqJbI=
github.com/shirou/gopsutil/v4 v4.25.3 h1:SeA68lsu8gLggyMbmCn8cmp97V1TI9ld9sVzAUcKcKE=
github.com/shirou/gopsutil/v4 v4.25.3/go.mod h1:xbuxyoZj+UsgnZrENu3lQivsngRR5BdjbJwf2fv4szA=
github.com/shirou/gopsutil/v4 v4.25.4 h1:cdtFO363VEOOFrUCjZRh4XVJkb548lyF0q0uTeMqYPw=
github.com/shirou/gopsutil/v4 v4.25.4/go.mod h1:xbuxyoZj+UsgnZrENu3lQivsngRR5BdjbJwf2fv4szA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo=
github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI=
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-15
View File
@@ -1,15 +0,0 @@
package assets
import (
"embed"
"io/fs"
)
//go:embed static
var _publicFS embed.FS
//go:embed templates
var _templateFS embed.FS
var PublicFS, _ = fs.Sub(_publicFS, "static")
var TemplateFS, _ = fs.Sub(_templateFS, "templates")
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because it is too large Load Diff
-362
View File
@@ -1,362 +0,0 @@
function throttledDebounce(callback, maxDebounceTimes, debounceDelay) {
let debounceTimeout;
let timesDebounced = 0;
return function () {
if (timesDebounced == maxDebounceTimes) {
clearTimeout(debounceTimeout);
timesDebounced = 0;
callback();
return;
}
clearTimeout(debounceTimeout);
timesDebounced++;
debounceTimeout = setTimeout(() => {
timesDebounced = 0;
callback();
}, debounceDelay);
};
};
async function fetchPageContent(pageSlug) {
// TODO: handle non 200 status codes/time outs
// TODO: add retries
const response = await fetch(`/api/pages/${pageSlug}/content/`);
const content = await response.text();
return content;
}
function setupCarousels() {
const carouselElements = document.getElementsByClassName("carousel-container");
if (carouselElements.length == 0) {
return;
}
for (let i = 0; i < carouselElements.length; i++) {
const carousel = carouselElements[i];
carousel.classList.add("show-right-cutoff");
const itemsContainer = carousel.getElementsByClassName("carousel-items-container")[0];
const determineSideCutoffs = () => {
if (itemsContainer.scrollLeft != 0) {
carousel.classList.add("show-left-cutoff");
} else {
carousel.classList.remove("show-left-cutoff");
}
if (Math.ceil(itemsContainer.scrollLeft) + itemsContainer.clientWidth < itemsContainer.scrollWidth) {
carousel.classList.add("show-right-cutoff");
} else {
carousel.classList.remove("show-right-cutoff");
}
}
const determineSideCutoffsRateLimited = throttledDebounce(determineSideCutoffs, 20, 100);
itemsContainer.addEventListener("scroll", determineSideCutoffsRateLimited);
document.addEventListener("resize", determineSideCutoffsRateLimited);
setTimeout(determineSideCutoffs, 1);
}
}
const minuteInSeconds = 60;
const hourInSeconds = minuteInSeconds * 60;
const dayInSeconds = hourInSeconds * 24;
const monthInSeconds = dayInSeconds * 30;
const yearInSeconds = monthInSeconds * 12;
function relativeTimeSince(timestamp) {
const delta = Math.round((Date.now() / 1000) - timestamp);
if (delta < minuteInSeconds) {
return "1m";
}
if (delta < hourInSeconds) {
return Math.floor(delta / minuteInSeconds) + "m";
}
if (delta < dayInSeconds) {
return Math.floor(delta / hourInSeconds) + "h";
}
if (delta < monthInSeconds) {
return Math.floor(delta / dayInSeconds) + "d";
}
if (delta < yearInSeconds) {
return Math.floor(delta / monthInSeconds) + "mo";
}
return Math.floor(delta / yearInSeconds) + "y";
}
function updateRelativeTimeForElements(elements)
{
for (let i = 0; i < elements.length; i++)
{
const element = elements[i];
const timestamp = element.dataset.dynamicRelativeTime;
if (timestamp === undefined)
continue
element.innerText = relativeTimeSince(timestamp);
}
}
function setupDynamicRelativeTime() {
const elements = document.querySelectorAll("[data-dynamic-relative-time]");
const updateInterval = 60 * 1000;
let lastUpdateTime = Date.now();
updateRelativeTimeForElements(elements);
const updateElementsAndTimestamp = () => {
updateRelativeTimeForElements(elements);
lastUpdateTime = Date.now();
};
const scheduleRepeatingUpdate = () => setInterval(updateElementsAndTimestamp, updateInterval);
if (document.hidden === undefined) {
scheduleRepeatingUpdate();
return;
}
let timeout = scheduleRepeatingUpdate();
document.addEventListener("visibilitychange", () => {
if (document.hidden) {
clearTimeout(timeout);
return;
}
const delta = Date.now() - lastUpdateTime;
if (delta >= updateInterval) {
updateElementsAndTimestamp();
timeout = scheduleRepeatingUpdate();
return;
}
timeout = setTimeout(() => {
updateElementsAndTimestamp();
timeout = scheduleRepeatingUpdate();
}, updateInterval - delta);
});
}
function setupLazyImages() {
const images = document.querySelectorAll("img[loading=lazy]");
if (images.length == 0) {
return;
}
function imageFinishedTransition(image) {
image.classList.add("finished-transition");
}
setTimeout(() => {
for (let i = 0; i < images.length; i++) {
const image = images[i];
if (image.complete) {
image.classList.add("cached");
setTimeout(() => imageFinishedTransition(image), 5);
} else {
// TODO: also handle error event
image.addEventListener("load", () => {
image.classList.add("loaded");
setTimeout(() => imageFinishedTransition(image), 500);
});
}
}
}, 5);
}
function attachExpandToggleButton(collapsibleContainer) {
const showMoreText = "Show more";
const showLessText = "Show less";
let expanded = false;
const button = document.createElement("button");
const icon = document.createElement("span");
icon.classList.add("expand-toggle-button-icon");
const textNode = document.createTextNode(showMoreText);
button.classList.add("expand-toggle-button");
button.append(textNode, icon);
button.addEventListener("click", () => {
expanded = !expanded;
if (expanded) {
collapsibleContainer.classList.add("container-expanded");
button.classList.add("container-expanded");
textNode.nodeValue = showLessText;
return;
}
const topBefore = button.getClientRects()[0].top;
collapsibleContainer.classList.remove("container-expanded");
button.classList.remove("container-expanded");
textNode.nodeValue = showMoreText;
const topAfter = button.getClientRects()[0].top;
if (topAfter > 0)
return;
window.scrollBy({
top: topAfter - topBefore,
behavior: "instant"
});
});
collapsibleContainer.after(button);
return button;
};
function setupCollapsibleLists() {
const collapsibleLists = document.querySelectorAll(".list.collapsible-container");
if (collapsibleLists.length == 0) {
return;
}
for (let i = 0; i < collapsibleLists.length; i++) {
const list = collapsibleLists[i];
if (list.dataset.collapseAfter === undefined) {
continue;
}
const collapseAfter = parseInt(list.dataset.collapseAfter);
if (collapseAfter == -1) {
continue;
}
if (list.children.length <= collapseAfter) {
continue;
}
attachExpandToggleButton(list);
for (let c = collapseAfter; c < list.children.length; c++) {
const child = list.children[c];
child.classList.add("collapsible-item");
child.style.animationDelay = ((c - collapseAfter) * 20).toString() + "ms";
}
list.classList.add("ready");
}
}
function setupCollapsibleGrids() {
const collapsibleGridElements = document.querySelectorAll(".cards-grid.collapsible-container");
if (collapsibleGridElements.length == 0) {
return;
}
for (let i = 0; i < collapsibleGridElements.length; i++) {
const gridElement = collapsibleGridElements[i];
if (gridElement.dataset.collapseAfterRows === undefined) {
continue;
}
const collapseAfterRows = parseInt(gridElement.dataset.collapseAfterRows);
if (collapseAfterRows == -1) {
continue;
}
const getCardsPerRow = () => {
return parseInt(getComputedStyle(gridElement).getPropertyValue('--cards-per-row'));
};
const button = attachExpandToggleButton(gridElement);
let cardsPerRow = 2;
const resolveCollapsibleItems = () => {
const hideItemsAfterIndex = cardsPerRow * collapseAfterRows;
if (hideItemsAfterIndex >= gridElement.children.length) {
button.style.display = "none";
} else {
button.style.removeProperty("display");
}
let row = 0;
for (let i = 0; i < gridElement.children.length; i++) {
const child = gridElement.children[i];
if (i >= hideItemsAfterIndex) {
child.classList.add("collapsible-item");
child.style.animationDelay = (row * 40).toString() + "ms";
if (i % cardsPerRow + 1 == cardsPerRow) {
row++;
}
} else {
child.classList.remove("collapsible-item");
child.style.removeProperty("animation-delay");
}
}
};
setTimeout(() => {
cardsPerRow = getCardsPerRow();
resolveCollapsibleItems();
gridElement.classList.add("ready");
}, 1);
window.addEventListener("resize", () => {
const newCardsPerRow = getCardsPerRow();
if (cardsPerRow == newCardsPerRow) {
return;
}
cardsPerRow = newCardsPerRow;
resolveCollapsibleItems();
});
}
}
async function setupPage() {
const pageElement = document.getElementById("page");
const pageContentElement = document.getElementById("page-content");
const pageContent = await fetchPageContent(pageData.slug);
pageContentElement.innerHTML = pageContent;
setTimeout(() => {
document.body.classList.add("animate-element-transition");
}, 200);
try {
setupLazyImages();
setupCarousels();
setupCollapsibleLists();
setupCollapsibleGrids();
setupDynamicRelativeTime();
} finally {
pageElement.classList.add("content-ready");
}
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", setupPage);
} else {
setupPage();
}
-13
View File
@@ -1,13 +0,0 @@
{
"name": "Glance",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "/static/app-icon.png",
"type": "image/png",
"sizes": "512x512"
}
]
}
-115
View File
@@ -1,115 +0,0 @@
package assets
import (
"fmt"
"html/template"
"math"
"strconv"
"time"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
var (
PageTemplate = compileTemplate("page.html", "document.html", "page-style-overrides.gotmpl")
PageContentTemplate = compileTemplate("content.html")
CalendarTemplate = compileTemplate("calendar.html", "widget-base.html")
BookmarksTemplate = compileTemplate("bookmarks.html", "widget-base.html")
IFrameTemplate = compileTemplate("iframe.html", "widget-base.html")
WeatherTemplate = compileTemplate("weather.html", "widget-base.html")
ForumPostsTemplate = compileTemplate("forum-posts.html", "widget-base.html")
RedditCardsHorizontalTemplate = compileTemplate("reddit-horizontal-cards.html", "widget-base.html")
RedditCardsVerticalTemplate = compileTemplate("reddit-vertical-cards.html", "widget-base.html")
ReleasesTemplate = compileTemplate("releases.html", "widget-base.html")
VideosTemplate = compileTemplate("videos.html", "widget-base.html", "video-card-contents.html")
VideosGridTemplate = compileTemplate("videos-grid.html", "widget-base.html", "video-card-contents.html")
StocksTemplate = compileTemplate("stocks.html", "widget-base.html")
RSSListTemplate = compileTemplate("rss-list.html", "widget-base.html")
RSSHorizontalCardsTemplate = compileTemplate("rss-horizontal-cards.html", "widget-base.html")
RSSHorizontalCards2Template = compileTemplate("rss-horizontal-cards-2.html", "widget-base.html")
MonitorTemplate = compileTemplate("monitor.html", "widget-base.html")
TwitchGamesListTemplate = compileTemplate("twitch-games-list.html", "widget-base.html")
TwitchChannelsTemplate = compileTemplate("twitch-channels.html", "widget-base.html")
RepositoryTemplate = compileTemplate("repository.html", "widget-base.html")
)
var globalTemplateFunctions = template.FuncMap{
"relativeTime": relativeTimeSince,
"formatViewerCount": formatViewerCount,
"formatNumber": intl.Sprint,
"absInt": func(i int) int {
return int(math.Abs(float64(i)))
},
"formatPrice": func(price float64) string {
return intl.Sprintf("%.2f", price)
},
"formatTime": func(t time.Time) string {
return t.Format("2006-01-02 15:04:05")
},
"shouldCollapse": func(i int, collapseAfter int) bool {
if collapseAfter < -1 {
return false
}
return i >= collapseAfter
},
"itemAnimationDelay": func(i int, collapseAfter int) string {
return fmt.Sprintf("%dms", (i-collapseAfter)*30)
},
"dynamicRelativeTimeAttrs": func(t time.Time) template.HTMLAttr {
return template.HTMLAttr(fmt.Sprintf(`data-dynamic-relative-time="%d"`, t.Unix()))
},
}
func compileTemplate(primary string, dependencies ...string) *template.Template {
t, err := template.New(primary).
Funcs(globalTemplateFunctions).
ParseFS(TemplateFS, append([]string{primary}, dependencies...)...)
if err != nil {
panic(err)
}
return t
}
var intl = message.NewPrinter(language.English)
func formatViewerCount(count int) string {
if count < 1_000 {
return strconv.Itoa(count)
}
if count < 10_000 {
return fmt.Sprintf("%.1fk", float64(count)/1_000)
}
if count < 1_000_000 {
return fmt.Sprintf("%dk", count/1_000)
}
return fmt.Sprintf("%.1fm", float64(count)/1_000_000)
}
func relativeTimeSince(t time.Time) string {
delta := time.Since(t)
if delta < time.Minute {
return "1m"
}
if delta < time.Hour {
return fmt.Sprintf("%dm", delta/time.Minute)
}
if delta < 24*time.Hour {
return fmt.Sprintf("%dh", delta/time.Hour)
}
if delta < 30*24*time.Hour {
return fmt.Sprintf("%dd", delta/(24*time.Hour))
}
if delta < 12*30*24*time.Hour {
return fmt.Sprintf("%dmo", delta/(30*24*time.Hour))
}
return fmt.Sprintf("%dy", delta/(365*24*time.Hour))
}
-37
View File
@@ -1,37 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
{{ if ne .Style "dynamic-columns-experimental" }}
<ul class="list list-gap-24 list-with-separator">
{{ range .Groups }}
<li class="bookmarks-group"{{ if .Color }} style="--bookmarks-group-color: {{ .Color.AsCSSValue }}"{{ end }}>
{{ template "group" . }}
</li>
{{ end }}
</ul>
{{ else }}
<div class="dynamic-columns">
{{ range .Groups }}
<div class="bookmarks-group"{{ if .Color }} style="--bookmarks-group-color: {{ .Color.AsCSSValue }}"{{ end }}>
{{ template "group" . }}
</div>
{{ end }}
</div>
{{ end }}
{{ end }}
{{ define "group" }}
{{ if ne .Title "" }}<div class="bookmarks-group-title size-h3 margin-bottom-3">{{ .Title }}</div>{{ end }}
<ul class="list list-gap-2">
{{ range .Links }}
<li class="flex items-center gap-10">
{{ if ne "" .Icon }}
<div class="bookmarks-icon-container">
<img class="bookmarks-icon{{ if .IsSimpleIcon }} simple-icon{{ end }}" src="{{ .Icon }}" alt="" loading="lazy">
</div>
{{ end }}
<a href="{{ .URL }}" class="bookmarks-link {{ if .HideArrow }}bookmarks-link-no-arrow {{ end }}color-highlight size-h4" {{ if not .SameTab }}target="_blank"{{ end }} rel="noreferrer">{{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}
-27
View File
@@ -1,27 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
<div class="flex justify-between items-center">
<div class="color-highlight size-h1">{{ .Calendar.CurrentMonthName }}</div>
<ul class="list-horizontal-text color-highlight size-h4">
<li>Week {{ .Calendar.CurrentWeekNumber }}</li>
<li>{{ .Calendar.CurrentYear }}</li>
</ul>
</div>
<div class="flex flex-wrap size-h6 margin-top-10 color-subdue">
<div class="calendar-day">Mo</div>
<div class="calendar-day">Tu</div>
<div class="calendar-day">We</div>
<div class="calendar-day">Th</div>
<div class="calendar-day">Fr</div>
<div class="calendar-day">Sa</div>
<div class="calendar-day">Su</div>
</div>
<div class="flex flex-wrap">
{{ range .Calendar.Days }}
<div class="calendar-day{{ if eq . $.Calendar.CurrentDay }} calendar-day-today{{ end }}">{{ . }}</div>
{{ end }}
</div>
{{ end }}
-13
View File
@@ -1,13 +0,0 @@
{{ if .Page.ShowMobileHeader }}
<div class="mobile-reachability-header">{{ .Page.Title }}</div>
{{ end }}
<div class="page-columns">
{{ range .Page.Columns }}
<div class="page-column page-column-{{ .Size }}">
{{ range .Widgets }}
{{ .Render }}
{{ end }}
</div>
{{ end }}
</div>
-25
View File
@@ -1,25 +0,0 @@
<!DOCTYPE html>
<html {{ block "document-root-attrs" . }}{{ end }} lang="en" id="top">
<head>
{{ block "document-head-before" . }}{{ end }}
<title>{{ block "document-title" . }}{{ end }}</title>
<meta charset="UTF-8">
<meta name="color-scheme" content="dark">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Glance">
<meta name="theme-color" content="{{ if ne nil .App.Config.Theme.BackgroundColor }}{{ .App.Config.Theme.BackgroundColor }}{{ else }}hsl(240, 8%, 9%){{ end }}">
<link rel="apple-touch-icon" sizes="512x512" href="/static/app-icon.png">
<link rel="icon" type="image/png" sizes="50x50" href="/static/favicon.png">
<link rel="manifest" href="/static/manifest.json">
<link rel="icon" type="image/png" href="/static/favicon.png" />
<link rel="stylesheet" href="/static/main.css?v={{ .App.Config.Server.StartedAt.Unix }}">
<script async src="/static/main.js?v={{ .App.Config.Server.StartedAt.Unix }}"></script>
{{ block "document-head-after" . }}{{ end }}
</head>
<body>
{{ template "document-body" . }}
</body>
</html>
@@ -1,36 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
<ul class="list list-gap-14 collapsible-container" data-collapse-after="{{ .CollapseAfter }}">
{{ range .Posts }}
<li>
<div class="forum-post-list-item thumbnail-container">
{{ if $.ShowThumbnails }}
{{ if ne .ThumbnailUrl "" }}
<img class="forum-post-list-thumbnail thumbnail" src="{{ .ThumbnailUrl }}" alt="" loading="lazy">
{{ else if .HasTargetUrl }}
<svg class="forum-post-list-thumbnail hide-on-mobile" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="-9 -8 40 40" stroke-width="1.5" stroke="var(--color-text-subdue)">
<path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244" />
</svg>
{{ else }}
<svg class="forum-post-list-thumbnail hide-on-mobile" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="-9 -8 40 40" stroke-width="1.5" stroke="var(--color-text-subdue)">
<path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z" />
</svg>
{{ end }}
{{ end }}
<div class="grow">
<a href="{{ .DiscussionUrl }}" class="size-h3 color-primary-if-not-visited" target="_blank" rel="noreferrer">{{ .Title }}</a>
<ul class="list-horizontal-text">
<li {{ dynamicRelativeTimeAttrs .TimePosted }}></li>
<li>{{ .Score | formatNumber }} points</li>
<li>{{ .CommentCount | formatNumber }} comments</li>
{{ if .HasTargetUrl }}
<li class="shrink min-width-0"><a class="visited-indicator text-truncate block" href="{{ .TargetUrl }}" target="_blank" rel="noreferrer">{{ .TargetUrlDomain }}</a></li>
{{ end }}
</ul>
</div>
</div>
</li>
{{ end }}
</ul>
{{ end }}
-53
View File
@@ -1,53 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
{{ if ne .Style "dynamic-columns-experimental" }}
<ul class="list list-gap-20 list-with-separator">
{{ range .Sites }}
<li class="monitor-site flex items-center gap-15">
{{ template "site" . }}
</li>
{{ end }}
</ul>
{{ else }}
<ul class="dynamic-columns">
{{ range .Sites }}
<div class="flex items-center gap-15">
{{ template "site" . }}
</div>
{{ end }}
</ul>
{{ end }}
{{ end }}
{{ define "site" }}
{{ if .IconUrl }}
<img class="monitor-site-icon" src="{{ .IconUrl }}" alt="" loading="lazy">
{{ end }}
<div>
<a class="size-h3 color-highlight" href="{{ .Url }}" {{ if not .SameTab }}target="_blank"{{ end }} rel="noreferrer">{{ .Title }}</a>
<ul class="list-horizontal-text">
{{ if not .Status.Error }}
<li>{{ .StatusText }}</li>
<li>{{ .Status.ResponseTime.Milliseconds | formatNumber }}ms</li>
{{ else if .Status.TimedOut }}
<li class="color-negative">Timed Out</li>
{{ else }}
<li class="color-negative" title="{{ .Status.Error }}">ERROR</li>
{{ end }}
</ul>
</div>
{{ if eq .StatusStyle "good" }}
<div class="monitor-site-status-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="var(--color-positive)">
<path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z" clip-rule="evenodd" />
</svg>
</div>
{{ else }}
<div class="monitor-site-status-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="var(--color-negative)">
<path fill-rule="evenodd" d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" />
</svg>
</div>
{{ end }}
{{ end }}
@@ -1,14 +0,0 @@
<style>
:root {
{{ if .App.Config.Theme.BackgroundColor }}
--bgh: {{ .App.Config.Theme.BackgroundColor.Hue }};
--bgs: {{ .App.Config.Theme.BackgroundColor.Saturation }}%;
--bgl: {{ .App.Config.Theme.BackgroundColor.Lightness }}%;
{{ end }}
{{ if ne 0.0 .App.Config.Theme.ContrastMultiplier }}--cm: {{ .App.Config.Theme.ContrastMultiplier }};{{ end }}
{{ if ne 0.0 .App.Config.Theme.TextSaturationMultiplier }}--tsm: {{ .App.Config.Theme.TextSaturationMultiplier }};{{ end }}
{{ if .App.Config.Theme.PrimaryColor }}--color-primary: {{ .App.Config.Theme.PrimaryColor.AsCSSValue }};{{ end }}
{{ if .App.Config.Theme.PositiveColor }}--color-positive: {{ .App.Config.Theme.PositiveColor.AsCSSValue }};{{ end }}
{{ if .App.Config.Theme.NegativeColor }}--color-negative: {{ .App.Config.Theme.NegativeColor.AsCSSValue }};{{ end }}
}
</style>
-67
View File
@@ -1,67 +0,0 @@
{{ template "document.html" . }}
{{ define "document-title" }}{{ .Page.Title }} - Glance{{ end }}
{{ define "document-head-before" }}
<script>
const pageData = {
slug: "{{ .Page.Slug }}",
};
</script>
{{ end }}
{{ define "document-root-attrs" }}{{ if .App.Config.Theme.Light }}class="light-scheme"{{ end }}{{ end }}
{{ define "document-head-after" }}
{{ template "page-style-overrides.gotmpl" . }}
{{ if ne "" .App.Config.Theme.CustomCSSFile }}
<link rel="stylesheet" href="{{ .App.Config.Theme.CustomCSSFile }}?v={{ .App.Config.Server.StartedAt.Unix }}">
{{ end }}
{{ end }}
{{ define "navigation-links" }}
{{ range .App.Config.Pages }}
<a href="/{{ .Slug }}" class="nav-item{{ if eq .Slug $.Page.Slug }} nav-item-current{{ end }}">{{ .Title }}</a>
{{ end }}
{{ end }}
{{ define "document-body" }}
<div class="header-container content-bounds">
<div class="header flex padding-inline-widget widget-content-frame">
<!-- TODO: Replace G with actual logo, first need an actual logo -->
<div class="logo">G</div>
<div class="nav flex grow">
{{ template "navigation-links" . }}
</div>
</div>
</div>
<div class="mobile-navigation">
<div class="mobile-navigation-icons">
<a class="mobile-navigation-label" href="#top"></a>
{{ range $i, $column := .Page.Columns }}
<label class="mobile-navigation-label"><input type="radio" class="mobile-navigation-input" name="column" value="{{ $i }}" autocomplete="off"{{ if eq "full" $column.Size }} checked{{ end }}><div class="mobile-navigation-pill"></div></label>
{{ end }}
<label class="mobile-navigation-label"><input type="checkbox" class="mobile-navigation-page-links-input" autocomplete="on"><div class="hamburger-icon"></div></label>
</div>
<div class="mobile-navigation-page-links">
{{ template "navigation-links" . }}
</div>
</div>
<div class="content-bounds">
<div class="page" id="page">
<div class="page-content" id="page-content"></div>
<div class="page-loading-container">
<!-- TODO: add a bigger/better loading indicator -->
<div class="loading-icon"></div>
</div>
</div>
</div>
<div class="footer flex items-center flex-column">
<div>
<a class="size-h3" href="https://github.com/glanceapp/glance" target="_blank" rel="noreferrer">Glance</a> {{ if ne "dev" .App.Version }}<a class="visited-indicator" title="Release notes" href="https://github.com/glanceapp/glance/releases/tag/{{ .App.Version }}" target="_blank" rel="noreferrer">{{ .App.Version }}</a>{{ else }}({{ .App.Version }}){{ end }}
</div>
<a class="color-primary block margin-top-5 size-h5" href="https://github.com/glanceapp/glance/issues" target="_blank" rel="noreferrer">Report issue</a>
</div>
{{ end }}
-18
View File
@@ -1,18 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
<ul class="list list-gap-10 collapsible-container" data-collapse-after="{{ .CollapseAfter }}">
{{ range $i, $release := .Releases }}
<li>
<a class="size-h4 block text-truncate color-primary-if-not-visited" href="{{ $release.NotesUrl }}" target="_blank" rel="noreferrer">{{ .Name }}</a>
<ul class="list-horizontal-text">
<li {{ dynamicRelativeTimeAttrs $release.TimeReleased }}></li>
<li>{{ $release.Version }}</li>
{{ if gt $release.Downvotes 3 }}
<li>{{ $release.Downvotes | formatNumber }} ⚠</li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>
{{ end }}
-44
View File
@@ -1,44 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
<a class="size-h4 color-highlight" href="https://github.com/{{ $.RepositoryDetails.Name }}" target="_blank" rel="noreferrer">{{ .RepositoryDetails.Name }}</a>
<ul class="list-horizontal-text">
<li>{{ .RepositoryDetails.Stars | formatNumber }} stars</li>
<li>{{ .RepositoryDetails.Forks | formatNumber }} forks</li>
</ul>
{{ if gt (len .RepositoryDetails.PullRequests) 0 }}
<hr class="margin-block-10">
<a class="text-compact" href="https://github.com/{{ $.RepositoryDetails.Name }}/pulls" target="_blank" rel="noreferrer">Open pull requests ({{ .RepositoryDetails.OpenPullRequests | formatNumber }} total)</a>
<div class="flex gap-7 size-h5 margin-top-3">
<ul class="list list-gap-2">
{{ range .RepositoryDetails.PullRequests }}
<li {{ dynamicRelativeTimeAttrs .CreatedAt }}></li>
{{ end }}
</ul>
<ul class="list list-gap-2 min-width-0">
{{ range .RepositoryDetails.PullRequests }}
<li><a class="color-primary-if-not-visited text-truncate block" title="{{ .Title }}" target="_blank" rel="noreferrer" href="https://github.com/{{ $.RepositoryDetails.Name }}/pull/{{ .Number }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
{{ end }}
{{ if gt (len .RepositoryDetails.Issues) 0 }}
<hr class="margin-block-10">
<a class="text-compact" href="https://github.com/{{ $.RepositoryDetails.Name }}/issues" target="_blank" rel="noreferrer">Open issues ({{ .RepositoryDetails.OpenIssues | formatNumber }} total)</a>
<div class="flex gap-7 size-h5 margin-top-3">
<ul class="list list-gap-2">
{{ range .RepositoryDetails.Issues }}
<li {{ dynamicRelativeTimeAttrs .CreatedAt }}></li>
{{ end }}
</ul>
<ul class="list list-gap-2 min-width-0">
{{ range .RepositoryDetails.Issues }}
<li><a class="color-primary-if-not-visited text-truncate block" title="{{ .Title }}" target="_blank" rel="noreferrer" href="https://github.com/{{ $.RepositoryDetails.Name }}/issues/{{ .Number }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
{{ end }}
{{ end }}
-17
View File
@@ -1,17 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
<ul class="list list-gap-14 collapsible-container" data-collapse-after="{{ .CollapseAfter }}">
{{ range .Items }}
<li>
<a class="size-title-dynamic color-primary-if-not-visited" href="{{ .Link }}" target="_blank" rel="noreferrer">{{ .Title }}</a>
<ul class="list-horizontal-text">
<li {{ dynamicRelativeTimeAttrs .PublishedAt }}></li>
{{ if gt (len $.FeedRequests) 1 }}
<li><a href="{{ .ChannelURL }}" target="_blank" rel="noreferrer">{{ .ChannelName }}</a></li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>
{{ end }}
-39
View File
@@ -1,39 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
{{ if ne .Style "dynamic-columns-experimental" }}
<ul class="list list-gap-20 list-with-separator">
{{ range .Stocks }}
<li class="flex items-center gap-15">
{{ template "stock" . }}
</li>
{{ end }}
</ul>
{{ else }}
<div class="dynamic-columns">
{{ range .Stocks }}
<div class="flex items-center gap-15">
{{ template "stock" . }}
</div>
{{ end }}
</div>
{{ end }}
{{ end }}
{{ define "stock" }}
<div class="shrink min-width-0">
<a{{ if ne "" .SymbolLink }} href="{{ .SymbolLink }}" target="_blank" rel="noreferrer"{{ end }} class="color-highlight size-h3 block text-truncate">{{ .Symbol }}</a>
<div class="text-truncate">{{ .Name }}</div>
</div>
<a class="stock-chart" {{ if ne "" .ChartLink }} href="{{ .ChartLink }}" target="_blank" rel="noreferrer"{{ end }}>
<svg class="stock-chart shrink-0" viewBox="0 0 100 50">
<polyline fill="none" stroke="var(--color-text-subdue)" stroke-width="1.5px" points="{{ .SvgChartPoints }}" vector-effect="non-scaling-stroke"></polyline>
</svg>
</a>
<div class="stock-values shrink-0">
<div class="size-h3 text-right {{ if eq .PercentChange 0.0 }}{{ else if gt .PercentChange 0.0 }}color-positive{{ else }}color-negative{{ end }}">{{ printf "%+.2f" .PercentChange }}%</div>
<div class="text-right">{{ .Currency }}{{ .Price | formatPrice }}</div>
</div>
{{ end }}
-29
View File
@@ -1,29 +0,0 @@
{{ template "widget-base.html" . }}
{{ define "widget-content" }}
<div class="size-h2 color-highlight text-center">{{ .Weather.WeatherCodeAsString }}</div>
<div class="size-h4 text-center">Feels like {{ .Weather.ApparentTemperature }}°{{ if eq .Units "metric" }}C{{ else }}F{{ end }}</div>
<div class="weather-columns flex margin-top-15 justify-center">
{{ range $i, $column := .Weather.Columns }}
<div class="weather-column{{ if eq $i $.Weather.CurrentColumn }} weather-column-current{{ end }}">
{{ if $column.HasPrecipitation }}
<div class="weather-column-rain"></div>
{{ end }}
{{ if and (ge $i $.Weather.SunriseColumn) (le $i $.Weather.SunsetColumn ) }}
<div class="weather-column-daylight{{ if eq $i $.Weather.SunriseColumn }} weather-column-daylight-sunrise{{ else if eq $i $.Weather.SunsetColumn }} weather-column-daylight-sunset{{ end }}"></div>
{{ end }}
<div class="weather-column-value{{ if lt $column.Temperature 0 }} weather-column-value-negative{{ end }}">{{ $column.Temperature | absInt }}</div>
<div class="weather-bar" style='--weather-bar-height: {{ printf "%.2f" $column.Scale }}'></div>
<div class="weather-column-time">{{ index $.TimeLabels $i }}</div>
</div>
{{ end }}
</div>
{{ if not .HideLocation }}
<div class="flex items-center justify-center margin-top-15 gap-7 size-h5">
<div class="location-icon"></div>
<div class="text-truncate">{{ .Place.Name }},{{ if .ShowAreaName }} {{ .Place.Area }},{{ end }} {{ .Place.Country }}</div>
</div>
{{ end }}
{{ end }}
@@ -1,21 +0,0 @@
<div class="widget widget-type-{{ .GetType }}">
<div class="widget-header">
<div class="uppercase">{{ .Title }}</div>
{{ if and .Error .ContentAvailable }}
<div class="notice-icon notice-icon-major" title="{{ .Error }}"></div>
{{ else if .Notice }}
<div class="notice-icon notice-icon-minor" title="{{ .Notice }}"></div>
{{ end }}
</div>
<div class="widget-content {{ if .ContentAvailable }}{{ block "widget-content-classes" . }}{{ end }}{{ end }}">
{{ if .ContentAvailable }}
{{ block "widget-content" . }}{{ end }}
{{ else }}
<div class="widget-error-header">
<div class="color-negative size-h3">ERROR</div>
<div class="widget-error-icon"></div>
</div>
<p class="break-all">{{ if .Error }}{{ .Error }}{{ else }}No error information provided{{ end }}</p>
{{ end}}
</div>
</div>
-53
View File
@@ -1,53 +0,0 @@
package feed
import "time"
// TODO: very inflexible, refactor to allow more customizability
// TODO: allow changing first day of week
// TODO: allow changing between showing the previous and next week and the entire month
func NewCalendar(now time.Time) *Calendar {
year, week := now.ISOWeek()
weekday := now.Weekday()
if weekday == 0 {
weekday = 7
}
currentMonthDays := daysInMonth(now.Month(), year)
var previousMonthDays int
if previousMonthNumber := now.Month() - 1; previousMonthNumber < 1 {
previousMonthDays = daysInMonth(12, year-1)
} else {
previousMonthDays = daysInMonth(previousMonthNumber, year)
}
startDaysFrom := now.Day() - int(weekday+6)
days := make([]int, 21)
for i := 0; i < 21; i++ {
day := startDaysFrom + i
if day < 1 {
day = previousMonthDays + day
} else if day > currentMonthDays {
day = day - currentMonthDays
}
days[i] = day
}
return &Calendar{
CurrentDay: now.Day(),
CurrentWeekNumber: week,
CurrentMonthName: now.Month().String(),
CurrentYear: year,
Days: days,
}
}
func daysInMonth(m time.Month, year int) int {
return time.Date(year, m+1, 0, 0, 0, 0, 0, time.UTC).Day()
}
-248
View File
@@ -1,248 +0,0 @@
package feed
import (
"fmt"
"log/slog"
"net/http"
"sync"
"time"
)
type githubReleaseResponseJson struct {
TagName string `json:"tag_name"`
PublishedAt string `json:"published_at"`
HtmlUrl string `json:"html_url"`
Draft bool `json:"draft"`
PreRelease bool `json:"prerelease"`
Reactions struct {
Downvotes int `json:"-1"`
} `json:"reactions"`
}
func parseGithubTime(t string) time.Time {
parsedTime, err := time.Parse("2006-01-02T15:04:05Z", t)
if err != nil {
return time.Now()
}
return parsedTime
}
func FetchLatestReleasesFromGithub(repositories []string, token string) (AppReleases, error) {
appReleases := make(AppReleases, 0, len(repositories))
if len(repositories) == 0 {
return appReleases, nil
}
requests := make([]*http.Request, len(repositories))
for i, repository := range repositories {
request, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/repos/%s/releases?per_page=10", repository), nil)
if token != "" {
request.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
}
requests[i] = request
}
task := decodeJsonFromRequestTask[[]githubReleaseResponseJson](defaultClient)
job := newJob(task, requests).withWorkers(15)
responses, errs, err := workerPoolDo(job)
if err != nil {
return nil, err
}
var failed int
for i := range responses {
if errs[i] != nil {
failed++
slog.Error("Failed to fetch or parse github release", "error", errs[i], "url", requests[i].URL)
continue
}
releases := responses[i]
if len(releases) < 1 {
failed++
slog.Error("No releases found", "repository", repositories[i], "url", requests[i].URL)
continue
}
var liveRelease *githubReleaseResponseJson
for i := range releases {
release := &releases[i]
if !release.Draft && !release.PreRelease {
liveRelease = release
break
}
}
if liveRelease == nil {
slog.Error("No live release found", "repository", repositories[i], "url", requests[i].URL)
continue
}
version := liveRelease.TagName
if version[0] != 'v' {
version = "v" + version
}
appReleases = append(appReleases, AppRelease{
Name: repositories[i],
Version: version,
NotesUrl: liveRelease.HtmlUrl,
TimeReleased: parseGithubTime(liveRelease.PublishedAt),
Downvotes: liveRelease.Reactions.Downvotes,
})
}
if len(appReleases) == 0 {
return nil, ErrNoContent
}
appReleases.SortByNewest()
if failed > 0 {
return appReleases, fmt.Errorf("%w: could not get %d releases", ErrPartialContent, failed)
}
return appReleases, nil
}
type GithubTicket struct {
Number int
CreatedAt time.Time
Title string
}
type RepositoryDetails struct {
Name string
Stars int
Forks int
OpenPullRequests int
PullRequests []GithubTicket
OpenIssues int
Issues []GithubTicket
}
type githubRepositoryDetailsResponseJson struct {
Name string `json:"full_name"`
Stars int `json:"stargazers_count"`
Forks int `json:"forks_count"`
}
type githubTicketResponseJson struct {
Count int `json:"total_count"`
Tickets []struct {
Number int `json:"number"`
CreatedAt string `json:"created_at"`
Title string `json:"title"`
} `json:"items"`
}
func FetchRepositoryDetailsFromGithub(repository string, token string, maxPRs int, maxIssues int) (RepositoryDetails, error) {
repositoryRequest, err := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/repos/%s", repository), nil)
if err != nil {
return RepositoryDetails{}, fmt.Errorf("%w: could not create request with repository: %v", ErrNoContent, err)
}
PRsRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/search/issues?q=is:pr+is:open+repo:%s&per_page=%d", repository, maxPRs), nil)
issuesRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/search/issues?q=is:issue+is:open+repo:%s&per_page=%d", repository, maxIssues), nil)
if token != "" {
token = fmt.Sprintf("Bearer %s", token)
repositoryRequest.Header.Add("Authorization", token)
PRsRequest.Header.Add("Authorization", token)
issuesRequest.Header.Add("Authorization", token)
}
var detailsResponse githubRepositoryDetailsResponseJson
var detailsErr error
var PRsResponse githubTicketResponseJson
var PRsErr error
var issuesResponse githubTicketResponseJson
var issuesErr error
var wg sync.WaitGroup
wg.Add(1)
go (func() {
defer wg.Done()
detailsResponse, detailsErr = decodeJsonFromRequest[githubRepositoryDetailsResponseJson](defaultClient, repositoryRequest)
})()
if maxPRs > 0 {
wg.Add(1)
go (func() {
defer wg.Done()
PRsResponse, PRsErr = decodeJsonFromRequest[githubTicketResponseJson](defaultClient, PRsRequest)
})()
}
if maxIssues > 0 {
wg.Add(1)
go (func() {
defer wg.Done()
issuesResponse, issuesErr = decodeJsonFromRequest[githubTicketResponseJson](defaultClient, issuesRequest)
})()
}
wg.Wait()
if detailsErr != nil {
return RepositoryDetails{}, fmt.Errorf("%w: could not get repository details: %s", ErrNoContent, detailsErr)
}
details := RepositoryDetails{
Name: detailsResponse.Name,
Stars: detailsResponse.Stars,
Forks: detailsResponse.Forks,
PullRequests: make([]GithubTicket, 0, len(PRsResponse.Tickets)),
Issues: make([]GithubTicket, 0, len(issuesResponse.Tickets)),
}
err = nil
if maxPRs > 0 {
if PRsErr != nil {
err = fmt.Errorf("%w: could not get PRs: %s", ErrPartialContent, PRsErr)
} else {
details.OpenPullRequests = PRsResponse.Count
for i := range PRsResponse.Tickets {
details.PullRequests = append(details.PullRequests, GithubTicket{
Number: PRsResponse.Tickets[i].Number,
CreatedAt: parseGithubTime(PRsResponse.Tickets[i].CreatedAt),
Title: PRsResponse.Tickets[i].Title,
})
}
}
}
if maxIssues > 0 {
if issuesErr != nil {
// TODO: fix, overwriting the previous error
err = fmt.Errorf("%w: could not get issues: %s", ErrPartialContent, issuesErr)
} else {
details.OpenIssues = issuesResponse.Count
for i := range issuesResponse.Tickets {
details.Issues = append(details.Issues, GithubTicket{
Number: issuesResponse.Tickets[i].Number,
CreatedAt: parseGithubTime(issuesResponse.Tickets[i].CreatedAt),
Title: issuesResponse.Tickets[i].Title,
})
}
}
}
return details, err
}
-98
View File
@@ -1,98 +0,0 @@
package feed
import (
"fmt"
"log/slog"
"net/http"
"strconv"
"strings"
"time"
)
type hackerNewsPostResponseJson struct {
Id int `json:"id"`
Score int `json:"score"`
Title string `json:"title"`
TargetUrl string `json:"url,omitempty"`
CommentCount int `json:"descendants"`
TimePosted int64 `json:"time"`
}
func getHackerNewsPostIds(sort string) ([]int, error) {
request, _ := http.NewRequest("GET", fmt.Sprintf("https://hacker-news.firebaseio.com/v0/%sstories.json", sort), nil)
response, err := decodeJsonFromRequest[[]int](defaultClient, request)
if err != nil {
return nil, fmt.Errorf("%w: could not fetch list of post IDs", ErrNoContent)
}
return response, nil
}
func getHackerNewsPostsFromIds(postIds []int, commentsUrlTemplate string) (ForumPosts, error) {
requests := make([]*http.Request, len(postIds))
for i, id := range postIds {
request, _ := http.NewRequest("GET", fmt.Sprintf("https://hacker-news.firebaseio.com/v0/item/%d.json", id), nil)
requests[i] = request
}
task := decodeJsonFromRequestTask[hackerNewsPostResponseJson](defaultClient)
job := newJob(task, requests).withWorkers(30)
results, errs, err := workerPoolDo(job)
if err != nil {
return nil, err
}
posts := make(ForumPosts, 0, len(postIds))
for i := range results {
if errs[i] != nil {
slog.Error("Failed to fetch or parse hacker news post", "error", errs[i], "url", requests[i].URL)
continue
}
var commentsUrl string
if commentsUrlTemplate == "" {
commentsUrl = "https://news.ycombinator.com/item?id=" + strconv.Itoa(results[i].Id)
} else {
commentsUrl = strings.ReplaceAll(commentsUrlTemplate, "{POST-ID}", strconv.Itoa(results[i].Id))
}
posts = append(posts, ForumPost{
Title: results[i].Title,
DiscussionUrl: commentsUrl,
TargetUrl: results[i].TargetUrl,
TargetUrlDomain: extractDomainFromUrl(results[i].TargetUrl),
CommentCount: results[i].CommentCount,
Score: results[i].Score,
TimePosted: time.Unix(results[i].TimePosted, 0),
})
}
if len(posts) == 0 {
return nil, ErrNoContent
}
if len(posts) != len(postIds) {
return posts, fmt.Errorf("%w could not fetch some hacker news posts", ErrPartialContent)
}
return posts, nil
}
func FetchHackerNewsPosts(sort string, limit int, commentsUrlTemplate string) (ForumPosts, error) {
postIds, err := getHackerNewsPostIds(sort)
if err != nil {
return nil, err
}
if len(postIds) > limit {
postIds = postIds[:limit]
}
return getHackerNewsPostsFromIds(postIds, commentsUrlTemplate)
}
-51
View File
@@ -1,51 +0,0 @@
package feed
import (
"context"
"errors"
"net/http"
"time"
)
type SiteStatus struct {
Code int
TimedOut bool
ResponseTime time.Duration
Error error
}
func getSiteStatusTask(request *http.Request) (SiteStatus, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
defer cancel()
request = request.WithContext(ctx)
start := time.Now()
response, err := http.DefaultClient.Do(request)
took := time.Since(start)
status := SiteStatus{ResponseTime: took}
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
status.TimedOut = true
}
status.Error = err
return status, err
}
defer response.Body.Close()
status.Code = response.StatusCode
return status, nil
}
func FetchStatusesForRequests(requests []*http.Request) ([]SiteStatus, error) {
job := newJob(getSiteStatusTask, requests).withWorkers(20)
results, _, err := workerPoolDo(job)
if err != nil {
return nil, err
}
return results, nil
}
-211
View File
@@ -1,211 +0,0 @@
package feed
import (
"math"
"sort"
"time"
)
type ForumPost struct {
Title string
DiscussionUrl string
TargetUrl string
TargetUrlDomain string
ThumbnailUrl string
CommentCount int
Score int
Engagement float64
TimePosted time.Time
}
type ForumPosts []ForumPost
type Calendar struct {
CurrentDay int
CurrentWeekNumber int
CurrentMonthName string
CurrentYear int
Days []int
}
type Weather struct {
Temperature int
ApparentTemperature int
WeatherCode int
CurrentColumn int
SunriseColumn int
SunsetColumn int
Columns []weatherColumn
}
type AppRelease struct {
Name string
Version string
NotesUrl string
TimeReleased time.Time
Downvotes int
}
type AppReleases []AppRelease
type Video struct {
ThumbnailUrl string
Title string
Url string
Author string
AuthorUrl string
TimePosted time.Time
}
type Videos []Video
var currencyToSymbol = map[string]string{
"USD": "$",
"EUR": "€",
"JPY": "¥",
"CAD": "C$",
"AUD": "A$",
"GBP": "£",
"CHF": "Fr",
"NZD": "N$",
"INR": "₹",
"BRL": "R$",
"RUB": "₽",
"TRY": "₺",
"ZAR": "R",
"CNY": "¥",
"KRW": "₩",
"HKD": "HK$",
"SGD": "S$",
"SEK": "kr",
"NOK": "kr",
"DKK": "kr",
"PLN": "zł",
"PHP": "₱",
}
type Stock struct {
Name string `yaml:"name"`
Symbol string `yaml:"symbol"`
ChartLink string `yaml:"chart-link"`
SymbolLink string `yaml:"symbol-link"`
Currency string `yaml:"-"`
Price float64 `yaml:"-"`
PercentChange float64 `yaml:"-"`
SvgChartPoints string `yaml:"-"`
}
type Stocks []Stock
func (t Stocks) SortByAbsChange() {
sort.Slice(t, func(i, j int) bool {
return math.Abs(t[i].PercentChange) > math.Abs(t[j].PercentChange)
})
}
var weatherCodeTable = map[int]string{
0: "Clear Sky",
1: "Mainly Clear",
2: "Partly Cloudy",
3: "Overcast",
45: "Fog",
48: "Rime Fog",
51: "Drizzle",
53: "Drizzle",
55: "Drizzle",
56: "Drizzle",
57: "Drizzle",
61: "Rain",
63: "Moderate Rain",
65: "Heavy Rain",
66: "Freezing Rain",
67: "Freezing Rain",
71: "Snow",
73: "Moderate Snow",
75: "Heavy Snow",
77: "Snow Grains",
80: "Rain",
81: "Moderate Rain",
82: "Heavy Rain",
85: "Snow",
86: "Snow",
95: "Thunderstorm",
96: "Thunderstorm",
99: "Thunderstorm",
}
func (w *Weather) WeatherCodeAsString() string {
if weatherCode, ok := weatherCodeTable[w.WeatherCode]; ok {
return weatherCode
}
return ""
}
const depreciatePostsOlderThanHours = 7
const maxDepreciation = 0.9
const maxDepreciationAfterHours = 24
func (p ForumPosts) CalculateEngagement() {
var totalComments int
var totalScore int
for i := range p {
totalComments += p[i].CommentCount
totalScore += p[i].Score
}
numberOfPosts := float64(len(p))
averageComments := float64(totalComments) / numberOfPosts
averageScore := float64(totalScore) / numberOfPosts
for i := range p {
p[i].Engagement = (float64(p[i].CommentCount)/averageComments + float64(p[i].Score)/averageScore) / 2
elapsed := time.Since(p[i].TimePosted)
if elapsed < time.Hour*depreciatePostsOlderThanHours {
continue
}
p[i].Engagement *= 1.0 - (math.Max(elapsed.Hours()-depreciatePostsOlderThanHours, maxDepreciationAfterHours)/maxDepreciationAfterHours)*maxDepreciation
}
}
func (p ForumPosts) SortByEngagement() {
sort.Slice(p, func(i, j int) bool {
return p[i].Engagement > p[j].Engagement
})
}
func (s *ForumPost) HasTargetUrl() bool {
return s.TargetUrl != ""
}
func (p ForumPosts) FilterPostedBefore(postedBefore time.Duration) []ForumPost {
recent := make([]ForumPost, 0, len(p))
for i := range p {
if time.Since(p[i].TimePosted) < postedBefore {
recent = append(recent, p[i])
}
}
return recent
}
func (r AppReleases) SortByNewest() AppReleases {
sort.Slice(r, func(i, j int) bool {
return r[i].TimeReleased.After(r[j].TimeReleased)
})
return r
}
func (v Videos) SortByNewest() Videos {
sort.Slice(v, func(i, j int) bool {
return v[i].TimePosted.After(v[j].TimePosted)
})
return v
}
-114
View File
@@ -1,114 +0,0 @@
package feed
import (
"fmt"
"html"
"net/http"
"net/url"
"strings"
"time"
)
type subredditResponseJson struct {
Data struct {
Children []struct {
Data struct {
Id string `json:"id"`
Title string `json:"title"`
Upvotes int `json:"ups"`
Url string `json:"url"`
Time float64 `json:"created"`
CommentsCount int `json:"num_comments"`
Domain string `json:"domain"`
Permalink string `json:"permalink"`
Stickied bool `json:"stickied"`
Pinned bool `json:"pinned"`
IsSelf bool `json:"is_self"`
Thumbnail string `json:"thumbnail"`
} `json:"data"`
} `json:"children"`
} `json:"data"`
}
func FetchSubredditPosts(subreddit, sort, topPeriod, search, commentsUrlTemplate, requestUrlTemplate string) (ForumPosts, error) {
query := url.Values{}
var requestUrl string
if search != "" {
query.Set("q", search+" subreddit:"+subreddit)
query.Set("sort", sort)
}
if sort == "top" {
query.Set("t", topPeriod)
}
if search != "" {
requestUrl = fmt.Sprintf("https://www.reddit.com/search.json?%s", query.Encode())
} else {
requestUrl = fmt.Sprintf("https://www.reddit.com/r/%s/%s.json?%s", subreddit, sort, query.Encode())
}
if requestUrlTemplate != "" {
requestUrl = strings.ReplaceAll(requestUrlTemplate, "{REQUEST-URL}", requestUrl)
}
request, err := http.NewRequest("GET", requestUrl, nil)
if err != nil {
return nil, err
}
// Required to increase rate limit, otherwise Reddit randomly returns 429 even after just 2 requests
addBrowserUserAgentHeader(request)
responseJson, err := decodeJsonFromRequest[subredditResponseJson](defaultClient, request)
if err != nil {
return nil, err
}
if len(responseJson.Data.Children) == 0 {
return nil, fmt.Errorf("no posts found")
}
posts := make(ForumPosts, 0, len(responseJson.Data.Children))
for i := range responseJson.Data.Children {
post := &responseJson.Data.Children[i].Data
if post.Stickied || post.Pinned {
continue
}
var commentsUrl string
if commentsUrlTemplate == "" {
commentsUrl = "https://www.reddit.com" + post.Permalink
} else {
commentsUrl = strings.ReplaceAll(commentsUrlTemplate, "{SUBREDDIT}", subreddit)
commentsUrl = strings.ReplaceAll(commentsUrl, "{POST-ID}", post.Id)
commentsUrl = strings.ReplaceAll(commentsUrl, "{POST-PATH}", strings.TrimLeft(post.Permalink, "/"))
}
forumPost := ForumPost{
Title: html.UnescapeString(post.Title),
DiscussionUrl: commentsUrl,
TargetUrlDomain: post.Domain,
CommentCount: post.CommentsCount,
Score: post.Upvotes,
TimePosted: time.Unix(int64(post.Time), 0),
}
if post.Thumbnail != "" && post.Thumbnail != "self" && post.Thumbnail != "default" {
forumPost.ThumbnailUrl = post.Thumbnail
}
if !post.IsSelf {
forumPost.TargetUrl = post.Url
}
posts = append(posts, forumPost)
}
return posts, nil
}
-117
View File
@@ -1,117 +0,0 @@
package feed
import (
"context"
"fmt"
"log/slog"
"sort"
"time"
"github.com/mmcdole/gofeed"
)
type RSSFeedItem struct {
ChannelName string
ChannelURL string
Title string
Link string
ImageURL string
PublishedAt time.Time
}
type RSSFeedRequest struct {
Url string `yaml:"url"`
Title string `yaml:"title"`
}
type RSSFeedItems []RSSFeedItem
func (f RSSFeedItems) SortByNewest() RSSFeedItems {
sort.Slice(f, func(i, j int) bool {
return f[i].PublishedAt.After(f[j].PublishedAt)
})
return f
}
var feedParser = gofeed.NewParser()
func getItemsFromRSSFeedTask(request RSSFeedRequest) ([]RSSFeedItem, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
feed, err := feedParser.ParseURLWithContext(request.Url, ctx)
if err != nil {
return nil, err
}
items := make(RSSFeedItems, 0, len(feed.Items))
for i := range feed.Items {
item := feed.Items[i]
rssItem := RSSFeedItem{
ChannelURL: feed.Link,
Title: item.Title,
Link: item.Link,
}
if request.Title != "" {
rssItem.ChannelName = request.Title
} else {
rssItem.ChannelName = feed.Title
}
if item.Image != nil {
rssItem.ImageURL = item.Image.URL
} else if feed.Image != nil {
rssItem.ImageURL = feed.Image.URL
}
if item.PublishedParsed != nil {
rssItem.PublishedAt = *item.PublishedParsed
} else {
rssItem.PublishedAt = time.Now()
}
items = append(items, rssItem)
}
return items, nil
}
func GetItemsFromRSSFeeds(requests []RSSFeedRequest) (RSSFeedItems, error) {
job := newJob(getItemsFromRSSFeedTask, requests).withWorkers(10)
feeds, errs, err := workerPoolDo(job)
if err != nil {
return nil, fmt.Errorf("%w: %v", ErrNoContent, err)
}
failed := 0
entries := make(RSSFeedItems, 0, len(feeds)*10)
for i := range feeds {
if errs[i] != nil {
failed++
slog.Error("failed to get rss feed", "error", errs[i], "url", requests[i].Url)
continue
}
entries = append(entries, feeds[i]...)
}
if len(entries) == 0 {
return nil, ErrNoContent
}
entries.SortByNewest()
if failed > 0 {
return entries, fmt.Errorf("%w: missing %d RSS feeds", ErrPartialContent, failed)
}
return entries, nil
}
-254
View File
@@ -1,254 +0,0 @@
package feed
import (
"encoding/json"
"errors"
"fmt"
"log/slog"
"net/http"
"slices"
"sort"
"strings"
"time"
)
type TwitchCategory struct {
Slug string `json:"slug"`
Name string `json:"name"`
AvatarUrl string `json:"avatarURL"`
ViewersCount int `json:"viewersCount"`
Tags []struct {
Name string `json:"tagName"`
} `json:"tags"`
GameReleaseDate string `json:"originalReleaseDate"`
IsNew bool `json:"-"`
}
type TwitchChannel struct {
Login string
Exists bool
Name string
AvatarUrl string
IsLive bool
LiveSince time.Time
Category string
CategorySlug string
ViewersCount int
}
type TwitchChannels []TwitchChannel
func (channels TwitchChannels) SortByViewers() {
sort.Slice(channels, func(i, j int) bool {
return channels[i].ViewersCount > channels[j].ViewersCount
})
}
func (channels TwitchChannels) SortByLive() {
sort.SliceStable(channels, func(i, j int) bool {
return channels[i].IsLive && !channels[j].IsLive
})
}
type twitchOperationResponse struct {
Data json.RawMessage
Extensions struct {
OperationName string `json:"operationName"`
}
}
type twitchChannelShellOperationResponse struct {
UserOrError struct {
Type string `json:"__typename"`
DisplayName string `json:"displayName"`
ProfileImageUrl string `json:"profileImageURL"`
Stream *struct {
ViewersCount int `json:"viewersCount"`
}
} `json:"userOrError"`
}
type twitchStreamMetadataOperationResponse struct {
UserOrNull *struct {
Stream *struct {
StartedAt string `json:"createdAt"`
Game *struct {
Slug string `json:"slug"`
Name string `json:"name"`
} `json:"game"`
} `json:"stream"`
} `json:"user"`
}
type twitchDirectoriesOperationResponse struct {
Data struct {
DirectoriesWithTags struct {
Edges []struct {
Node TwitchCategory `json:"node"`
} `json:"edges"`
} `json:"directoriesWithTags"`
} `json:"data"`
}
const twitchGqlEndpoint = "https://gql.twitch.tv/gql"
const twitchGqlClientId = "kimne78kx3ncx6brgo4mv6wki5h1ko"
const twitchDirectoriesOperationRequestBody = `[{"operationName": "BrowsePage_AllDirectories","variables": {"limit": %d,"options": {"sort": "VIEWER_COUNT","tags": []}},"extensions": {"persistedQuery": {"version": 1,"sha256Hash": "2f67f71ba89f3c0ed26a141ec00da1defecb2303595f5cda4298169549783d9e"}}}]`
func FetchTopGamesFromTwitch(exclude []string, limit int) ([]TwitchCategory, error) {
reader := strings.NewReader(fmt.Sprintf(twitchDirectoriesOperationRequestBody, len(exclude)+limit))
request, _ := http.NewRequest("POST", twitchGqlEndpoint, reader)
request.Header.Add("Client-ID", twitchGqlClientId)
response, err := decodeJsonFromRequest[[]twitchDirectoriesOperationResponse](defaultClient, request)
if err != nil {
return nil, err
}
if len(response) == 0 {
return nil, errors.New("no categories could be retrieved")
}
edges := (response)[0].Data.DirectoriesWithTags.Edges
categories := make([]TwitchCategory, 0, len(edges))
for i := range edges {
if slices.Contains(exclude, edges[i].Node.Slug) {
continue
}
category := &edges[i].Node
category.AvatarUrl = strings.Replace(category.AvatarUrl, "285x380", "144x192", 1)
if len(category.Tags) > 2 {
category.Tags = category.Tags[:2]
}
gameReleasedDate, err := time.Parse("2006-01-02T15:04:05Z", category.GameReleaseDate)
if err == nil {
if time.Since(gameReleasedDate) < 14*24*time.Hour {
category.IsNew = true
}
}
categories = append(categories, *category)
}
if len(categories) > limit {
categories = categories[:limit]
}
return categories, nil
}
const twitchChannelStatusOperationRequestBody = `[{"operationName":"ChannelShell","variables":{"login":"%s"},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"580ab410bcd0c1ad194224957ae2241e5d252b2c5173d8e0cce9d32d5bb14efe"}}},{"operationName":"StreamMetadata","variables":{"channelLogin":"%s"},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"676ee2f834ede42eb4514cdb432b3134fefc12590080c9a2c9bb44a2a4a63266"}}}]`
// TODO: rework
// The operations for multiple channels can all be sent in a single request
// rather than sending a separate request for each channel. Need to figure out
// what the limit is for max operations per request and batch operations in
// multiple requests if number of channels exceeds allowed limit.
func fetchChannelFromTwitchTask(channel string) (TwitchChannel, error) {
result := TwitchChannel{
Login: strings.ToLower(channel),
}
reader := strings.NewReader(fmt.Sprintf(twitchChannelStatusOperationRequestBody, channel, channel))
request, _ := http.NewRequest("POST", twitchGqlEndpoint, reader)
request.Header.Add("Client-ID", twitchGqlClientId)
response, err := decodeJsonFromRequest[[]twitchOperationResponse](defaultClient, request)
if err != nil {
return result, err
}
if len(response) != 2 {
return result, fmt.Errorf("expected 2 operation responses, got %d", len(response))
}
var channelShell twitchChannelShellOperationResponse
var streamMetadata twitchStreamMetadataOperationResponse
for i := range response {
switch response[i].Extensions.OperationName {
case "ChannelShell":
err = json.Unmarshal(response[i].Data, &channelShell)
if err != nil {
return result, fmt.Errorf("failed to unmarshal channel shell: %w", err)
}
case "StreamMetadata":
err = json.Unmarshal(response[i].Data, &streamMetadata)
if err != nil {
return result, fmt.Errorf("failed to unmarshal stream metadata: %w", err)
}
default:
return result, fmt.Errorf("unknown operation name: %s", response[i].Extensions.OperationName)
}
}
if channelShell.UserOrError.Type != "User" {
result.Name = result.Login
return result, nil
}
result.Exists = true
result.Name = channelShell.UserOrError.DisplayName
result.AvatarUrl = channelShell.UserOrError.ProfileImageUrl
if channelShell.UserOrError.Stream != nil {
result.IsLive = true
result.ViewersCount = channelShell.UserOrError.Stream.ViewersCount
if streamMetadata.UserOrNull != nil && streamMetadata.UserOrNull.Stream != nil && streamMetadata.UserOrNull.Stream.Game != nil {
result.Category = streamMetadata.UserOrNull.Stream.Game.Name
result.CategorySlug = streamMetadata.UserOrNull.Stream.Game.Slug
startedAt, err := time.Parse("2006-01-02T15:04:05Z", streamMetadata.UserOrNull.Stream.StartedAt)
if err == nil {
result.LiveSince = startedAt
} else {
slog.Warn("failed to parse twitch stream started at", "error", err, "started_at", streamMetadata.UserOrNull.Stream.StartedAt)
}
}
}
return result, nil
}
func FetchChannelsFromTwitch(channelLogins []string) (TwitchChannels, error) {
result := make(TwitchChannels, 0, len(channelLogins))
job := newJob(fetchChannelFromTwitchTask, channelLogins).withWorkers(10)
channels, errs, err := workerPoolDo(job)
if err != nil {
return result, err
}
var failed int
for i := range channels {
if errs[i] != nil {
failed++
slog.Warn("failed to fetch twitch channel", "channel", channelLogins[i], "error", errs[i])
continue
}
result = append(result, channels[i])
}
if failed == len(channelLogins) {
return result, ErrNoContent
}
if failed > 0 {
return result, fmt.Errorf("%w: failed to fetch %d channels", ErrPartialContent, failed)
}
return result, nil
}
-79
View File
@@ -1,79 +0,0 @@
package feed
import (
"errors"
"fmt"
"net/url"
"slices"
"strings"
)
var (
ErrNoContent = errors.New("failed to retrieve any content")
ErrPartialContent = errors.New("failed to retrieve some of the content")
)
func percentChange(current, previous float64) float64 {
return (current/previous - 1) * 100
}
func extractDomainFromUrl(u string) string {
if u == "" {
return ""
}
parsed, err := url.Parse(u)
if err != nil {
return ""
}
return strings.TrimPrefix(strings.ToLower(parsed.Host), "www.")
}
func SvgPolylineCoordsFromYValues(width float64, height float64, values []float64) string {
if len(values) < 2 {
return ""
}
verticalPadding := height * 0.02
height -= verticalPadding * 2
coordinates := make([]string, len(values))
distanceBetweenPoints := width / float64(len(values)-1)
min := slices.Min(values)
max := slices.Max(values)
for i := range values {
coordinates[i] = fmt.Sprintf(
"%.2f,%.2f",
float64(i)*distanceBetweenPoints,
((max-values[i])/(max-min))*height+verticalPadding,
)
}
return strings.Join(coordinates, " ")
}
func maybeCopySliceWithoutZeroValues[T int | float64](values []T) []T {
if len(values) == 0 {
return values
}
for i := range values {
if values[i] != 0 {
continue
}
c := make([]T, 0, len(values)-1)
for i := range values {
if values[i] != 0 {
c = append(c, values[i])
}
}
return c
}
return values
}
-107
View File
@@ -1,107 +0,0 @@
package feed
import (
"fmt"
"log/slog"
"net/http"
)
type stockResponseJson struct {
Chart struct {
Result []struct {
Meta struct {
Currency string `json:"currency"`
Symbol string `json:"symbol"`
RegularMarketPrice float64 `json:"regularMarketPrice"`
ChartPreviousClose float64 `json:"chartPreviousClose"`
} `json:"meta"`
Indicators struct {
Quote []struct {
Close []float64 `json:"close,omitempty"`
} `json:"quote"`
} `json:"indicators"`
} `json:"result"`
} `json:"chart"`
}
// TODO: allow changing chart time frame
const stockChartDays = 21
func FetchStocksDataFromYahoo(stockRequests Stocks) (Stocks, error) {
requests := make([]*http.Request, 0, len(stockRequests))
for i := range stockRequests {
request, _ := http.NewRequest("GET", fmt.Sprintf("https://query1.finance.yahoo.com/v8/finance/chart/%s?range=1mo&interval=1d", stockRequests[i].Symbol), nil)
requests = append(requests, request)
}
job := newJob(decodeJsonFromRequestTask[stockResponseJson](defaultClient), requests)
responses, errs, err := workerPoolDo(job)
if err != nil {
return nil, fmt.Errorf("%w: %v", ErrNoContent, err)
}
stocks := make(Stocks, 0, len(responses))
var failed int
for i := range responses {
if errs[i] != nil {
failed++
slog.Error("Failed to fetch stock data", "symbol", stockRequests[i].Symbol, "error", errs[i])
continue
}
response := responses[i]
if len(response.Chart.Result) == 0 {
failed++
slog.Error("Stock response contains no data", "symbol", stockRequests[i].Symbol)
continue
}
prices := response.Chart.Result[0].Indicators.Quote[0].Close
if len(prices) > stockChartDays {
prices = prices[len(prices)-stockChartDays:]
}
previous := response.Chart.Result[0].Meta.RegularMarketPrice
if len(prices) >= 2 && prices[len(prices)-2] != 0 {
previous = prices[len(prices)-2]
}
points := SvgPolylineCoordsFromYValues(100, 50, maybeCopySliceWithoutZeroValues(prices))
currency, exists := currencyToSymbol[response.Chart.Result[0].Meta.Currency]
if !exists {
currency = response.Chart.Result[0].Meta.Currency
}
stocks = append(stocks, Stock{
Name: stockRequests[i].Name,
Symbol: response.Chart.Result[0].Meta.Symbol,
SymbolLink: stockRequests[i].SymbolLink,
ChartLink: stockRequests[i].ChartLink,
Price: response.Chart.Result[0].Meta.RegularMarketPrice,
Currency: currency,
PercentChange: percentChange(
response.Chart.Result[0].Meta.RegularMarketPrice,
previous,
),
SvgChartPoints: points,
})
}
if len(stocks) == 0 {
return nil, ErrNoContent
}
if failed > 0 {
return stocks, fmt.Errorf("%w: could not fetch data for %d stock(s)", ErrPartialContent, failed)
}
return stocks, nil
}
-115
View File
@@ -1,115 +0,0 @@
package feed
import (
"fmt"
"log/slog"
"net/http"
"net/url"
"strings"
"time"
)
type youtubeFeedResponseXml struct {
Channel string `xml:"title"`
ChannelLink struct {
Href string `xml:"href,attr"`
} `xml:"link"`
Videos []struct {
Title string `xml:"title"`
Published string `xml:"published"`
Link struct {
Href string `xml:"href,attr"`
} `xml:"link"`
Group struct {
Thumbnail struct {
Url string `xml:"url,attr"`
} `xml:"http://search.yahoo.com/mrss/ thumbnail"`
} `xml:"http://search.yahoo.com/mrss/ group"`
} `xml:"entry"`
}
func parseYoutubeFeedTime(t string) time.Time {
parsedTime, err := time.Parse("2006-01-02T15:04:05-07:00", t)
if err != nil {
return time.Now()
}
return parsedTime
}
func FetchYoutubeChannelUploads(channelIds []string, videoUrlTemplate string) (Videos, error) {
requests := make([]*http.Request, 0, len(channelIds))
for i := range channelIds {
request, _ := http.NewRequest("GET", "https://www.youtube.com/feeds/videos.xml?channel_id="+channelIds[i], nil)
requests = append(requests, request)
}
job := newJob(decodeXmlFromRequestTask[youtubeFeedResponseXml](defaultClient), requests).withWorkers(30)
responses, errs, err := workerPoolDo(job)
if err != nil {
return nil, fmt.Errorf("%w: %v", ErrNoContent, err)
}
videos := make(Videos, 0, len(channelIds)*15)
var failed int
for i := range responses {
if errs[i] != nil {
failed++
slog.Error("Failed to fetch youtube feed", "channel", channelIds[i], "error", errs[i])
continue
}
response := responses[i]
for j := range response.Videos {
video := &response.Videos[j]
// TODO: figure out a better way of skipping shorts
if strings.Contains(video.Title, "#shorts") {
continue
}
var videoUrl string
if videoUrlTemplate == "" {
videoUrl = video.Link.Href
} else {
parsedUrl, err := url.Parse(video.Link.Href)
if err == nil {
videoUrl = strings.ReplaceAll(videoUrlTemplate, "{VIDEO-ID}", parsedUrl.Query().Get("v"))
} else {
videoUrl = "#"
}
}
videos = append(videos, Video{
ThumbnailUrl: video.Group.Thumbnail.Url,
Title: video.Title,
Url: videoUrl,
Author: response.Channel,
AuthorUrl: response.ChannelLink.Href + "/videos",
TimePosted: parseYoutubeFeedTime(video.Published),
})
}
}
if len(videos) == 0 {
return nil, ErrNoContent
}
videos.SortByNewest()
if failed > 0 {
return videos, fmt.Errorf("%w: missing videos from %d channels", ErrPartialContent, failed)
}
return videos, nil
}
+343
View File
@@ -0,0 +1,343 @@
package glance
import (
"bytes"
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/binary"
"encoding/json"
"fmt"
"io"
"log"
mathrand "math/rand/v2"
"net/http"
"strconv"
"strings"
"time"
"golang.org/x/crypto/bcrypt"
)
const AUTH_SESSION_COOKIE_NAME = "session_token"
const AUTH_RATE_LIMIT_WINDOW = 5 * time.Minute
const AUTH_RATE_LIMIT_MAX_ATTEMPTS = 5
const AUTH_TOKEN_SECRET_LENGTH = 32
const AUTH_USERNAME_HASH_LENGTH = 32
const AUTH_SECRET_KEY_LENGTH = AUTH_TOKEN_SECRET_LENGTH + AUTH_USERNAME_HASH_LENGTH
const AUTH_TIMESTAMP_LENGTH = 4 // uint32
const AUTH_TOKEN_DATA_LENGTH = AUTH_USERNAME_HASH_LENGTH + AUTH_TIMESTAMP_LENGTH
// How long the token will be valid for
const AUTH_TOKEN_VALID_PERIOD = 14 * 24 * time.Hour // 14 days
// How long the token has left before it should be regenerated
const AUTH_TOKEN_REGEN_BEFORE = 7 * 24 * time.Hour // 7 days
var loginPageTemplate = mustParseTemplate("login.html", "document.html", "footer.html")
type doWhenUnauthorized int
const (
redirectToLogin doWhenUnauthorized = iota
showUnauthorizedJSON
)
type failedAuthAttempt struct {
attempts int
first time.Time
}
func generateSessionToken(username string, secret []byte, now time.Time) (string, error) {
if len(secret) != AUTH_SECRET_KEY_LENGTH {
return "", fmt.Errorf("secret key length is not %d bytes", AUTH_SECRET_KEY_LENGTH)
}
usernameHash, err := computeUsernameHash(username, secret)
if err != nil {
return "", err
}
data := make([]byte, AUTH_TOKEN_DATA_LENGTH)
copy(data, usernameHash)
expires := now.Add(AUTH_TOKEN_VALID_PERIOD).Unix()
binary.LittleEndian.PutUint32(data[AUTH_USERNAME_HASH_LENGTH:], uint32(expires))
h := hmac.New(sha256.New, secret[0:AUTH_TOKEN_SECRET_LENGTH])
h.Write(data)
signature := h.Sum(nil)
encodedToken := base64.StdEncoding.EncodeToString(append(data, signature...))
// encodedToken ends up being (hashed username + expiration timestamp + signature) encoded as base64
return encodedToken, nil
}
func computeUsernameHash(username string, secret []byte) ([]byte, error) {
if len(secret) != AUTH_SECRET_KEY_LENGTH {
return nil, fmt.Errorf("secret key length is not %d bytes", AUTH_SECRET_KEY_LENGTH)
}
h := hmac.New(sha256.New, secret[AUTH_TOKEN_SECRET_LENGTH:])
h.Write([]byte(username))
return h.Sum(nil), nil
}
func verifySessionToken(token string, secretBytes []byte, now time.Time) ([]byte, bool, error) {
tokenBytes, err := base64.StdEncoding.DecodeString(token)
if err != nil {
return nil, false, err
}
if len(tokenBytes) != AUTH_TOKEN_DATA_LENGTH+32 {
return nil, false, fmt.Errorf("token length is invalid")
}
if len(secretBytes) != AUTH_SECRET_KEY_LENGTH {
return nil, false, fmt.Errorf("secret key length is not %d bytes", AUTH_SECRET_KEY_LENGTH)
}
usernameHashBytes := tokenBytes[0:AUTH_USERNAME_HASH_LENGTH]
timestampBytes := tokenBytes[AUTH_USERNAME_HASH_LENGTH : AUTH_USERNAME_HASH_LENGTH+AUTH_TIMESTAMP_LENGTH]
providedSignatureBytes := tokenBytes[AUTH_TOKEN_DATA_LENGTH:]
h := hmac.New(sha256.New, secretBytes[0:32])
h.Write(tokenBytes[0:AUTH_TOKEN_DATA_LENGTH])
expectedSignatureBytes := h.Sum(nil)
if !hmac.Equal(expectedSignatureBytes, providedSignatureBytes) {
return nil, false, fmt.Errorf("signature does not match")
}
expiresTimestamp := int64(binary.LittleEndian.Uint32(timestampBytes))
if now.Unix() > expiresTimestamp {
return nil, false, fmt.Errorf("token has expired")
}
return usernameHashBytes,
// True if the token should be regenerated
time.Unix(expiresTimestamp, 0).Add(-AUTH_TOKEN_REGEN_BEFORE).Before(now),
nil
}
func makeAuthSecretKey(length int) (string, error) {
key := make([]byte, length)
_, err := rand.Read(key)
if err != nil {
return "", err
}
return base64.StdEncoding.EncodeToString(key), nil
}
func (a *application) handleAuthenticationAttempt(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Content-Type") != "application/json" {
w.WriteHeader(http.StatusBadRequest)
return
}
waitOnFailure := 1*time.Second - time.Duration(mathrand.IntN(500))*time.Millisecond
ip := a.addressOfRequest(r)
a.authAttemptsMu.Lock()
exceededRateLimit, retryAfter := func() (bool, int) {
attempt, exists := a.failedAuthAttempts[ip]
if !exists {
a.failedAuthAttempts[ip] = &failedAuthAttempt{
attempts: 1,
first: time.Now(),
}
return false, 0
}
elapsed := time.Since(attempt.first)
if elapsed < AUTH_RATE_LIMIT_WINDOW && attempt.attempts >= AUTH_RATE_LIMIT_MAX_ATTEMPTS {
return true, max(1, int(AUTH_RATE_LIMIT_WINDOW.Seconds()-elapsed.Seconds()))
}
attempt.attempts++
return false, 0
}()
if exceededRateLimit {
a.authAttemptsMu.Unlock()
time.Sleep(waitOnFailure)
w.Header().Set("Retry-After", strconv.Itoa(retryAfter))
w.WriteHeader(http.StatusTooManyRequests)
return
} else {
// Clean up old failed attempts
for ipOfAttempt := range a.failedAuthAttempts {
if time.Since(a.failedAuthAttempts[ipOfAttempt].first) > AUTH_RATE_LIMIT_WINDOW {
delete(a.failedAuthAttempts, ipOfAttempt)
}
}
a.authAttemptsMu.Unlock()
}
body, err := io.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}
var creds struct {
Username string `json:"username"`
Password string `json:"password"`
}
err = json.Unmarshal(body, &creds)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}
logAuthFailure := func() {
log.Printf(
"Failed login attempt for user '%s' from %s",
creds.Username, ip,
)
}
if len(creds.Username) == 0 || len(creds.Password) == 0 {
time.Sleep(waitOnFailure)
w.WriteHeader(http.StatusUnauthorized)
return
}
if len(creds.Username) > 50 || len(creds.Password) > 100 {
logAuthFailure()
time.Sleep(waitOnFailure)
w.WriteHeader(http.StatusUnauthorized)
return
}
u, exists := a.Config.Auth.Users[creds.Username]
if !exists {
logAuthFailure()
time.Sleep(waitOnFailure)
w.WriteHeader(http.StatusUnauthorized)
return
}
if err := bcrypt.CompareHashAndPassword(u.PasswordHash, []byte(creds.Password)); err != nil {
logAuthFailure()
time.Sleep(waitOnFailure)
w.WriteHeader(http.StatusUnauthorized)
return
}
token, err := generateSessionToken(creds.Username, a.authSecretKey, time.Now())
if err != nil {
log.Printf("Could not compute session token during login attempt: %v", err)
time.Sleep(waitOnFailure)
w.WriteHeader(http.StatusUnauthorized)
return
}
a.setAuthSessionCookie(w, r, token, time.Now().Add(AUTH_TOKEN_VALID_PERIOD))
a.authAttemptsMu.Lock()
delete(a.failedAuthAttempts, ip)
a.authAttemptsMu.Unlock()
w.WriteHeader(http.StatusOK)
}
func (a *application) isAuthorized(w http.ResponseWriter, r *http.Request) bool {
if !a.RequiresAuth {
return true
}
token, err := r.Cookie(AUTH_SESSION_COOKIE_NAME)
if err != nil || token.Value == "" {
return false
}
usernameHash, shouldRegenerate, err := verifySessionToken(token.Value, a.authSecretKey, time.Now())
if err != nil {
return false
}
username, exists := a.usernameHashToUsername[string(usernameHash)]
if !exists {
return false
}
_, exists = a.Config.Auth.Users[username]
if !exists {
return false
}
if shouldRegenerate {
newToken, err := generateSessionToken(username, a.authSecretKey, time.Now())
if err != nil {
log.Printf("Could not compute session token during regeneration: %v", err)
return false
}
a.setAuthSessionCookie(w, r, newToken, time.Now().Add(AUTH_TOKEN_VALID_PERIOD))
}
return true
}
// Handles sending the appropriate response for an unauthorized request and returns true if the request was unauthorized
func (a *application) handleUnauthorizedResponse(w http.ResponseWriter, r *http.Request, fallback doWhenUnauthorized) bool {
if a.isAuthorized(w, r) {
return false
}
switch fallback {
case redirectToLogin:
http.Redirect(w, r, a.Config.Server.BaseURL+"/login", http.StatusSeeOther)
case showUnauthorizedJSON:
w.WriteHeader(http.StatusUnauthorized)
w.Write([]byte(`{"error": "Unauthorized"}`))
}
return true
}
// Maybe this should be a POST request instead?
func (a *application) handleLogoutRequest(w http.ResponseWriter, r *http.Request) {
a.setAuthSessionCookie(w, r, "", time.Now().Add(-1*time.Hour))
http.Redirect(w, r, a.Config.Server.BaseURL+"/login", http.StatusSeeOther)
}
func (a *application) setAuthSessionCookie(w http.ResponseWriter, r *http.Request, token string, expires time.Time) {
http.SetCookie(w, &http.Cookie{
Name: AUTH_SESSION_COOKIE_NAME,
Value: token,
Expires: expires,
Secure: strings.ToLower(r.Header.Get("X-Forwarded-Proto")) == "https",
Path: a.Config.Server.BaseURL + "/",
SameSite: http.SameSiteLaxMode,
HttpOnly: true,
})
}
func (a *application) handleLoginPageRequest(w http.ResponseWriter, r *http.Request) {
if a.isAuthorized(w, r) {
http.Redirect(w, r, a.Config.Server.BaseURL+"/", http.StatusSeeOther)
return
}
data := &templateData{
App: a,
}
a.populateTemplateRequestData(&data.Request, r)
var responseBytes bytes.Buffer
err := loginPageTemplate.Execute(&responseBytes, data)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
return
}
w.Write(responseBytes.Bytes())
}
+85
View File
@@ -0,0 +1,85 @@
package glance
import (
"bytes"
"encoding/base64"
"testing"
"time"
)
func TestAuthTokenGenerationAndVerification(t *testing.T) {
secret, err := makeAuthSecretKey(AUTH_SECRET_KEY_LENGTH)
if err != nil {
t.Fatalf("Failed to generate secret key: %v", err)
}
secretBytes, err := base64.StdEncoding.DecodeString(secret)
if err != nil {
t.Fatalf("Failed to decode secret key: %v", err)
}
if len(secretBytes) != AUTH_SECRET_KEY_LENGTH {
t.Fatalf("Secret key length is not %d bytes", AUTH_SECRET_KEY_LENGTH)
}
now := time.Now()
username := "admin"
token, err := generateSessionToken(username, secretBytes, now)
if err != nil {
t.Fatalf("Failed to generate session token: %v", err)
}
usernameHashBytes, shouldRegen, err := verifySessionToken(token, secretBytes, now)
if err != nil {
t.Fatalf("Failed to verify session token: %v", err)
}
if shouldRegen {
t.Fatal("Token should not need to be regenerated immediately after generation")
}
computedUsernameHash, err := computeUsernameHash(username, secretBytes)
if err != nil {
t.Fatalf("Failed to compute username hash: %v", err)
}
if !bytes.Equal(usernameHashBytes, computedUsernameHash) {
t.Fatal("Username hash does not match the expected value")
}
// Test token regeneration
timeRightAfterRegenPeriod := now.Add(AUTH_TOKEN_VALID_PERIOD - AUTH_TOKEN_REGEN_BEFORE + 2*time.Second)
_, shouldRegen, err = verifySessionToken(token, secretBytes, timeRightAfterRegenPeriod)
if err != nil {
t.Fatalf("Token verification should not fail during regeneration period, err: %v", err)
}
if !shouldRegen {
t.Fatal("Token should have been marked for regeneration")
}
// Test token expiration
_, _, err = verifySessionToken(token, secretBytes, now.Add(AUTH_TOKEN_VALID_PERIOD+2*time.Second))
if err == nil {
t.Fatal("Expected token verification to fail after token expiration")
}
// Test tampered token
decodedToken, err := base64.StdEncoding.DecodeString(token)
if err != nil {
t.Fatalf("Failed to decode token: %v", err)
}
// If any of the bytes are off by 1, the token should be considered invalid
for i := range len(decodedToken) {
tampered := make([]byte, len(decodedToken))
copy(tampered, decodedToken)
tampered[i] += 1
_, _, err = verifySessionToken(base64.StdEncoding.EncodeToString(tampered), secretBytes, now)
if err == nil {
t.Fatalf("Expected token verification to fail for tampered token at index %d", i)
}
}
}
+129 -16
View File
@@ -2,41 +2,154 @@ package glance
import (
"flag"
"fmt"
"os"
"strings"
"github.com/shirou/gopsutil/v4/disk"
"github.com/shirou/gopsutil/v4/sensors"
)
type CliIntent uint8
type cliIntent uint8
const (
CliIntentServe CliIntent = iota
CliIntentCheckConfig = iota
cliIntentVersionPrint cliIntent = iota
cliIntentServe
cliIntentConfigValidate
cliIntentConfigPrint
cliIntentDiagnose
cliIntentSensorsPrint
cliIntentMountpointInfo
cliIntentSecretMake
cliIntentPasswordHash
)
type CliOptions struct {
Intent CliIntent
ConfigPath string
type cliOptions struct {
intent cliIntent
configPath string
args []string
}
func ParseCliOptions() (*CliOptions, error) {
func parseCliOptions() (*cliOptions, error) {
var args []string
args = os.Args[1:]
if len(args) == 1 && (args[0] == "--version" || args[0] == "-v" || args[0] == "version") {
return &cliOptions{
intent: cliIntentVersionPrint,
}, nil
}
flags := flag.NewFlagSet("", flag.ExitOnError)
flags.Usage = func() {
fmt.Println("Usage: glance [options] command")
fmt.Println("\nOptions:")
flags.PrintDefaults()
fmt.Println("\nCommands:")
fmt.Println(" config:validate Validate the config file")
fmt.Println(" config:print Print the parsed config file with embedded includes")
fmt.Println(" password:hash <pwd> Hash a password")
fmt.Println(" secret:make Generate a random secret key")
fmt.Println(" sensors:print List all sensors")
fmt.Println(" mountpoint:info Print information about a given mountpoint path")
fmt.Println(" diagnose Run diagnostic checks")
}
checkConfig := flags.Bool("check-config", false, "Check whether the config is valid")
configPath := flags.String("config", "glance.yml", "Set config path")
err := flags.Parse(os.Args[1:])
if err != nil {
return nil, err
}
intent := CliIntentServe
var intent cliIntent
args = flags.Args()
unknownCommandErr := fmt.Errorf("unknown command: %s", strings.Join(args, " "))
if *checkConfig {
intent = CliIntentCheckConfig
if len(args) == 0 {
intent = cliIntentServe
} else if len(args) == 1 {
if args[0] == "config:validate" {
intent = cliIntentConfigValidate
} else if args[0] == "config:print" {
intent = cliIntentConfigPrint
} else if args[0] == "sensors:print" {
intent = cliIntentSensorsPrint
} else if args[0] == "diagnose" {
intent = cliIntentDiagnose
} else if args[0] == "secret:make" {
intent = cliIntentSecretMake
} else {
return nil, unknownCommandErr
}
} else if len(args) == 2 {
if args[0] == "password:hash" {
intent = cliIntentPasswordHash
} else {
return nil, unknownCommandErr
}
} else if len(args) == 2 {
if args[0] == "mountpoint:info" {
intent = cliIntentMountpointInfo
} else {
return nil, unknownCommandErr
}
} else {
return nil, unknownCommandErr
}
return &CliOptions{
Intent: intent,
ConfigPath: *configPath,
return &cliOptions{
intent: intent,
configPath: *configPath,
args: args,
}, nil
}
func cliSensorsPrint() int {
tempSensors, err := sensors.SensorsTemperatures()
if err != nil {
if warns, ok := err.(*sensors.Warnings); ok {
fmt.Printf("Could not retrieve information for some sensors (%v):\n", err)
for _, w := range warns.List {
fmt.Printf(" - %v\n", w)
}
fmt.Println()
} else {
fmt.Printf("Failed to retrieve sensor information: %v\n", err)
return 1
}
}
if len(tempSensors) == 0 {
fmt.Println("No sensors found")
return 0
}
fmt.Println("Sensors found:")
for _, sensor := range tempSensors {
fmt.Printf(" %s: %.1f°C\n", sensor.SensorKey, sensor.Temperature)
}
return 0
}
func cliMountpointInfo(requestedPath string) int {
usage, err := disk.Usage(requestedPath)
if err != nil {
fmt.Printf("Failed to retrieve info for path %s: %v\n", requestedPath, err)
if warns, ok := err.(*disk.Warnings); ok {
for _, w := range warns.List {
fmt.Printf(" - %v\n", w)
}
}
return 1
}
fmt.Println("Path:", usage.Path)
fmt.Println("FS type:", ternary(usage.Fstype == "", "unknown", usage.Fstype))
fmt.Printf("Used percent: %.1f%%\n", usage.UsedPercent)
return 0
}

Some files were not shown because too many files have changed in this diff Show More