``` ├── .dockerignore ├── .github/ ├── CODE_OF_CONDUCT.md ├── FUNDING.yml ├── ISSUE_TEMPLATE/ ├── bug_report.yml ├── config.yml ├── feature_request.yml ├── PULL_REQUEST_TEMPLATE.md ├── SECURITY.md ├── workflows/ ├── release.yaml ├── .gitignore ├── .goreleaser.yaml ├── Dockerfile ├── Dockerfile.goreleaser ├── LICENSE ├── README.md ├── docs/ ├── configuration.md ├── custom-api.md ├── extensions.md ├── glance.yml ├── images/ ├── bookmarks-widget-preview.png ├── calendar-legacy-widget-preview.png ├── calendar-widget-preview.png ├── change-detection-widget-preview.png ├── clock-widget-preview.png ├── column-configuration-1.png ├── column-configuration-2.png ├── column-configuration-3.png ├── contrast-multiplier-example.png ├── custom-api-preview-1.png ├── custom-api-preview-2.png ├── custom-api-preview-3.png ├── dns-stats-widget-preview.png ├── docker-container-parent.png ├── docker-container-parent2.png ├── docker-containers-preview.png ├── docker-widget-preview.png ├── extension-html-reusing-existing-features-preview.png ├── extension-overview.png ├── gaming-page-preview.png ├── group-widget-preview.png ├── hacker-news-widget-preview.png ├── lobsters-widget-preview.png ├── markets-page-preview.png ├── markets-widget-preview.png ├── mobile-header-preview.png ├── mobile-preview.png ├── monitor-widget-compact-preview.png ├── monitor-widget-preview.png ├── pages-and-columns-illustration.png ├── preconfigured-page-preview.png ├── readme-main-image.png ├── reddit-field-search.png ├── reddit-widget-horizontal-cards-preview.png ├── reddit-widget-preview.png ├── reddit-widget-vertical-cards-preview.png ├── reddit-widget-vertical-list-thumbnails.png ├── releases-widget-preview.png ├── repository-preview.png ├── rss-feed-horizontal-cards-preview.png ├── rss-feed-vertical-list-preview.png ├── rss-widget-detailed-list-preview.png ├── rss-widget-horizontal-cards-2-preview.png ├── search-widget-bangs-preview.png ├── search-widget-preview.png ├── server-stats-flame-icon.png ├── server-stats-preview.gif ├── split-column-widget-3-columns.png ├── split-column-widget-4-columns.png ├── split-column-widget-masonry.png ├── split-column-widget-preview.png ├── startpage-preview.png ├── themes-example.png ├── themes/ ├── camouflage.png ├── catppuccin-frappe.png ├── catppuccin-latte.png ├── catppuccin-macchiato.png ├── catppuccin-mocha.png ├── dracula.png ├── gruvbox.png ├── kanagawa-dark.png ├── peachy.png ├── teal-city.png ├── tucan.png ├── zebra.png ├── twitch-channels-widget-preview.png ├── twitch-top-games-widget-preview.png ├── videos-channel-description-example.png ├── videos-copy-channel-id-example.png ├── videos-widget-grid-cards-preview.png ├── videos-widget-preview.png ├── videos-widget-vertical-list-preview.png ├── weather-widget-preview.png ├── preconfigured-pages.md ├── themes.md ├── v0.7.0-upgrade.md ├── go.mod ├── go.sum ├── internal/ ├── glance/ ├── cli.go ├── config-fields.go ├── config.go ├── diagnose.go ├── embed.go ├── glance.go ├── main.go ├── static/ ├── app-icon.png ├── favicon.png ├── fonts/ ├── JetBrainsMono-Regular.woff2 ├── icons/ ├── codeberg.svg ├── dockerhub.svg ├── github.svg ├── gitlab.svg ├── js/ ├── animations.js ├── calendar.js ├── main.js ``` ## /.dockerignore ```dockerignore path="/.dockerignore" # 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 ``` ## /.github/CODE_OF_CONDUCT.md # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at glanceapp@duck.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. ## /.github/FUNDING.yml ```yml path="/.github/FUNDING.yml" github: [glanceapp] ``` ## /.github/ISSUE_TEMPLATE/bug_report.yml ```yml path="/.github/ISSUE_TEMPLATE/bug_report.yml" 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. ``` ## /.github/ISSUE_TEMPLATE/config.yml ```yml path="/.github/ISSUE_TEMPLATE/config.yml" 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 ``` ## /.github/ISSUE_TEMPLATE/feature_request.yml ```yml path="/.github/ISSUE_TEMPLATE/feature_request.yml" 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. ``` ## /.github/PULL_REQUEST_TEMPLATE.md ## /.github/SECURITY.md # Security Policy ## Supported Versions Security updates will be applied to the latest as well as previous minor version release depending on severity and if applicable. ## Reporting a Vulnerability Please report any suspected security vulnerabilities to [glanceapp@duck.com](mailto:glanceapp@duck.com) and do not disclose them publicly. You should receive a response within a few days and if confirmed the issue will be resolved as soon as possible. ## /.github/workflows/release.yaml ```yaml path="/.github/workflows/release.yaml" 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 ``` ## /.gitignore ```gitignore path="/.gitignore" /assets /build /playground /.idea /glance*.yml ``` ## /.goreleaser.yaml ```yaml path="/.goreleaser.yaml" 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 ``` ## /Dockerfile ``` path="/Dockerfile" FROM golang:1.24.2-alpine3.21 AS builder WORKDIR /app 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", "--config", "/app/config/glance.yml"] ``` ## /Dockerfile.goreleaser ```goreleaser path="/Dockerfile.goreleaser" 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"] ``` ## /LICENSE ``` path="/LICENSE" GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ``` ## /README.md

What if you could see everything at a...

Glance

InstallConfigurationDiscordSponsor

Community widgetsPreconfigured pagesThemes

![](docs/images/readme-main-image.png) ## Features ### Various widgets * RSS feeds * Subreddit posts * 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) ### 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) ### 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 ### Optimized for mobile devices Because you'll want to take it with you on the go. ![](docs/images/mobile-preview.png) ### Themeable Easily create your own theme by tweaking a few numbers or choose from one of the [already available themes](docs/themes.md). ![](docs/images/themes-example.png)
## 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).
Preview example configuration file
```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 ```

## Installation Choose one of the following methods:
Docker compose using provided directory structure (recommended)
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
Other files you may want to edit * `.env` to configure environment variables that will be available inside configuration files * `assets/user.css` to add custom CSS
When ready, run: ```bash docker compose up -d ``` If you encounter any issues, you can check the logs by running: ```bash docker compose logs ```
Docker compose manual
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 ```
Manual binary installation
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 ``` To grab a starting template for the config file, run: ```bash wget https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/glance.yml ``` ### 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.
Other
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/)

## Common issues
Requests timing out 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 ```
Broken layout for markets, bookmarks or other widgets This is almost always caused by the browser extension Dark Reader. To fix this, disable dark mode for the domain where Glance is hosted.
cannot unmarshal !!map into []glance.page 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.

## FAQ
Does the information on the page update automatically? 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.
How frequently do widgets update? 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.
Can I create my own widgets? 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
Can I change the title of a widget? Yes, the title of all widgets can be changed by specifying the `title` property in the widget's configuration: ```yaml - type: rss title: My custom title - type: markets title: My custom title - type: videos title: My custom title # and so on for all widgets... ```

## Feature requests 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
## Building from source Choose one of the following methods:
Build binary with Go
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 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 . ```
Build project and Docker image with Docker
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 docker build -t owner/glance:latest . ``` If you wish to push the image to a registry (by default Docker Hub), run: ```bash docker push owner/glance:latest ```

## 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[1], backlog[2] or icebox[3] * 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`
[1] [2] [3] [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

## 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. ## /docs/configuration.md # Configuring Glance - [Preconfigured page](#preconfigured-page) - [The config file](#the-config-file) - [Auto reload](#auto-reload) - [Environment variables](#environment-variables) - [Including other config files](#including-other-config-files) - [Config schema](#config-schema) - [Server](#server) - [Document](#document) - [Branding](#branding) - [Theme](#theme) - [Available themes](#available-themes) - [Pages & Columns](#pages--columns) - [Widgets](#widgets) - [RSS](#rss) - [Videos](#videos) - [Hacker News](#hacker-news) - [Lobsters](#lobsters) - [Reddit](#reddit) - [Search](#search-widget) - [Group](#group) - [Split Column](#split-column) - [Custom API](#custom-api) - [Extension](#extension) - [Weather](#weather) - [Monitor](#monitor) - [Releases](#releases) - [Docker Containers](#docker-containers) - [DNS Stats](#dns-stats) - [Server Stats](#server-stats) - [Repository](#repository) - [Bookmarks](#bookmarks) - [Calendar](#calendar) - [Calendar (legacy)](#calendar-legacy) - [ChangeDetection.io](#changedetectionio) - [Clock](#clock) - [Markets](#markets) - [Twitch Channels](#twitch-channels) - [Twitch Top Games](#twitch-top-games) - [iframe](#iframe) - [HTML](#html) ## Preconfigured page If you don't want to spend time reading through all the available configuration options and just want something to get you going quickly you can use [this `glance.yml` file](glance.yml) and make changes to it as you see fit. It will give you a page that looks like the following: ![](images/preconfigured-page-preview.png) Configure the widgets, add more of them, add extra pages, etc. Make it your own! ## The config file ### Auto reload Automatic config reload is supported, meaning that you can make changes to the config file and have them take effect on save without having to restart the container/service. Making changes to environment variables does not trigger a reload and requires manual restart. Deleting a config file will stop that file from being watched, even if it is recreated. > [!NOTE] > > If you attempt to start Glance with an invalid config it will exit with an error outright. If you successfully started Glance with a valid config and then made changes to it which result in an error, you'll see that error in the console and Glance will continue to run with the old configuration. You can then continue to make changes and when there are no errors the new configuration will be loaded. > [!CAUTION] > > Reloading the configuration file clears your cached data, meaning that you have to request the data anew each time you do this. This can lead to rate limiting for some APIs if you do it too frequently. Having a cache that persists between reloads will be added in the future. ### Environment variables Inserting environment variables is supported anywhere in the config. This is done via the `${ENV_VAR}` syntax. Attempting to use an environment variable that doesn't exist will result in an error and Glance will either not start or load your new config on save. Example: ```yaml server: host: ${HOST} port: ${PORT} ``` Can also be in the middle of a string: ```yaml - type: rss title: ${RSS_TITLE} feeds: - url: http://domain.com/rss/${RSS_CATEGORY}.xml ``` Works with any type of value, not just strings: ```yaml - type: rss limit: ${RSS_LIMIT} ``` If you need to use the syntax `${NAME}` in your config without it being interpreted as an environment variable, you can escape it by prefixing with a backslash `\`: ```yaml something: \${NOT_AN_ENV_VAR} ``` ### Including other config files Including config files from within your main config file is supported. This is done via the `!include` directive along with a relative or absolute path to the file you want to include. If the path is relative, it will be relative to the main config file. Additionally, environment variables can be used within included files, and changes to the included files will trigger an automatic reload. Example: ```yaml pages: !include: home.yml !include: videos.yml !include: homelab.yml ``` The file you are including should not have any additional indentation, its values should be at the top level and the appropriate amount of indentation will be added automatically depending on where the file is included. Example: `glance.yml` ```yaml pages: - name: Home columns: - size: full widgets: !include: rss.yml - name: News columns: - size: full widgets: - type: group widgets: !include: rss.yml - type: reddit subreddit: news ``` `rss.yml` ```yaml - type: rss title: News feeds: - url: ${RSS_URL} ``` The `!include` directive can be used anywhere in the config file, not just in the `pages` property, however it must be on its own line and have the appropriate indentation. If you encounter YAML parsing errors when using the `!include` directive, the reported line numbers will likely be incorrect. This is because the inclusion of files is done before the YAML is parsed, as YAML itself does not support file inclusion. To help with debugging in cases like this, you can use the `config:print` command and pipe it into `less -N` to see the full config file with includes resolved and line numbers added: ```sh glance --config /path/to/glance.yml config:print | less -N ``` This is a bit more convoluted when running Glance inside a Docker container: ```sh docker run --rm -v ./glance.yml:/app/config/glance.yml glanceapp/glance config:print | less -N ``` This assumes that the config you want to print is in your current working directory and is named `glance.yml`. ## Config schema For property descriptions, validation and autocompletion of the config within your IDE, @not-first has kindly created a [schema](https://github.com/not-first/glance-schema). Massive thanks to them for this, go check it out and give them a star! ## Server Server configuration is done through a top level `server` property. Example: ```yaml server: port: 8080 assets-path: /home/user/glance-assets ``` ### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | host | string | no | | | port | number | no | 8080 | | base-url | string | no | | | assets-path | string | no | | #### `host` The address which the server will listen on. Setting it to `localhost` means that only the machine that the server is running on will be able to access the dashboard. By default it will listen on all interfaces. #### `port` A number between 1 and 65,535, so long as that port isn't already used by anything else. #### `base-url` The base URL that Glance is hosted under. No need to specify this unless you're using a reverse proxy and are hosting Glance under a directory. If that's the case then you can set this value to `/glance` or whatever the directory is called. Note that the forward slash (`/`) in the beginning is required unless you specify the full domain and path. > [!IMPORTANT] > You need to strip the `base-url` prefix before forwarding the request to the Glance server. > In Caddy you can do this using [`handle_path`](https://caddyserver.com/docs/caddyfile/directives/handle_path) or [`uri strip_prefix`](https://caddyserver.com/docs/caddyfile/directives/uri). #### `assets-path` The path to a directory that will be served by the server under the `/assets/` path. This is handy for widgets like the Monitor where you have to specify an icon URL and you want to self host all the icons rather than pointing to an external source. > [!IMPORTANT] > > When installing through docker the path will point to the files inside the container. Don't forget to mount your assets path to the same path inside the container. > Example: > > If your assets are in: > ``` > /home/user/glance-assets > ``` > > You should mount: > ``` > /home/user/glance-assets:/app/assets > ``` > > And your config should contain: > ``` > assets-path: /app/assets > ``` ##### Examples Say you have a directory `glance-assets` with a file `gitea-icon.png` in it and you specify your assets path like: ```yaml assets-path: /home/user/glance-assets ``` To be able to point to an asset from your assets path, use the `/assets/` path like such: ```yaml icon: /assets/gitea-icon.png ``` ## Document If you want to insert custom HTML into the `` of the document for all pages, you can do so by using the `document` property. Example: ```yaml document: head: | ``` ## Branding You can adjust the various parts of the branding through a top level `branding` property. Example: ```yaml branding: custom-footer: |

Powered by Glance

logo-url: /assets/logo.png favicon-url: /assets/logo.png ``` ### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | hide-footer | bool | no | false | | custom-footer | string | no | | | logo-text | string | no | G | | logo-url | string | no | | | favicon-url | string | no | | #### `hide-footer` Hides the footer when set to `true`. #### `custom-footer` Specify custom HTML to use for the footer. #### `logo-text` Specify custom text to use instead of the "G" found in the navigation. #### `logo-url` Specify a URL to a custom image to use instead of the "G" found in the navigation. If both `logo-text` and `logo-url` are set, only `logo-url` will be used. #### `favicon-url` Specify a URL to a custom image to use for the favicon. ## Theme Theming is done through a top level `theme` property. Values for the colors are in [HSL](https://giggster.com/guide/basics/hue-saturation-lightness/) (hue, saturation, lightness) format. You can use a color picker [like this one](https://hslpicker.com/) to convert colors from other formats to HSL. The values are separated by a space and `%` is not required for any of the numbers. Example: ```yaml theme: background-color: 100 20 10 primary-color: 40 90 40 contrast-multiplier: 1.1 ``` ### Available themes If you don't want to spend time configuring your own theme, there are [several available themes](themes.md) which you can simply copy the values for. ### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | light | boolean | no | false | | background-color | HSL | no | 240 8 9 | | primary-color | HSL | no | 43 50 70 | | positive-color | HSL | no | same as `primary-color` | | negative-color | HSL | no | 0 70 70 | | contrast-multiplier | number | no | 1 | | text-saturation-multiplier | number | no | 1 | | custom-css-file | string | no | | #### `light` Whether the scheme is light or dark. This does not change the background color, it inverts the text colors so that they look appropriately on a light background. #### `background-color` Color of the page and widgets. #### `primary-color` Color used across the page, largely to indicate unvisited links. #### `positive-color` Used to indicate that something is positive, such as stock price being up, twitch channel being live or a monitored site being online. If not set, the value of `primary-color` will be used. #### `negative-color` Oppposite of `positive-color`. #### `contrast-multiplier` Used to increase or decrease the contrast (in other words visibility) of the text. A value of `1.3` means that the text will be 30% lighter/darker depending on the scheme. Use this if you think that some of the text on the page is too dark and hard to read. Example: ![difference between 1 and 1.3 contrast](images/contrast-multiplier-example.png) #### `text-saturation-multiplier` Used to increase or decrease the saturation of text, useful when using a custom background color with a high amount of saturation and needing the text to have a more neutral color. `0.5` means that the saturation will be 50% lower and `1.5` means that it'll be 50% higher. #### `custom-css-file` Path to a custom CSS file, either external or one from within the server configured assets path. Example: ```yaml theme: custom-css-file: /assets/my-style.css ``` > [!TIP] > > Because Glance uses a lot of utility classes it might be difficult to target some elements. To make it easier to style specific widgets, each widget has a `widget-type-{name}` class, so for example if you wanted to make the links inside just the RSS widget bigger you could use the following selector: > > ```css > .widget-type-rss a { > font-size: 1.5rem; > } > ``` > > In addition, you can also use the `css-class` property which is available on every widget to set custom class names for individual widgets. ## Pages & Columns ![illustration of pages and columns](images/pages-and-columns-illustration.png) Using pages and columns is how widgets are organized. Each page contains up to 3 columns and each column can have any number of widgets. ### Pages Pages are defined through a top level `pages` property. The page defined first becomes the home page and all pages get automatically added to the navigation bar in the order that they were defined. Example: ```yaml pages: - name: Home columns: ... - name: Videos columns: ... - name: Homelab columns: ... ``` ### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | name | string | yes | | | slug | string | no | | | width | string | no | | | center-vertically | boolean | no | false | | hide-desktop-navigation | boolean | no | false | | expand-mobile-page-navigation | boolean | no | false | | show-mobile-header | boolean | no | false | | columns | array | yes | | #### `name` The name of the page which gets shown in the navigation bar. #### `slug` The URL friendly version of the title which is used to access the page. For example if the title of the page is "RSS Feeds" you can make the page accessible via `localhost:8080/feeds` by setting the slug to `feeds`. If not defined, it will automatically be generated from the title. #### `width` The maximum width of the page on desktop. Possible values are `slim` and `wide`. * default: `1600px` (when no value is specified) * slim: `1100px` * wide: `1920px` > [!NOTE] > > When using `slim`, the maximum number of columns allowed for that page is `2`. #### `center-vertically` When set to `true`, vertically centers the content on the page. Has no effect if the content is taller than the height of the viewport. #### `hide-desktop-navigation` Whether to show the navigation links at the top of the page on desktop. #### `expand-mobile-page-navigation` Whether the mobile page navigation should be expanded by default. #### `show-mobile-header` Whether to show a header displaying the name of the page on mobile. The header purposefully has a lot of vertical whitespace in order to push the content down and make it easier to reach on tall devices. Preview: ![](images/mobile-header-preview.png) ### Columns Columns are defined for each page using a `columns` property. There are two types of columns - `full` and `small`, which refers to their width. A small column takes up a fixed amount of width (300px) and a full column takes up the all of the remaining width. You can have up to 3 columns per page and you must have either 1 or 2 full columns. Example: ```yaml pages: - name: Home columns: - size: small widgets: ... - size: full widgets: ... - size: small widgets: ... ``` ### Properties | Name | Type | Required | | ---- | ---- | -------- | | size | string | yes | | widgets | array | no | Here are some of the possible column configurations: ![column configuration small-full-small](images/column-configuration-1.png) ```yaml columns: - size: small widgets: ... - size: full widgets: ... - size: small widgets: ... ``` ![column configuration small-full-small](images/column-configuration-2.png) ```yaml columns: - size: full widgets: ... - size: small widgets: ... ``` ![column configuration small-full-small](images/column-configuration-3.png) ```yaml columns: - size: full widgets: ... - size: full widgets: ... ``` ## Widgets Widgets are defined for each column using a `widgets` property. Example: ```yaml pages: - name: Home columns: - size: small widgets: - type: weather location: London, United Kingdom ``` > [!NOTE] > > Currently not all widgets are designed to fit every column size, however some widgets offer different "styles" that help alleviate this limitation. ### Shared Properties | Name | Type | Required | | ---- | ---- | -------- | | type | string | yes | | title | string | no | | title-url | string | no | | cache | string | no | | css-class | string | no | #### `type` Used to specify the widget. #### `title` The title of the widget. If left blank it will be defined by the widget. #### `title-url` The URL to go to when clicking on the widget's title. If left blank it will be defined by the widget (if available). #### `cache` How long to keep the fetched data in memory. The value is a string and must be a number followed by one of s, m, h, d. Examples: ```yaml cache: 30s # 30 seconds cache: 5m # 5 minutes cache: 2h # 2 hours cache: 1d # 1 day ``` > [!NOTE] > > Not all widgets can have their cache duration modified. The calendar and weather widgets update on the hour and this cannot be changed. #### `css-class` Set custom CSS classes for the specific widget instance. ### RSS Display a list of articles from multiple RSS feeds. Example: ```yaml - 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 ``` #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | style | string | no | vertical-list | | feeds | array | yes | | thumbnail-height | float | no | 10 | | card-height | float | no | 27 | | limit | integer | no | 25 | | preserve-order | bool | no | false | | single-line-titles | boolean | no | false | | collapse-after | integer | no | 5 | ##### `limit` The maximum number of articles to show. ##### `collapse-after` How many articles are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. ##### `preserve-order` When set to `true`, the order of the articles will be preserved as they are in the feeds. Useful if a feed uses its own sorting order which denotes the importance of the articles. If you use this property while having a lot of feeds, it's recommended to set a `limit` to each individual feed since if the first defined feed has 15 articles, the articles from the second feed will start after the 15th article in the list. ##### `single-line-titles` When set to `true`, truncates the title of each post if it exceeds one line. Only applies when the style is set to `vertical-list`. ##### `style` Used to change the appearance of the widget. Possible values are: * `vertical-list` - suitable for `full` and `small` columns * `detailed-list` - suitable for `full` columns * `horizontal-cards` - suitable for `full` columns * `horizontal-cards-2` - suitable for `full` columns Below is a preview of each style: `vertical-list` ![preview of vertical-list style for RSS widget](images/rss-feed-vertical-list-preview.png) `detailed-list` ![preview of detailed-list style for RSS widget](images/rss-widget-detailed-list-preview.png) `horizontal-cards` ![preview of horizontal-cards style for RSS widget](images/rss-feed-horizontal-cards-preview.png) `horizontal-cards-2` ![preview of horizontal-cards-2 style for RSS widget](images/rss-widget-horizontal-cards-2-preview.png) ##### `thumbnail-height` Used to modify the height of the thumbnails. Works only when the style is set to `horizontal-cards`. The default value is `10` and the units are `rem`, if you want to for example double the height of the thumbnails you can set it to `20`. ##### `card-height` Used to modify the height of cards when using the `horizontal-cards-2` style. The default value is `27` and the units are `rem`. ##### `feeds` An array of RSS/atom feeds. The title can optionally be changed. ###### Properties for each feed | Name | Type | Required | Default | Notes | | ---- | ---- | -------- | ------- | ----- | | url | string | yes | | | | title | string | no | the title provided by the feed | | | hide-categories | boolean | no | false | Only applicable for `detailed-list` style | | hide-description | boolean | no | false | Only applicable for `detailed-list` style | | limit | integer | no | | | | item-link-prefix | string | no | | | | headers | key (string) & value (string) | no | | | ###### `limit` The maximum number of articles to show from that specific feed. Useful if you have a feed which posts a lot of articles frequently and you want to prevent it from excessively pushing down articles from other feeds. ###### `item-link-prefix` If an RSS feed isn't returning item links with a base domain and Glance has failed to automatically detect the correct domain you can manually add a prefix to each link with this property. ###### `headers` Optionally specify the headers that will be sent with the request. Example: ```yaml - type: rss feeds: - url: https://domain.com/rss headers: User-Agent: Custom User Agent ``` ### Videos Display a list of the latest videos from specific YouTube channels. Example: ```yaml - type: videos channels: - UCXuqSBlHAE6Xw-yeJA0Tunw - UCBJycsmduvYEL83R_U4JriQ - UCHnyfMqiRRG1u-2MsSQLbXA ``` Preview: ![](images/videos-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | channels | array | yes | | | playlists | array | no | | | limit | integer | no | 25 | | style | string | no | horizontal-cards | | collapse-after | integer | no | 7 | | collapse-after-rows | integer | no | 4 | | include-shorts | boolean | no | false | | video-url-template | string | no | https://www.youtube.com/watch?v={VIDEO-ID} | ##### `channels` A list of channels IDs. One way of getting the ID of a channel is going to the channel's page and clicking on its description: ![](images/videos-channel-description-example.png) Then scroll down and click on "Share channel", then "Copy channel ID": ![](images/videos-copy-channel-id-example.png) ##### `playlists` A list of playlist IDs: ```yaml - type: videos playlists: - PL8mG-RkN2uTyZZ00ObwZxxoG_nJbs3qec - PL8mG-RkN2uTxTK4m_Vl2dYR9yE41kRdBg ``` ##### `limit` The maximum number of videos to show. ##### `collapse-after` Specify the number of videos to show when using the `vertical-list` style before the "SHOW MORE" button appears. ##### `collapse-after-rows` Specify the number of rows to show when using the `grid-cards` style before the "SHOW MORE" button appears. ##### `style` Used to change the appearance of the widget. Possible values are `horizontal-cards`, `vertical-list` and `grid-cards`. Preview of `vertical-list`: ![](images/videos-widget-vertical-list-preview.png) Preview of `grid-cards`: ![](images/videos-widget-grid-cards-preview.png) ##### `video-url-template` Used to replace the default link for videos. Useful when you're running your own YouTube front-end. Example: ```yaml video-url-template: https://invidious.your-domain.com/watch?v={VIDEO-ID} ``` Placeholders: `{VIDEO-ID}` - the ID of the video ### Hacker News Display a list of posts from [Hacker News](https://news.ycombinator.com/). Example: ```yaml - type: hacker-news limit: 15 collapse-after: 5 ``` Preview: ![](images/hacker-news-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | limit | integer | no | 15 | | collapse-after | integer | no | 5 | | comments-url-template | string | no | https://news.ycombinator.com/item?id={POST-ID} | | sort-by | string | no | top | | extra-sort-by | string | no | | ##### `comments-url-template` Used to replace the default link for post comments. Useful if you want to use an alternative front-end. Example: ```yaml comments-url-template: https://www.hckrnws.com/stories/{POST-ID} ``` Placeholders: `{POST-ID}` - the ID of the post ##### `sort-by` Used to specify the order in which the posts should get returned. Possible values are `top`, `new`, and `best`. ##### `extra-sort-by` Can be used to specify an additional sort which will be applied on top of the already sorted posts. By default does not apply any extra sorting and the only available option is `engagement`. The `engagement` sort tries to place the posts with the most points and comments on top, also prioritizing recent over old posts. ### Lobsters Display a list of posts from [Lobsters](https://lobste.rs). Example: ```yaml - type: lobsters sort-by: hot tags: - go - security - linux limit: 15 collapse-after: 5 ``` Preview: ![](images/lobsters-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | instance-url | string | no | https://lobste.rs/ | | custom-url | string | no | | | limit | integer | no | 15 | | collapse-after | integer | no | 5 | | sort-by | string | no | hot | | tags | array | no | | ##### `instance-url` The base URL for a lobsters instance hosted somewhere other than on lobste.rs. Example: ```yaml instance-url: https://www.journalduhacker.net/ ``` ##### `custom-url` A custom URL to retrieve lobsters posts from. If this is specified, the `instance-url`, `sort-by` and `tags` properties are ignored. ##### `limit` The maximum number of posts to show. ##### `collapse-after` How many posts are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. ##### `sort-by` The sort order in which posts are returned. Possible options are `hot` and `new`. ##### `tags` Limit to posts containing one of the given tags. **You cannot specify a sort order when filtering by tags, it will default to `hot`.** ### Reddit Display a list of posts from a specific subreddit. > [!WARNING] > > Reddit does not allow unauthorized API access from VPS IPs, if you're hosting Glance on a VPS you will get a 403 response. As a workaround you can route the traffic from Glance through a VPN or your own HTTP proxy using the `request-url-template` property. Example: ```yaml - type: reddit subreddit: technology ``` #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | subreddit | string | yes | | | style | string | no | vertical-list | | show-thumbnails | boolean | no | false | | show-flairs | boolean | no | false | | limit | integer | no | 15 | | collapse-after | integer | no | 5 | | comments-url-template | string | no | https://www.reddit.com/{POST-PATH} | | request-url-template | string | no | | | proxy | string or multiple parameters | no | | | sort-by | string | no | hot | | top-period | string | no | day | | search | string | no | | | extra-sort-by | string | no | | ##### `subreddit` The subreddit for which to fetch the posts from. ##### `style` Used to change the appearance of the widget. Possible values are `vertical-list`, `horizontal-cards` and `vertical-cards`. The first two were designed for full columns and the last for small columns. `vertical-list` ![](images/reddit-widget-preview.png) `horizontal-cards` ![](images/reddit-widget-horizontal-cards-preview.png) `vertical-cards` ![](images/reddit-widget-vertical-cards-preview.png) ##### `show-thumbnails` Shows or hides thumbnails next to the post. This only works if the `style` is `vertical-list`. Preview: ![](images/reddit-widget-vertical-list-thumbnails.png) > [!NOTE] > > Thumbnails don't work for some subreddits due to Reddit's API not returning the thumbnail URL. No workaround for this yet. ##### `show-flairs` Shows post flairs when set to `true`. ##### `limit` The maximum number of posts to show. ##### `collapse-after` How many posts are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. Not available when using the `vertical-cards` and `horizontal-cards` styles. ##### `comments-url-template` Used to replace the default link for post comments. Useful if you want to use the old Reddit design or any other 3rd party front-end. Example: ```yaml comments-url-template: https://old.reddit.com/{POST-PATH} ``` Placeholders: `{POST-PATH}` - the full path to the post, such as: ``` r/selfhosted/comments/bsp01i/welcome_to_rselfhosted_please_read_this_first/ ``` `{POST-ID}` - the ID that comes after `/comments/` `{SUBREDDIT}` - the subreddit name ##### `request-url-template` A custom request URL that will be used to fetch the data. This is useful when you're hosting Glance on a VPS where Reddit is blocking the requests and you want to route them through a proxy that accepts the URL as either a part of the path or a query parameter. Placeholders: `{REQUEST-URL}` - will be templated and replaced with the expanded request URL (i.e. https://www.reddit.com/r/selfhosted/hot.json). Example: ``` https://proxy/{REQUEST-URL} https://your.proxy/?url={REQUEST-URL} ``` ##### `proxy` A custom HTTP/HTTPS proxy URL that will be used to fetch the data. This is useful when you're hosting Glance on a VPS where Reddit is blocking the requests and you want to bypass the restriction by routing the requests through a proxy. Example: ```yaml proxy: http://user:pass@proxy.com:8080 proxy: https://user:pass@proxy.com:443 ``` Alternatively, you can specify the proxy URL as well as additional options by using multiple parameters: ```yaml proxy: url: http://proxy.com:8080 allow-insecure: true timeout: 10s ``` ###### `allow-insecure` When set to `true`, allows the use of insecure connections such as when the proxy has a self-signed certificate. ###### `timeout` The maximum time to wait for a response from the proxy. The value is a string and must be a number followed by one of s, m, h, d. Example: `10s` for 10 seconds, `1m` for 1 minute, etc ##### `sort-by` Can be used to specify the order in which the posts should get returned. Possible values are `hot`, `new`, `top` and `rising`. ##### `top-period` Available only when `sort-by` is set to `top`. Possible values are `hour`, `day`, `week`, `month`, `year` and `all`. ##### `search` Keywords to search for. Searching within specific fields is also possible, **though keep in mind that Reddit may remove the ability to use any of these at any time**: ![](images/reddit-field-search.png) ##### `extra-sort-by` Can be used to specify an additional sort which will be applied on top of the already sorted posts. By default does not apply any extra sorting and the only available option is `engagement`. The `engagement` sort tries to place the posts with the most points and comments on top, also prioritizing recent over old posts. ### Search Widget Display a search bar that can be used to search for specific terms on various search engines. Example: ```yaml - type: search search-engine: duckduckgo bangs: - title: YouTube shortcut: "!yt" url: https://www.youtube.com/results?search_query={QUERY} ``` Preview: ![](images/search-widget-preview.png) #### Keyboard shortcuts | Keys | Action | Condition | | ---- | ------ | --------- | | S | Focus the search bar | Not already focused on another input field | | Enter | Perform search in the same tab | Search input is focused and not empty | | Ctrl + Enter | Perform search in a new tab | Search input is focused and not empty | | Escape | Leave focus | Search input is focused | | Up | Insert the last search query since the page was opened into the input field | Search input is focused | > [!TIP] > > You can use the property `new-tab` with a value of `true` if you want to show search results in a new tab by default. Ctrl + Enter will then show results in the same tab. #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | search-engine | string | no | duckduckgo | | new-tab | boolean | no | false | | autofocus | boolean | no | false | | target | string | no | _blank | | placeholder | string | no | Type here to search… | | bangs | array | no | | ##### `search-engine` Either a value from the table below or a URL to a custom search engine. Use `{QUERY}` to indicate where the query value gets placed. | Name | URL | | ---- | --- | | duckduckgo | `https://duckduckgo.com/?q={QUERY}` | | google | `https://www.google.com/search?q={QUERY}` | ##### `new-tab` When set to `true`, swaps the shortcuts for showing results in the same or new tab, defaulting to showing results in a new tab. ##### `autofocus` When set to `true`, automatically focuses the search input on page load. ##### `target` The target to use when opening the search results in a new tab. Possible values are `_blank`, `_self`, `_parent` and `_top`. ##### `placeholder` When set, modifies the text displayed in the input field before typing. ##### `bangs` What now? [Bangs](https://duckduckgo.com/bangs). They're shortcuts that allow you to use the same search box for many different sites. Assuming you have it configured, if for example you start your search input with `!yt` you'd be able to perform a search on YouTube: ![](images/search-widget-bangs-preview.png) ##### Properties for each bang | Name | Type | Required | | ---- | ---- | -------- | | title | string | no | | shortcut | string | yes | | url | string | yes | ###### `title` Optional title that will appear on the right side of the search bar when the query starts with the associated shortcut. ###### `shortcut` Any value you wish to use as the shortcut for the search engine. It does not have to start with `!`. > [!IMPORTANT] > > In YAML some characters have special meaning when placed in the beginning of a value. If your shortcut starts with `!` (and potentially some other special characters) you'll have to wrap the value in quotes: > ```yaml > shortcut: "!yt" >``` ###### `url` The URL of the search engine. Use `{QUERY}` to indicate where the query value gets placed. Examples: ```yaml url: https://www.reddit.com/search?q={QUERY} url: https://store.steampowered.com/search/?term={QUERY} url: https://www.amazon.com/s?k={QUERY} ``` ### Group Group multiple widgets into one using tabs. Widgets are defined using a `widgets` property exactly as you would on a page column. The only limitation is that you cannot place a group widget or a split column widget within a group widget. Example: ```yaml - type: group widgets: - type: reddit subreddit: gamingnews show-thumbnails: true collapse-after: 6 - type: reddit subreddit: games - type: reddit subreddit: pcgaming show-thumbnails: true ``` Preview: ![](images/group-widget-preview.png) #### Sharing properties To avoid repetition you can use [YAML anchors](https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/) and share properties between widgets. Example: ```yaml - type: group define: &shared-properties type: reddit show-thumbnails: true collapse-after: 6 widgets: - subreddit: gamingnews <<: *shared-properties - subreddit: games <<: *shared-properties - subreddit: pcgaming <<: *shared-properties ``` ### Split Column Splits a full sized column in half, allowing you to place widgets side by side horizontally. This is converted to a single column on mobile devices or if not enough width is available. Widgets are defined using a `widgets` property exactly as you would on a page column. Two widgets side by side in a `full` column: ![](images/split-column-widget-preview.png)
View glance.yml
```yaml # ... - size: full widgets: - type: split-column widgets: - type: hacker-news collapse-after: 3 - type: lobsters collapse-after: 3 - type: videos # ... ```

You can also achieve a number of different full page layouts using just this widget, such as: 3 column layout where all columns have equal width: ![](images/split-column-widget-3-columns.png)
View glance.yml
```yaml pages: - name: Home columns: - size: full widgets: - type: split-column max-columns: 3 widgets: - type: reddit subreddit: selfhosted collapse-after: 15 - type: reddit subreddit: homelab collapse-after: 15 - type: reddit subreddit: sysadmin collapse-after: 15 ```

4 column layout where all columns have equal width (and the page is set to `width: wide`): ![](images/split-column-widget-4-columns.png)
View glance.yml
```yaml pages: - name: Home width: wide columns: - size: full widgets: - type: split-column max-columns: 4 widgets: - type: reddit subreddit: selfhosted collapse-after: 15 - type: reddit subreddit: homelab collapse-after: 15 - type: reddit subreddit: linux collapse-after: 15 - type: reddit subreddit: sysadmin collapse-after: 15 ```

Masonry layout with up to 5 columns where all columns have equal width (and the page is set to `width: wide`): ![](images/split-column-widget-masonry.png)
View glance.yml
```yaml define: - &subreddit-settings type: reddit collapse-after: 5 pages: - name: Home width: wide columns: - size: full widgets: - type: split-column max-columns: 5 widgets: - subreddit: selfhosted <<: *subreddit-settings - subreddit: homelab <<: *subreddit-settings - subreddit: linux <<: *subreddit-settings - subreddit: sysadmin <<: *subreddit-settings - subreddit: DevOps <<: *subreddit-settings - subreddit: Networking <<: *subreddit-settings - subreddit: DataHoarding <<: *subreddit-settings - subreddit: OpenSource <<: *subreddit-settings - subreddit: Privacy <<: *subreddit-settings - subreddit: FreeSoftware <<: *subreddit-settings ```

Just like the `group` widget, you can insert any widget type, you can even insert a `group` widget inside of a `split-column` widget, but you can't insert a `split-column` widget inside of a `group` widget. ### Custom API Display data from a JSON API using a custom template. > [!NOTE] > > The configuration of this widget requires some basic knowledge of programming, HTML, CSS, the Go template language and Glance-specific concepts. Examples: ![](images/custom-api-preview-1.png)
View glance.yml
```yaml - type: custom-api title: Random Fact cache: 6h url: https://uselessfacts.jsph.pl/api/v2/facts/random template: |

{{ .JSON.String "text" }}

```

![](images/custom-api-preview-2.png)
View glance.yml
```yaml - type: custom-api title: Immich stats cache: 1d url: https://${IMMICH_URL}/api/server/statistics headers: x-api-key: ${IMMICH_API_KEY} Accept: application/json template: |
{{ .JSON.Int "photos" | formatNumber }}
PHOTOS
{{ .JSON.Int "videos" | formatNumber }}
VIDEOS
{{ div (.JSON.Int "usage" | toFloat) 1073741824 | toInt | formatNumber }}GB
USAGE
```

![](images/custom-api-preview-3.png)
View glance.yml
```yaml - type: custom-api title: Steam Specials cache: 12h url: https://store.steampowered.com/api/featuredcategories?cc=us template: |
    {{ range .JSON.Array "specials.items" }}
  • {{ .String "name" }}
    • {{ div (.Int "final_price" | toFloat) 100 | printf "$%.2f" }}
    • {{ $discount := .Int "discount_percent" }} {{ $discount }}% off
  • {{ end }}
```
#### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | url | string | yes | | | headers | key (string) & value (string) | no | | | method | string | no | GET | | body-type | string | no | json | | body | any | no | | | frameless | boolean | no | false | | allow-insecure | boolean | no | false | | skip-json-validation | boolean | no | false | | template | string | yes | | | parameters | key (string) & value (string|array) | no | | | subrequests | map of requests | no | | ##### `url` The URL to fetch the data from. It must be accessible from the server that Glance is running on. ##### `headers` Optionally specify the headers that will be sent with the request. Example: ```yaml headers: x-api-key: your-api-key Accept: application/json ``` ##### `method` The HTTP method to use when making the request. Possible values are `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS` and `HEAD`. ##### `body-type` The type of the body that will be sent with the request. Possible values are `json`, and `string`. ##### `body` The body that will be sent with the request. It can be a string or a map. Example: ```yaml body-type: json body: key1: value1 key2: value2 multiple-items: - item1 - item2 ``` ```yaml body-type: string body: | key1=value1&key2=value2 ``` ##### `frameless` When set to `true`, removes the border and padding around the widget. ##### `allow-insecure` Whether to ignore invalid/self-signed certificates. ##### `skip-json-validation` When set to `true`, skips the JSON validation step. This is useful when the API returns JSON Lines/newline-delimited JSON, which is a format that consists of several JSON objects separated by newlines. ##### `template` The template that will be used to display the data. It relies on Go's `html/template` package so it's recommended to go through [its documentation](https://pkg.go.dev/text/template) to understand how to do basic things such as conditionals, loops, etc. In addition, it also uses [tidwall's gjson](https://github.com/tidwall/gjson) package to parse the JSON data so it's worth going through its documentation if you want to use more advanced JSON selectors. You can view additional examples with explanations and function definitions [here](custom-api.md). ##### `parameters` A list of keys and values that will be sent to the custom-api as query paramters. ##### `subrequests` A map of additional requests that will be executed concurrently and then made available in the template via the `.Subrequest` property. Example: ```yaml - type: custom-api cache: 2h subrequests: another-one: url: https://uselessfacts.jsph.pl/api/v2/facts/random title: Random Fact url: https://uselessfacts.jsph.pl/api/v2/facts/random template: |

{{ .JSON.String "text" }}

{{ (.Subrequest "another-one").JSON.String "text" }}

``` The subrequests support all the same properties as the main request, except for `subrequests` itself, so you can use `headers`, `parameters`, etc. `(.Subrequest "key")` can be a little cumbersome to write, so you can define a variable to make it easier: ```yaml template: | {{ $anotherOne := .Subrequest "another-one" }}

{{ $anotherOne.JSON.String "text" }}

``` You can also access the `.Response` property of a subrequest as you would with the main request: ```yaml template: | {{ $anotherOne := .Subrequest "another-one" }}

{{ $anotherOne.Response.StatusCode }}

``` > [!NOTE] > > Setting this property will override any query parameters that are already in the URL. ```yaml parameters: param1: value1 param2: - item1 - item2 ``` ### Extension Display a widget provided by an external source (3rd party). If you want to learn more about developing extensions, checkout the [extensions documentation](extensions.md) (WIP). ```yaml - type: extension url: https://domain.com/widget/display-a-message allow-potentially-dangerous-html: true parameters: message: Hello, world! ``` #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | url | string | yes | | | fallback-content-type | string | no | | | allow-potentially-dangerous-html | boolean | no | false | | headers | key & value | no | | | parameters | key & value | no | | ##### `url` The URL of the extension. **Note that the query gets stripped from this URL and the one defined by `parameters` gets used instead.** ##### `fallback-content-type` Optionally specify the fallback content type of the extension if the URL does not return a valid `Widget-Content-Type` header. Currently the only supported value for this property is `html`. ##### `headers` Optionally specify the headers that will be sent with the request. Example: ```yaml headers: x-api-key: ${SECRET_KEY} ``` ##### `allow-potentially-dangerous-html` Whether to allow the extension to display HTML. > [!WARNING] > > There's a reason this property is scary-sounding. It's intended to be used by developers who are comfortable with developing and using their own extensions. Do not enable it if you have no idea what it means or if you're not **absolutely sure** that the extension URL you're using is safe. ##### `parameters` A list of keys and values that will be sent to the extension as query paramters. ### Weather Display weather information for a specific location. The data is provided by https://open-meteo.com/. Example: ```yaml - type: weather units: metric hour-format: 12h location: London, United Kingdom ``` > [!NOTE] > > US cities which have common names can have their state specified as the second parameter as such: > > * Greenville, North Carolina, United States > * Greenville, South Carolina, United States > * Greenville, Mississippi, United States Preview: ![](images/weather-widget-preview.png) Each bar represents a 2 hour interval. The yellow background represents sunrise and sunset. The blue dots represent the times of the day where there is a high chance for precipitation. You can hover over the bars to view the exact temperature for that time. #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | location | string | yes | | | units | string | no | metric | | hour-format | string | no | 12h | | hide-location | boolean | no | false | | show-area-name | boolean | no | false | ##### `location` The name of the city and country to fetch weather information for. Attempting to launch the applcation with an invalid location will result in an error. You can use the [gecoding API page](https://open-meteo.com/en/docs/geocoding-api) to search for your specific location. Glance will use the first result from the list if there are multiple. ##### `units` Whether to show the temperature in celsius or fahrenheit, possible values are `metric` or `imperial`. #### `hour-format` Whether to show the hours of the day in 12-hour format or 24-hour format. Possible values are `12h` and `24h`. ##### `hide-location` Optionally don't display the location name on the widget. ##### `show-area-name` Whether to display the state/administrative area in the location name. If set to `true` the location will be displayed as: ``` Greenville, North Carolina, United States ``` Otherwise, if set to `false` (which is the default) it'll be displayed as: ``` Greenville, United States ``` ### Monitor Display a list of sites and whether they are reachable (online) or not. This is determined by sending a GET request to the specified URL, if the response is 200 then the site is OK. The time it took to receive a response is also shown in milliseconds. Example: ```yaml - type: monitor cache: 1m title: Services sites: - title: Jellyfin url: https://jellyfin.yourdomain.com icon: /assets/jellyfin-logo.png - title: Gitea url: https://gitea.yourdomain.com icon: /assets/gitea-logo.png - title: Immich url: https://immich.yourdomain.com icon: /assets/immich-logo.png - title: AdGuard Home url: https://adguard.yourdomain.com icon: /assets/adguard-logo.png - title: Vaultwarden url: https://vault.yourdomain.com icon: /assets/vaultwarden-logo.png ``` Preview: ![](images/monitor-widget-preview.png) You can hover over the "ERROR" text to view more information. #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | sites | array | yes | | | style | string | no | | | show-failing-only | boolean | no | false | ##### `show-failing-only` Shows only a list of failing sites when set to `true`. ##### `style` Used to change the appearance of the widget. Possible values are `compact`. Preview of `compact`: ![](images/monitor-widget-compact-preview.png) ##### `sites` Properties for each site: | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | title | string | yes | | | url | string | yes | | | check-url | string | no | | | error-url | string | no | | | icon | string | no | | | allow-insecure | boolean | no | false | | same-tab | boolean | no | false | | alt-status-codes | array | no | | `title` The title used to indicate the site. `url` The URL of the monitored service, which must be reachable by Glance, and will be used as the link to go to when clicking on the title. If `check-url` is not specified, this is used as the status check. `check-url` The URL which will be requested and its response will determine the status of the site. If not specified, the `url` property is used. `error-url` If the monitored service returns an error, the user will be redirected here. If not specified, the `url` property is used. `icon` Optional URL to an image which will be used as the icon for the site. Can be an external URL or internal via [server configured assets](#assets-path). You can also directly use [Simple Icons](https://simpleicons.org/) via a `si:` prefix or [Dashboard Icons](https://github.com/walkxcode/dashboard-icons) via a `di:` prefix: ```yaml icon: si:jellyfin icon: si:gitea icon: si:adguard ``` > [!WARNING] > > Simple Icons are loaded externally and are hosted on `cdn.jsdelivr.net`, if you do not wish to depend on a 3rd party you are free to download the icons individually and host them locally. `allow-insecure` Whether to ignore invalid/self-signed certificates. `same-tab` Whether to open the link in the same or a new tab. `alt-status-codes` Status codes other than 200 that you want to return "OK". ```yaml alt-status-codes: - 403 ``` ### Releases Display a list of latest releases for specific repositories on Github, GitLab, Codeberg or Docker Hub. Example: ```yaml - type: releases show-source-icon: true repositories: - go-gitea/gitea - jellyfin/jellyfin - glanceapp/glance - codeberg:redict/redict - gitlab:fdroid/fdroidclient - dockerhub:gotify/server ``` Preview: ![](images/releases-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | repositories | array | yes | | | show-source-icon | boolean | no | false | | | token | string | no | | | gitlab-token | string | no | | | limit | integer | no | 10 | | collapse-after | integer | no | 5 | ##### `repositories` A list of repositores to fetch the latest release for. Only the name/repo is required, not the full URL. A prefix can be specified for repositories hosted elsewhere such as GitLab, Codeberg and Docker Hub. Example: ```yaml repositories: - gitlab:inkscape/inkscape - dockerhub:glanceapp/glance - codeberg:redict/redict ``` Official images on Docker Hub can be specified by omitting the owner: ```yaml repositories: - dockerhub:nginx - dockerhub:node - dockerhub:alpine ``` You can also specify exact tags for Docker Hub images: ```yaml repositories: - dockerhub:nginx:latest - dockerhub:nginx:stable-alpine ``` To include prereleases you can specify the repository as an object and use the `include-prereleases` property: **Note: This feature is currently only available for GitHub repositories.** ```yaml repositories: - gitlab:inkscape/inkscape - repository: glanceapp/glance include-prereleases: true - codeberg:redict/redict ``` ##### `show-source-icon` Shows an icon of the source (GitHub/GitLab/Codeberg/Docker Hub) next to the repository name when set to `true`. ##### `token` Without authentication Github allows for up to 60 requests per hour. You can easily exceed this limit and start seeing errors if you're tracking lots of repositories or your cache time is low. To circumvent this you can [create a read only token from your Github account](https://github.com/settings/personal-access-tokens/new) and provide it here. You can also specify the value for this token through an ENV variable using the syntax `${GITHUB_TOKEN}` where `GITHUB_TOKEN` is the name of the variable that holds the token. If you've installed Glance through docker you can specify the token in your docker-compose: ```yaml services: glance: image: glanceapp/glance environment: - GITHUB_TOKEN= ``` and then use it in your `glance.yml` like this: ```yaml - type: releases token: ${GITHUB_TOKEN} repositories: ... ``` This way you can safely check your `glance.yml` in version control without exposing the token. ##### `gitlab-token` Same as the above but used when fetching GitLab releases. ##### `limit` The maximum number of releases to show. #### `collapse-after` How many releases are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. ### Docker Containers Display the status of your Docker containers along with an icon and an optional short description. ![](images/docker-containers-preview.png) ```yaml - type: docker-containers hide-by-default: false ``` > [!NOTE] > > The widget requires access to `docker.sock`. If you're running Glance inside a container, this can be done by mounting the socket as a volume: > > ```yaml > services: > glance: > image: glanceapp/glance > volumes: > - /var/run/docker.sock:/var/run/docker.sock > ``` Configuration of the containers is done via labels applied to each container: ```yaml jellyfin: image: jellyfin/jellyfin:latest labels: glance.name: Jellyfin glance.icon: si:jellyfin glance.url: https://jellyfin.domain.com glance.description: Movies & shows ``` For services with multiple containers you can specify a `glance.id` on the "main" container and `glance.parent` on each "child" container:
View docker-compose.yml
```yaml services: immich-server: image: ghcr.io/immich-app/immich-server labels: glance.name: Immich glance.icon: si:immich glance.url: https://immich.domain.com glance.description: Image & video management glance.id: immich redis: image: docker.io/redis:6.2-alpine labels: glance.parent: immich glance.name: Redis database: image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0 labels: glance.parent: immich glance.name: DB proxy: image: nginx:stable labels: glance.parent: immich glance.name: Proxy ```

This will place all child containers under the `Immich` container when hovering over its icon: ![](images/docker-container-parent.png) If any of the child containers are down, their status will propagate up to the parent container: ![](images/docker-container-parent2.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | hide-by-default | boolean | no | false | | sock-path | string | no | /var/run/docker.sock | ##### `hide-by-default` Whether to hide the containers by default. If set to `true` you'll have to manually add a `glance.hide: false` label to each container you want to display. By default all containers will be shown and if you want to hide a specific container you can add a `glance.hide: true` label. ##### `sock-path` The path to the Docker socket. #### Labels | Name | Description | | ---- | ----------- | | glance.name | The name displayed in the UI. If not specified, the name of the container will be used. | | glance.icon | The icon displayed in the UI. Can be an external URL or an icon prefixed with si:, sh: or di: like with the bookmarks and monitor widgets | | glance.url | The URL that the user will be redirected to when clicking on the container. | | glance.same-tab | Whether to open the link in the same or a new tab. Default is `false`. | | glance.description | A short description displayed in the UI. Default is empty. | | glance.hide | Whether to hide the container. If set to `true` the container will not be displayed. Defaults to `false`. | | glance.id | The custom ID of the container. Used to group containers under a single parent. | | glance.parent | The ID of the parent container. Used to group containers under a single parent. | ### DNS Stats Display statistics from a self-hosted ad-blocking DNS resolver such as AdGuard Home or Pi-hole. Example: ```yaml - type: dns-stats service: adguard url: https://adguard.domain.com/ username: admin password: ${ADGUARD_PASSWORD} ``` Preview: ![](images/dns-stats-widget-preview.png) > [!NOTE] > > When using AdGuard Home the 3rd statistic on top will be the average latency and when using Pi-hole it will be the total number of blocked domains from all adlists. #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | service | string | no | pihole | | allow-insecure | bool | no | false | | url | string | yes | | | username | string | when service is `adguard` | | | password | string | when service is `adguard` or `pihole-v6` | | | token | string | when service is `pihole` | | | hide-graph | bool | no | false | | hide-top-domains | bool | no | false | | hour-format | string | no | 12h | ##### `service` Either `adguard`, or `pihole` (major version 5 and below) or `pihole-v6` (major version 6 and above). ##### `allow-insecure` Whether to allow invalid/self-signed certificates when making the request to the service. ##### `url` The base URL of the service. ##### `username` Only required when using AdGuard Home. The username used to log into the admin dashboard. ##### `password` Required when using AdGuard Home, where the password is the one used to log into the admin dashboard. Also requried when using Pi-hole major version 6 and above, where the password is the one used to log into the admin dashboard or the application password, which can be found in `Settings -> Web Interface / API -> Configure app password`. ##### `token` Only required when using Pi-hole major version 5 or earlier. The API token which can be found in `Settings -> API -> Show API token`. ##### `hide-graph` Whether to hide the graph showing the number of queries over time. ##### `hide-top-domains` Whether to hide the list of top blocked domains. ##### `hour-format` Whether to display the relative time in the graph in `12h` or `24h` format. ### Server Stats Display statistics such as CPU usage, memory usage and disk usage of the server Glance is running on or other servers. Example: ```yaml - type: server-stats servers: - type: local name: Services ``` Preview: ![](images/server-stats-preview.gif) > [!NOTE] > > This widget is currently under development, some features might not function as expected or may change. To display data from a remote server you need to have the Glance Agent running on that server. You can download the agent from [here](https://github.com/glanceapp/agent), though keep in mind that it is still in development and may not work as expected. Support for other providers such as Glances will be added in the future. In the event that the CPU temperature goes over 80°C, a flame icon will appear next to the CPU. The progress indicators will also turn red (or the equivalent of your negative color) to hopefully grab your attention if anything is unusually high: ![](images/server-stats-flame-icon.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | servers | array | no | | ##### `servers` If not provided it will display the statistics of the server Glance is running on. ##### Properties for both `local` and `remote` servers | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | type | string | yes | | | name | string | no | | | hide-swap | boolean | no | false | ###### `type` Whether to display statistics for the local server or a remote server. Possible values are `local` and `remote`. ###### `name` The name of the server which will be displayed on the widget. If not provided it will default to the server's hostname. ###### `hide-swap` Whether to hide the swap usage. ##### Properties for the `local` server | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | cpu-temp-sensor | string | no | | | hide-mountpoints-by-default | boolean | no | false | | mountpoints | map\[string\]object | no | | ###### `cpu-temp-sensor` The name of the sensor to use for the CPU temperature. When not provided the widget will attempt to find the correct one, if it fails to do so the temperature will not be displayed. To view the available sensors you can use `sensors` command. ###### `hide-mountpoints-by-default` If set to `true` you'll have to manually make each mountpoint visible by adding a `hide: false` property to it like so: ```yaml - type: server-stats servers: - type: local hide-mountpoints-by-default: true mountpoints: "/": hide: false "/mnt/data": hide: false ``` This is useful if you're running Glance inside of a container which usually mounts a lot of irrelevant filesystems. ###### `mountpoints` A map of mountpoints to display disk usage for. The key is the path to the mountpoint and the value is an object with optional properties. Example: ```yaml mountpoints: "/": name: Root "/mnt/data": name: Data "/boot/efi": hide: true ``` ##### Properties for each `mountpoint` | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | name | string | no | | | hide | boolean | no | false | ###### `name` The name of the mountpoint which will be displayed on the widget. If not provided it will default to the mountpoint's path. ###### `hide` Whether to hide this mountpoint from the widget. ##### Properties for `remote` servers | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | url | string | yes | | | token | string | no | | | timeout | string | no | 3s | ###### `url` The URL and port of the server to fetch the statistics from. ###### `token` The authentication token to use when fetching the statistics. ###### `timeout` The maximum time to wait for a response from the server. The value is a string and must be a number followed by one of s, m, h, d. Example: `10s` for 10 seconds, `1m` for 1 minute, etc ### Repository Display general information about a repository as well as a list of the latest open pull requests and issues. Example: ```yaml - type: repository repository: glanceapp/glance pull-requests-limit: 5 issues-limit: 3 commits-limit: 3 ``` Preview: ![](images/repository-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | repository | string | yes | | | token | string | no | | | pull-requests-limit | integer | no | 3 | | issues-limit | integer | no | 3 | | commits-limit | integer | no | -1 | ##### `repository` The owner and repository name that will have their information displayed. ##### `token` Without authentication Github allows for up to 60 requests per hour. You can easily exceed this limit and start seeing errors if your cache time is low or you have many instances of this widget. To circumvent this you can [create a read only token from your Github account](https://github.com/settings/personal-access-tokens/new) and provide it here. ##### `pull-requests-limit` The maximum number of latest open pull requests to show. Set to `-1` to not show any. ##### `issues-limit` The maximum number of latest open issues to show. Set to `-1` to not show any. ##### `commits-limit` The maximum number of lastest commits to show from the default branch. Set to `-1` to not show any. ### Bookmarks Display a list of links which can be grouped. Example: ```yaml - type: bookmarks groups: - 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: Wikipedia url: https://en.wikipedia.org/ - title: Entertainment color: 10 70 50 links: - title: Netflix url: https://www.netflix.com/ - title: Disney+ url: https://www.disneyplus.com/ - title: YouTube url: https://www.youtube.com/ - title: Prime Video url: https://www.primevideo.com/ - title: Social color: 200 50 50 links: - title: Reddit url: https://www.reddit.com/ - title: Twitter url: https://twitter.com/ - title: Instagram url: https://www.instagram.com/ ``` Preview: ![](images/bookmarks-widget-preview.png) #### Properties | Name | Type | Required | | ---- | ---- | -------- | | groups | array | yes | ##### `groups` An array of groups which can optionally have a title and a custom color. ###### Properties for each group | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | title | string | no | | | color | HSL | no | the primary color of the theme | | links | array | yes | | | same-tab | boolean | no | false | | hide-arrow | boolean | no | false | | target | string | no | | > [!TIP] > > You can set `same-tab`, `hide-arrow` and `target` either on the group which will apply them to all links in that group, or on each individual link which will override the value set on the group. ###### Properties for each link | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | title | string | yes | | | url | string | yes | | | icon | string | no | | | same-tab | boolean | no | false | | hide-arrow | boolean | no | false | | target | string | no | | `icon` URL pointing to an image. You can also directly use [Simple Icons](https://simpleicons.org/) via a `si:` prefix or [Dashboard Icons](https://github.com/walkxcode/dashboard-icons) via a `di:` prefix: ```yaml icon: si:gmail icon: si:youtube icon: si:reddit ``` > [!WARNING] > > Simple Icons are loaded externally and are hosted on `cdn.jsdelivr.net`, if you do not wish to depend on a 3rd party you are free to download the icons individually and host them locally. `same-tab` Whether to open the link in the same tab or a new one. `hide-arrow` Whether to hide the colored arrow on each link. `target` Set a custom value for the link's `target` attribute. Possible values are `_blank`, `_self`, `_parent` and `_top`, you can read more about what they do [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). This property has precedence over `same-tab`. ### ChangeDetection.io Display a list watches from changedetection.io. Example ```yaml - type: change-detection instance-url: https://changedetection.mydomain.com/ token: ${CHANGE_DETECTION_TOKEN} ``` Preview: ![](images/change-detection-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | instance-url | string | no | `https://www.changedetection.io` | | token | string | no | | | limit | integer | no | 10 | | collapse-after | integer | no | 5 | | watches | array of strings | no | | ##### `instance-url` The URL pointing to your instance of `changedetection.io`. ##### `token` The API access token which can be found in `SETTINGS > API`. Optionally, you can specify this using an environment variable with the syntax `${VARIABLE_NAME}`. ##### `limit` The maximum number of watches to show. ##### `collapse-after` How many watches are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. ##### `watches` By default all of the configured watches will be shown. Optionally, you can specify a list of UUIDs for the specific watches you want to have listed: ```yaml - type: change-detection watches: - 1abca041-6d4f-4554-aa19-809147f538d3 - 705ed3e4-ea86-4d25-a064-822a6425be2c ``` ### Clock Display a clock showing the current time and date. Optionally, also display the the time in other timezones. Example: ```yaml - type: clock hour-format: 24h timezones: - timezone: Europe/Paris label: Paris - timezone: America/New_York label: New York - timezone: Asia/Tokyo label: Tokyo ``` Preview: ![](images/clock-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | hour-format | string | no | 24h | | timezones | array | no | | ##### `hour-format` Whether to show the time in 12 or 24 hour format. Possible values are `12h` and `24h`. #### Properties for each timezone | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | timezone | string | yes | | | label | string | no | | ##### `timezone` A timezone identifier such as `Europe/London`, `America/New_York`, etc. The full list of available identifiers can be found [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). ##### `label` Optionally, override the display value for the timezone to something more meaningful such as "Home", "Work" or anything else. ### Calendar Display a calendar. Example: ```yaml - type: calendar first-day-of-week: monday ``` Preview: ![](images/calendar-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | first-day-of-week | string | no | monday | ##### `first-day-of-week` The day of the week that the calendar starts on. All week days are available as possible values. ### Calendar (legacy) Display a calendar. Example: ```yaml - type: calendar-legacy start-sunday: false ``` Preview: ![](images/calendar-legacy-widget-preview.png) > [!NOTE] > > This widget is deprecated and may be removed in a future version. #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | start-sunday | boolean | no | false | ##### `start-sunday` Whether calendar weeks start on Sunday or Monday. > [!NOTE] > > There is currently little customizability available for the calendar. Extra features will be added in the future. ### Markets Display a list of markets, their current value, change for the day and a small 21d chart. Data is taken from Yahoo Finance. Example: ```yaml - type: markets markets: - symbol: SPY name: S&P 500 - symbol: BTC-USD name: Bitcoin chart-link: https://www.tradingview.com/chart/?symbol=INDEX:BTCUSD - symbol: NVDA name: NVIDIA - symbol: AAPL symbol-link: https://www.google.com/search?tbm=nws&q=apple name: Apple ``` Preview: ![](images/markets-widget-preview.png) #### Properties | Name | Type | Required | | ---- | ---- | -------- | | markets | array | yes | | sort-by | string | no | | chart-link-template | string | no | | symbol-link-template | string | no | ##### `markets` An array of markets for which to display information about. ##### `sort-by` By default the markets are displayed in the order they were defined. You can customize their ordering by setting the `sort-by` property to `change` for descending order based on the stock's percentage change (e.g. 1% would be sorted higher than -1%) or `absolute-change` for descending order based on the stock's absolute price change (e.g. -1% would be sorted higher than +0.5%). ##### `chart-link-template` A template for the link to go to when clicking on the chart that will be applied to all markets. The value `{SYMBOL}` will be replaced with the symbol of the market. You can override this on a per-market basis by specifying a `chart-link` property. Example: ```yaml chart-link-template: https://www.tradingview.com/chart/?symbol={SYMBOL} ``` ##### `symbol-link-template` A template for the link to go to when clicking on the symbol that will be applied to all markets. The value `{SYMBOL}` will be replaced with the symbol of the market. You can override this on a per-market basis by specifying a `symbol-link` property. Example: ```yaml symbol-link-template: https://www.google.com/search?tbm=nws&q={SYMBOL} ``` ###### Properties for each market | Name | Type | Required | | ---- | ---- | -------- | | symbol | string | yes | | name | string | no | | symbol-link | string | no | | chart-link | string | no | `symbol` The symbol, as seen in Yahoo Finance. `name` The name that will be displayed under the symbol. `symbol-link` The link to go to when clicking on the symbol. `chart-link` The link to go to when clicking on the chart. ### Twitch Channels Display a list of channels from Twitch. Example: ```yaml - type: twitch-channels channels: - jembawls - giantwaffle - asmongold - cohhcarnage - j_blow - xQc ``` Preview: ![](images/twitch-channels-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | channels | array | yes | | | collapse-after | integer | no | 5 | | sort-by | string | no | viewers | ##### `channels` A list of channels to display. ##### `collapse-after` How many channels are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. ##### `sort-by` Can be used to specify the order in which the channels are displayed. Possible values are `viewers` and `live`. ### Twitch top games Display a list of games with the most viewers on Twitch. Example: ```yaml - type: twitch-top-games exclude: - just-chatting - pools-hot-tubs-and-beaches - music - art - asmr ``` Preview: ![](images/twitch-top-games-widget-preview.png) #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | exclude | array | no | | | limit | integer | no | 10 | | collapse-after | integer | no | 5 | ##### `exclude` A list of categories that will never be shown. You must provide the slug found by clicking on the category and looking at the URL: ``` https://www.twitch.tv/directory/category/grand-theft-auto-v ^^^^^^^^^^^^^^^^^^ ``` ##### `limit` The maximum number of games to show. ##### `collapse-after` How many games are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse. ### iframe Embed an iframe as a widget. Example: ```yaml - type: iframe source: height: 400 ``` #### Properties | Name | Type | Required | Default | | ---- | ---- | -------- | ------- | | source | string | yes | | | height | integer | no | 300 | ##### `source` The source of the iframe. ##### `height` The height of the iframe. The minimum allowed height is 50. ### HTML Embed any HTML. Example: ```yaml - type: html source: |

Hello, World!

``` Note the use of `|` after `source:`, this allows you to insert a multi-line string. ## /docs/custom-api.md [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
{{ .JSON.String "title" }}
{{ .JSON.String "content" }}
``` Output: ```html
My Title
My Content
```
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" }}
{{ .String "title" }}
{{ .String "content" }}
{{ end }} ``` Output: ```html
My Title
My Content
My Title 2
My Content 2
``` 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" }}
{{ .String "title" }}
{{ .String "content" }}
{{ $.JSON.String "author" }}
{{ end }} ``` Output: ```html
My Title
My Content
John Doe
My Title 2
My Content 2
John Doe
```
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 "" }}
{{ .String "" }}
{{ end }} ``` Output: ```html
Apple
Banana
Cherry
Watermelon
``` To access an item at a specific index, you could use the following: ```html
{{ .JSON.String "0" }}
``` Output: ```html
Apple
```
JSON response: ```json { "user": { "address": { "city": "New York", "state": "NY" } } } ``` To easily access deeply nested objects, you can use the following dot notation: ```html
{{ .JSON.String "user.address.city" }}
{{ .JSON.String "user.address.state" }}
``` Output: ```html
New York
NY
``` Using indexes anywhere in the path is also supported: ```json { "users": [ { "name": "John Doe" }, { "name": "Jane Doe" } ] } ``` ```html
{{ .JSON.String "users.0.name" }}
{{ .JSON.String "users.1.name" }}
``` Output: ```html
John Doe
Jane Doe
```
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" }}
{{ .JSON.Int "user.age" }}
{{ else }}
Age not provided
{{ end }} ``` Output: ```html
30
```
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
{{ sub (.JSON.Int "price") (.JSON.Int "discount") }}
``` Output: ```html
90
``` Other operations include `add`, `mul`, and `div`.
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" }}
{{ .String "title" }}
{{ 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
Exploring the Depths of Quantum Computing
A Beginner's Guide to Sustainable Living
The Art of Baking Sourdough Bread
``` 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.
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 }}

Success!

{{ else }}

Failed to fetch data

{{ end }} ``` You can also access the response headers: ```html
{{ .Response.Header.Get "Content-Type" }}
```
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 }}

{{ .String "name" }} is {{ .Int "age" }} years old

{{ end }} ``` Output: ```html

Steve is 30 years old

Alex is 25 years old

John is 35 years old

``` 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" }}

{{ .String "" }}

{{ end }} ``` Output: ```html

Steve

Alex

John

``` ## 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. ``. - `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". - `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. 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. ## /docs/extensions.md # 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

Text with subdued color

Text with base color

Text with highlighted color

Text with primary color

Text with positive color

Text with negative color


Font size 1

Font size 2

Font size 3

Font size 4

Font size base

Font size 5

Font size 6


Link with visited indicator
Link with primary color if not visited

Event happened ago


  • horizontal
  • list
  • with
  • multiple
  • text
  • items

  • list
  • with
  • gap
  • and
  • horizontal
  • lines

  • collapsible
  • list
  • with
  • many
  • items
  • that
  • will
  • appear
  • when
  • you
  • click
  • the
  • button
  • below

Lazily loaded image:


List of posts:

``` 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.** ## /docs/glance.yml ```yml path="/docs/glance.yml" 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 ``` ## /docs/images/bookmarks-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/bookmarks-widget-preview.png ## /docs/images/calendar-legacy-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/calendar-legacy-widget-preview.png ## /docs/images/calendar-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/calendar-widget-preview.png ## /docs/images/change-detection-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/change-detection-widget-preview.png ## /docs/images/clock-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/clock-widget-preview.png ## /docs/images/column-configuration-1.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/column-configuration-1.png ## /docs/images/column-configuration-2.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/column-configuration-2.png ## /docs/images/column-configuration-3.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/column-configuration-3.png ## /docs/images/contrast-multiplier-example.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/contrast-multiplier-example.png ## /docs/images/custom-api-preview-1.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/custom-api-preview-1.png ## /docs/images/custom-api-preview-2.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/custom-api-preview-2.png ## /docs/images/custom-api-preview-3.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/custom-api-preview-3.png ## /docs/images/dns-stats-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/dns-stats-widget-preview.png ## /docs/images/docker-container-parent.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/docker-container-parent.png ## /docs/images/docker-container-parent2.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/docker-container-parent2.png ## /docs/images/docker-containers-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/docker-containers-preview.png ## /docs/images/docker-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/docker-widget-preview.png ## /docs/images/extension-html-reusing-existing-features-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/extension-html-reusing-existing-features-preview.png ## /docs/images/extension-overview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/extension-overview.png ## /docs/images/gaming-page-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/gaming-page-preview.png ## /docs/images/group-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/group-widget-preview.png ## /docs/images/hacker-news-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/hacker-news-widget-preview.png ## /docs/images/lobsters-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/lobsters-widget-preview.png ## /docs/images/markets-page-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/markets-page-preview.png ## /docs/images/markets-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/markets-widget-preview.png ## /docs/images/mobile-header-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/mobile-header-preview.png ## /docs/images/mobile-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/mobile-preview.png ## /docs/images/monitor-widget-compact-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/monitor-widget-compact-preview.png ## /docs/images/monitor-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/monitor-widget-preview.png ## /docs/images/pages-and-columns-illustration.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/pages-and-columns-illustration.png ## /docs/images/preconfigured-page-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/preconfigured-page-preview.png ## /docs/images/readme-main-image.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/readme-main-image.png ## /docs/images/reddit-field-search.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/reddit-field-search.png ## /docs/images/reddit-widget-horizontal-cards-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/reddit-widget-horizontal-cards-preview.png ## /docs/images/reddit-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/reddit-widget-preview.png ## /docs/images/reddit-widget-vertical-cards-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/reddit-widget-vertical-cards-preview.png ## /docs/images/reddit-widget-vertical-list-thumbnails.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/reddit-widget-vertical-list-thumbnails.png ## /docs/images/releases-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/releases-widget-preview.png ## /docs/images/repository-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/repository-preview.png ## /docs/images/rss-feed-horizontal-cards-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/rss-feed-horizontal-cards-preview.png ## /docs/images/rss-feed-vertical-list-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/rss-feed-vertical-list-preview.png ## /docs/images/rss-widget-detailed-list-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/rss-widget-detailed-list-preview.png ## /docs/images/rss-widget-horizontal-cards-2-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/rss-widget-horizontal-cards-2-preview.png ## /docs/images/search-widget-bangs-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/search-widget-bangs-preview.png ## /docs/images/search-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/search-widget-preview.png ## /docs/images/server-stats-flame-icon.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/server-stats-flame-icon.png ## /docs/images/server-stats-preview.gif Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/server-stats-preview.gif ## /docs/images/split-column-widget-3-columns.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/split-column-widget-3-columns.png ## /docs/images/split-column-widget-4-columns.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/split-column-widget-4-columns.png ## /docs/images/split-column-widget-masonry.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/split-column-widget-masonry.png ## /docs/images/split-column-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/split-column-widget-preview.png ## /docs/images/startpage-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/startpage-preview.png ## /docs/images/themes-example.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes-example.png ## /docs/images/themes/camouflage.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/camouflage.png ## /docs/images/themes/catppuccin-frappe.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/catppuccin-frappe.png ## /docs/images/themes/catppuccin-latte.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/catppuccin-latte.png ## /docs/images/themes/catppuccin-macchiato.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/catppuccin-macchiato.png ## /docs/images/themes/catppuccin-mocha.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/catppuccin-mocha.png ## /docs/images/themes/dracula.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/dracula.png ## /docs/images/themes/gruvbox.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/gruvbox.png ## /docs/images/themes/kanagawa-dark.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/kanagawa-dark.png ## /docs/images/themes/peachy.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/peachy.png ## /docs/images/themes/teal-city.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/teal-city.png ## /docs/images/themes/tucan.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/tucan.png ## /docs/images/themes/zebra.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/themes/zebra.png ## /docs/images/twitch-channels-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/twitch-channels-widget-preview.png ## /docs/images/twitch-top-games-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/twitch-top-games-widget-preview.png ## /docs/images/videos-channel-description-example.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/videos-channel-description-example.png ## /docs/images/videos-copy-channel-id-example.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/videos-copy-channel-id-example.png ## /docs/images/videos-widget-grid-cards-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/videos-widget-grid-cards-preview.png ## /docs/images/videos-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/videos-widget-preview.png ## /docs/images/videos-widget-vertical-list-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/videos-widget-vertical-list-preview.png ## /docs/images/weather-widget-preview.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/docs/images/weather-widget-preview.png ## /docs/preconfigured-pages.md # 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)
View config (requires Glance v0.6.0 or higher) ```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/ ```
## Markets ![](images/markets-page-preview.png)
View config (requires Glance v0.6.0 or higher) ```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 ```
## Gaming ![](images/gaming-page-preview.png)
View config (requires Glance v0.6.0 or higher) ```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 ```
## /docs/themes.md # Themes ## Dark ### Teal City ![screenshot](images/themes/teal-city.png) ```yaml theme: background-color: 225 14 15 primary-color: 157 47 65 contrast-multiplier: 1.1 ``` ### Catppuccin Frappe ![screenshot](images/themes/catppuccin-frappe.png) ```yaml theme: background-color: 229 19 23 contrast-multiplier: 1.2 primary-color: 222 74 74 positive-color: 96 44 68 negative-color: 359 68 71 ``` ### Catppuccin Macchiato ![screenshot](images/themes/catppuccin-macchiato.png) ```yaml theme: background-color: 232 23 18 contrast-multiplier: 1.2 primary-color: 220 83 75 positive-color: 105 48 72 negative-color: 351 74 73 ``` ### Catppuccin Mocha ![screenshot](images/themes/catppuccin-mocha.png) ```yaml theme: background-color: 240 21 15 contrast-multiplier: 1.2 primary-color: 217 92 83 positive-color: 115 54 76 negative-color: 347 70 65 ``` ### Camouflage ![screenshot](images/themes/camouflage.png) ```yaml theme: background-color: 186 21 20 contrast-multiplier: 1.2 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 theme: background-color: 50 1 6 primary-color: 24 97 58 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 ![screenshot](images/themes/catppuccin-latte.png) ```yaml theme: light: true background-color: 220 23 95 contrast-multiplier: 1.0 primary-color: 220 91 54 positive-color: 109 58 40 negative-color: 347 87 44 ``` ### Peachy ![screenshot](images/themes/peachy.png) ```yaml theme: light: true background-color: 28 40 77 primary-color: 155 100 20 negative-color: 0 100 60 contrast-multiplier: 1.1 text-saturation-multiplier: 0.5 ``` ### Zebra ![screenshot](images/themes/zebra.png) ```yaml theme: light: true background-color: 0 0 95 primary-color: 0 0 10 negative-color: 0 90 50 ``` ## /docs/v0.7.0-upgrade.md ## 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. ## /go.mod ```mod path="/go.mod" module github.com/glanceapp/glance go 1.24.2 require ( github.com/fsnotify/fsnotify v1.9.0 github.com/mmcdole/gofeed v1.3.0 github.com/shirou/gopsutil/v4 v4.25.3 github.com/tidwall/gjson v1.18.0 golang.org/x/text v0.24.0 gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/PuerkitoBio/goquery v1.10.2 // 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 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.39.0 // indirect golang.org/x/sys v0.32.0 // indirect ) ``` ## /go.sum ```sum path="/go.sum" 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/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 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 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= github.com/mmcdole/goxpp v1.1.1/go.mod h1:v+25+lT2ViuQ7mVxcncQ8ch1URund48oH+jhjiwEgS8= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 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/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.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/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.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/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.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/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.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.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/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= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= ``` ## /internal/glance/cli.go ```go path="/internal/glance/cli.go" package glance import ( "flag" "fmt" "os" "strings" "github.com/shirou/gopsutil/v4/disk" "github.com/shirou/gopsutil/v4/sensors" ) type cliIntent uint8 const ( cliIntentVersionPrint cliIntent = iota cliIntentServe cliIntentConfigValidate cliIntentConfigPrint cliIntentDiagnose cliIntentSensorsPrint cliIntentMountpointInfo ) type cliOptions struct { intent cliIntent configPath string args []string } 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(" sensors:print List all sensors") fmt.Println(" mountpoint:info Print information about a given mountpoint path") fmt.Println(" diagnose Run diagnostic checks") } configPath := flags.String("config", "glance.yml", "Set config path") err := flags.Parse(os.Args[1:]) if err != nil { return nil, err } var intent cliIntent args = flags.Args() unknownCommandErr := fmt.Errorf("unknown command: %s", strings.Join(args, " ")) 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 { 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, 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 } ``` ## /internal/glance/config-fields.go ```go path="/internal/glance/config-fields.go" package glance import ( "crypto/tls" "fmt" "net/http" "net/url" "regexp" "strconv" "strings" "time" "gopkg.in/yaml.v3" ) var hslColorFieldPattern = regexp.MustCompile(`^(?:hsla?\()?(\d{1,3})(?: |,)+(\d{1,3})%?(?: |,)+(\d{1,3})%?\)?$`) const ( hslHueMax = 360 hslSaturationMax = 100 hslLightnessMax = 100 ) type hslColorField struct { Hue uint16 Saturation uint8 Lightness uint8 } func (c *hslColorField) String() string { return fmt.Sprintf("hsl(%d, %d%%, %d%%)", c.Hue, c.Saturation, c.Lightness) } func (c *hslColorField) UnmarshalYAML(node *yaml.Node) error { var value string if err := node.Decode(&value); err != nil { return err } matches := hslColorFieldPattern.FindStringSubmatch(value) if len(matches) != 4 { return fmt.Errorf("invalid HSL color format: %s", value) } hue, err := strconv.ParseUint(matches[1], 10, 16) if err != nil { return err } if hue > hslHueMax { return fmt.Errorf("HSL hue must be between 0 and %d", hslHueMax) } saturation, err := strconv.ParseUint(matches[2], 10, 8) if err != nil { return err } if saturation > hslSaturationMax { return fmt.Errorf("HSL saturation must be between 0 and %d", hslSaturationMax) } lightness, err := strconv.ParseUint(matches[3], 10, 8) if err != nil { return err } if lightness > hslLightnessMax { return fmt.Errorf("HSL lightness must be between 0 and %d", hslLightnessMax) } c.Hue = uint16(hue) c.Saturation = uint8(saturation) c.Lightness = uint8(lightness) return nil } var durationFieldPattern = regexp.MustCompile(`^(\d+)(s|m|h|d)$`) type durationField time.Duration func (d *durationField) UnmarshalYAML(node *yaml.Node) error { var value string if err := node.Decode(&value); err != nil { return err } matches := durationFieldPattern.FindStringSubmatch(value) if len(matches) != 3 { return fmt.Errorf("invalid duration format: %s", value) } duration, err := strconv.Atoi(matches[1]) if err != nil { return err } switch matches[2] { case "s": *d = durationField(time.Duration(duration) * time.Second) case "m": *d = durationField(time.Duration(duration) * time.Minute) case "h": *d = durationField(time.Duration(duration) * time.Hour) case "d": *d = durationField(time.Duration(duration) * 24 * time.Hour) } return nil } type customIconField struct { URL string IsFlatIcon bool // TODO: along with whether the icon is flat, we also need to know // whether the icon is black or white by default in order to properly // invert the color based on the theme being light or dark } func newCustomIconField(value string) customIconField { field := customIconField{} prefix, icon, found := strings.Cut(value, ":") if !found { field.URL = value return field } switch prefix { case "si": field.URL = "https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/" + icon + ".svg" field.IsFlatIcon = true case "di", "sh": // syntax: di:[.svg|.png] // syntax: sh:[.svg|.png] // if the icon name is specified without extension, it is assumed to be wanting the SVG icon // otherwise, specify the extension of either .svg or .png to use either of the CDN offerings // any other extension will be interpreted as .svg basename, ext, found := strings.Cut(icon, ".") if !found { ext = "svg" basename = icon } if ext != "svg" && ext != "png" { ext = "svg" } if prefix == "di" { field.URL = "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/" + ext + "/" + basename + "." + ext } else { field.URL = "https://cdn.jsdelivr.net/gh/selfhst/icons/" + ext + "/" + basename + "." + ext } default: field.URL = value } return field } func (i *customIconField) UnmarshalYAML(node *yaml.Node) error { var value string if err := node.Decode(&value); err != nil { return err } *i = newCustomIconField(value) return nil } type proxyOptionsField struct { URL string `yaml:"url"` AllowInsecure bool `yaml:"allow-insecure"` Timeout durationField `yaml:"timeout"` client *http.Client `yaml:"-"` } func (p *proxyOptionsField) UnmarshalYAML(node *yaml.Node) error { type proxyOptionsFieldAlias proxyOptionsField alias := (*proxyOptionsFieldAlias)(p) var proxyURL string if err := node.Decode(&proxyURL); err != nil { if err := node.Decode(alias); err != nil { return err } } if proxyURL == "" && p.URL == "" { return nil } if p.URL != "" { proxyURL = p.URL } parsedUrl, err := url.Parse(proxyURL) if err != nil { return fmt.Errorf("parsing proxy URL: %v", err) } var timeout = defaultClientTimeout if p.Timeout > 0 { timeout = time.Duration(p.Timeout) } p.client = &http.Client{ Timeout: timeout, Transport: &http.Transport{ Proxy: http.ProxyURL(parsedUrl), TLSClientConfig: &tls.Config{InsecureSkipVerify: p.AllowInsecure}, }, } return nil } type queryParametersField map[string][]string func (q *queryParametersField) UnmarshalYAML(node *yaml.Node) error { var decoded map[string]any if err := node.Decode(&decoded); err != nil { return err } *q = make(queryParametersField) // TODO: refactor the duplication in the switch cases if any more types get added for key, value := range decoded { switch v := value.(type) { case string: (*q)[key] = []string{v} case int, int8, int16, int32, int64, float32, float64: (*q)[key] = []string{fmt.Sprintf("%v", v)} case bool: (*q)[key] = []string{fmt.Sprintf("%t", v)} case []string: (*q)[key] = append((*q)[key], v...) case []any: for _, item := range v { switch item := item.(type) { case string: (*q)[key] = append((*q)[key], item) case int, int8, int16, int32, int64, float32, float64: (*q)[key] = append((*q)[key], fmt.Sprintf("%v", item)) case bool: (*q)[key] = append((*q)[key], fmt.Sprintf("%t", item)) default: return fmt.Errorf("invalid query parameter value type: %T", item) } } default: return fmt.Errorf("invalid query parameter value type: %T", value) } } return nil } func (q *queryParametersField) toQueryString() string { query := url.Values{} for key, values := range *q { for _, value := range values { query.Add(key, value) } } return query.Encode() } ``` ## /internal/glance/config.go ```go path="/internal/glance/config.go" package glance import ( "bytes" "fmt" "html/template" "log" "maps" "os" "path/filepath" "regexp" "strings" "sync" "time" "github.com/fsnotify/fsnotify" "gopkg.in/yaml.v3" ) type config struct { Server struct { Host string `yaml:"host"` Port uint16 `yaml:"port"` AssetsPath string `yaml:"assets-path"` BaseURL string `yaml:"base-url"` StartedAt time.Time `yaml:"-"` // used in custom css file } `yaml:"server"` Document struct { Head template.HTML `yaml:"head"` } `yaml:"document"` Theme struct { BackgroundColor *hslColorField `yaml:"background-color"` PrimaryColor *hslColorField `yaml:"primary-color"` PositiveColor *hslColorField `yaml:"positive-color"` NegativeColor *hslColorField `yaml:"negative-color"` Light bool `yaml:"light"` ContrastMultiplier float32 `yaml:"contrast-multiplier"` TextSaturationMultiplier float32 `yaml:"text-saturation-multiplier"` CustomCSSFile string `yaml:"custom-css-file"` } `yaml:"theme"` Branding struct { HideFooter bool `yaml:"hide-footer"` CustomFooter template.HTML `yaml:"custom-footer"` LogoText string `yaml:"logo-text"` LogoURL string `yaml:"logo-url"` FaviconURL string `yaml:"favicon-url"` } `yaml:"branding"` Pages []page `yaml:"pages"` } type page struct { Title string `yaml:"name"` Slug string `yaml:"slug"` Width string `yaml:"width"` ShowMobileHeader bool `yaml:"show-mobile-header"` ExpandMobilePageNavigation bool `yaml:"expand-mobile-page-navigation"` HideDesktopNavigation bool `yaml:"hide-desktop-navigation"` CenterVertically bool `yaml:"center-vertically"` Columns []struct { Size string `yaml:"size"` Widgets widgets `yaml:"widgets"` } `yaml:"columns"` PrimaryColumnIndex int8 `yaml:"-"` mu sync.Mutex `yaml:"-"` } func newConfigFromYAML(contents []byte) (*config, error) { contents, err := parseConfigEnvVariables(contents) if err != nil { return nil, err } config := &config{} config.Server.Port = 8080 err = yaml.Unmarshal(contents, config) if err != nil { return nil, err } if err = isConfigStateValid(config); err != nil { return nil, err } for p := range config.Pages { for c := range config.Pages[p].Columns { for w := range config.Pages[p].Columns[c].Widgets { if err := config.Pages[p].Columns[c].Widgets[w].initialize(); err != nil { return nil, formatWidgetInitError(err, config.Pages[p].Columns[c].Widgets[w]) } } } } return config, nil } // TODO: change the pattern so that it doesn't match commented out lines var configEnvVariablePattern = regexp.MustCompile(`(^|.)\$\{([A-Z0-9_]+)\}`) func parseConfigEnvVariables(contents []byte) ([]byte, error) { var err error replaced := configEnvVariablePattern.ReplaceAllFunc(contents, func(match []byte) []byte { if err != nil { return nil } groups := configEnvVariablePattern.FindSubmatch(match) if len(groups) != 3 { return match } prefix, key := string(groups[1]), string(groups[2]) if prefix == `\` { if len(match) >= 2 { return match[1:] } else { return nil } } value, found := os.LookupEnv(key) if !found { err = fmt.Errorf("environment variable %s not found", key) return nil } return []byte(prefix + value) }) if err != nil { return nil, err } return replaced, nil } func formatWidgetInitError(err error, w widget) error { return fmt.Errorf("%s widget: %v", w.GetType(), err) } var includePattern = regexp.MustCompile(`(?m)^(\s*)!include:\s*(.+)$`) func parseYAMLIncludes(mainFilePath string) ([]byte, map[string]struct{}, error) { mainFileContents, err := os.ReadFile(mainFilePath) if err != nil { return nil, nil, fmt.Errorf("reading main YAML file: %w", err) } mainFileAbsPath, err := filepath.Abs(mainFilePath) if err != nil { return nil, nil, fmt.Errorf("getting absolute path of main YAML file: %w", err) } mainFileDir := filepath.Dir(mainFileAbsPath) includes := make(map[string]struct{}) var includesLastErr error mainFileContents = includePattern.ReplaceAllFunc(mainFileContents, func(match []byte) []byte { if includesLastErr != nil { return nil } matches := includePattern.FindSubmatch(match) if len(matches) != 3 { includesLastErr = fmt.Errorf("invalid include match: %v", matches) return nil } indent := string(matches[1]) includeFilePath := strings.TrimSpace(string(matches[2])) if !filepath.IsAbs(includeFilePath) { includeFilePath = filepath.Join(mainFileDir, includeFilePath) } var fileContents []byte var err error fileContents, err = os.ReadFile(includeFilePath) if err != nil { includesLastErr = fmt.Errorf("reading included file %s: %w", includeFilePath, err) return nil } includes[includeFilePath] = struct{}{} return []byte(prefixStringLines(indent, string(fileContents))) }) if includesLastErr != nil { return nil, nil, includesLastErr } return mainFileContents, includes, nil } func configFilesWatcher( mainFilePath string, lastContents []byte, lastIncludes map[string]struct{}, onChange func(newContents []byte), onErr func(error), ) (func() error, error) { mainFileAbsPath, err := filepath.Abs(mainFilePath) if err != nil { return nil, fmt.Errorf("getting absolute path of main file: %w", err) } // TODO: refactor, flaky lastIncludes[mainFileAbsPath] = struct{}{} watcher, err := fsnotify.NewWatcher() if err != nil { return nil, fmt.Errorf("creating watcher: %w", err) } updateWatchedFiles := func(previousWatched map[string]struct{}, newWatched map[string]struct{}) { for filePath := range previousWatched { if _, ok := newWatched[filePath]; !ok { watcher.Remove(filePath) } } for filePath := range newWatched { if _, ok := previousWatched[filePath]; !ok { if err := watcher.Add(filePath); err != nil { log.Printf( "Could not add file to watcher, changes to this file will not trigger a reload. path: %s, error: %v", filePath, err, ) } } } } updateWatchedFiles(nil, lastIncludes) // needed for lastContents and lastIncludes because they get updated in multiple goroutines mu := sync.Mutex{} parseAndCompareBeforeCallback := func() { currentContents, currentIncludes, err := parseYAMLIncludes(mainFilePath) if err != nil { onErr(fmt.Errorf("parsing main file contents for comparison: %w", err)) return } // TODO: refactor, flaky currentIncludes[mainFileAbsPath] = struct{}{} mu.Lock() defer mu.Unlock() if !maps.Equal(currentIncludes, lastIncludes) { updateWatchedFiles(lastIncludes, currentIncludes) lastIncludes = currentIncludes } if !bytes.Equal(lastContents, currentContents) { lastContents = currentContents onChange(currentContents) } } const debounceDuration = 500 * time.Millisecond var debounceTimer *time.Timer debouncedParseAndCompareBeforeCallback := func() { if debounceTimer != nil { debounceTimer.Stop() debounceTimer.Reset(debounceDuration) } else { debounceTimer = time.AfterFunc(debounceDuration, parseAndCompareBeforeCallback) } } deleteLastInclude := func(filePath string) { mu.Lock() defer mu.Unlock() fileAbsPath, _ := filepath.Abs(filePath) delete(lastIncludes, fileAbsPath) } go func() { for { select { case event, isOpen := <-watcher.Events: if !isOpen { return } if event.Has(fsnotify.Write) { debouncedParseAndCompareBeforeCallback() } else if event.Has(fsnotify.Rename) { // on linux the file will no longer be watched after a rename, on windows // it will continue to be watched with the new name but we have no access to // the new name in this event in order to stop watching it manually and match the // behavior in linux, may lead to weird unintended behaviors on windows as we're // only handling renames from linux's perspective // see https://github.com/fsnotify/fsnotify/issues/255 // remove the old file from our manually tracked includes, calling // debouncedParseAndCompareBeforeCallback will re-add it if it's still // required after it triggers deleteLastInclude(event.Name) // wait for file to maybe get created again // see https://github.com/glanceapp/glance/pull/358 for i := 0; i < 10; i++ { if _, err := os.Stat(event.Name); err == nil { break } time.Sleep(200 * time.Millisecond) } debouncedParseAndCompareBeforeCallback() } else if event.Has(fsnotify.Remove) { deleteLastInclude(event.Name) debouncedParseAndCompareBeforeCallback() } case err, isOpen := <-watcher.Errors: if !isOpen { return } onErr(fmt.Errorf("watcher error: %w", err)) } } }() onChange(lastContents) return func() error { if debounceTimer != nil { debounceTimer.Stop() } return watcher.Close() }, nil } func isConfigStateValid(config *config) error { if len(config.Pages) == 0 { return fmt.Errorf("no pages configured") } if config.Server.AssetsPath != "" { if _, err := os.Stat(config.Server.AssetsPath); os.IsNotExist(err) { return fmt.Errorf("assets directory does not exist: %s", config.Server.AssetsPath) } } for i := range config.Pages { if config.Pages[i].Title == "" { return fmt.Errorf("page %d has no name", i+1) } if config.Pages[i].Width != "" && (config.Pages[i].Width != "wide" && config.Pages[i].Width != "slim") { return fmt.Errorf("page %d: width can only be either wide or slim", i+1) } if len(config.Pages[i].Columns) == 0 { return fmt.Errorf("page %d has no columns", i+1) } if config.Pages[i].Width == "slim" { if len(config.Pages[i].Columns) > 2 { return fmt.Errorf("page %d is slim and cannot have more than 2 columns", i+1) } } else { if len(config.Pages[i].Columns) > 3 { return fmt.Errorf("page %d has more than 3 columns", i+1) } } columnSizesCount := make(map[string]int) for j := range config.Pages[i].Columns { if config.Pages[i].Columns[j].Size != "small" && config.Pages[i].Columns[j].Size != "full" { return fmt.Errorf("column %d of page %d: size can only be either small or full", j+1, i+1) } columnSizesCount[config.Pages[i].Columns[j].Size]++ } full := columnSizesCount["full"] if full > 2 || full == 0 { return fmt.Errorf("page %d must have either 1 or 2 full width columns", i+1) } } return nil } ``` ## /internal/glance/diagnose.go ```go path="/internal/glance/diagnose.go" package glance import ( "context" "fmt" "io" "net" "net/http" "runtime" "strings" "sync" "time" ) const httpTestRequestTimeout = 10 * time.Second var diagnosticSteps = []diagnosticStep{ { name: "resolve cloudflare.com through Cloudflare DoH", fn: func() (string, error) { return testHttpRequestWithHeaders("GET", "https://1.1.1.1/dns-query?name=cloudflare.com", map[string]string{ "accept": "application/dns-json", }, 200) }, }, { name: "resolve cloudflare.com through Google DoH", fn: func() (string, error) { return testHttpRequest("GET", "https://8.8.8.8/resolve?name=cloudflare.com", 200) }, }, { name: "resolve github.com", fn: func() (string, error) { return testDNSResolution("github.com") }, }, { name: "resolve reddit.com", fn: func() (string, error) { return testDNSResolution("reddit.com") }, }, { name: "resolve twitch.tv", fn: func() (string, error) { return testDNSResolution("twitch.tv") }, }, { name: "fetch data from YouTube RSS feed", fn: func() (string, error) { return testHttpRequest("GET", "https://www.youtube.com/feeds/videos.xml?channel_id=UCZU9T1ceaOgwfLRq7OKFU4Q", 200) }, }, { name: "fetch data from Twitch.tv GQL", fn: func() (string, error) { // this should always return 0 bytes, we're mainly looking for a 200 status code return testHttpRequest("OPTIONS", "https://gql.twitch.tv/gql", 200) }, }, { name: "fetch data from GitHub API", fn: func() (string, error) { return testHttpRequest("GET", "https://api.github.com", 200) }, }, { name: "fetch data from Open-Meteo API", fn: func() (string, error) { return testHttpRequest("GET", "https://geocoding-api.open-meteo.com/v1/search?name=London", 200) }, }, { name: "fetch data from Reddit API", fn: func() (string, error) { return testHttpRequest("GET", "https://www.reddit.com/search.json", 200) }, }, { name: "fetch data from Yahoo finance API", fn: func() (string, error) { return testHttpRequestWithHeaders("GET", "https://query1.finance.yahoo.com/v8/finance/chart/NVDA", map[string]string{ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0", }, 200) }, }, { name: "fetch data from Hacker News Firebase API", fn: func() (string, error) { return testHttpRequest("GET", "https://hacker-news.firebaseio.com/v0/topstories.json", 200) }, }, { name: "fetch data from Docker Hub API", fn: func() (string, error) { return testHttpRequest("GET", "https://hub.docker.com/v2/namespaces/library/repositories/ubuntu/tags/latest", 200) }, }, } func runDiagnostic() { fmt.Println("\`\`\`") fmt.Println("Glance version: " + buildVersion) fmt.Println("Go version: " + runtime.Version()) fmt.Printf("Platform: %s / %s / %d CPUs\n", runtime.GOOS, runtime.GOARCH, runtime.NumCPU()) fmt.Println("In Docker container: " + ternary(isRunningInsideDockerContainer(), "yes", "no")) fmt.Printf("\nChecking network connectivity, this may take up to %d seconds...\n\n", int(httpTestRequestTimeout.Seconds())) var wg sync.WaitGroup for i := range diagnosticSteps { step := &diagnosticSteps[i] wg.Add(1) go func() { defer wg.Done() start := time.Now() step.extraInfo, step.err = step.fn() step.elapsed = time.Since(start) }() } wg.Wait() for _, step := range diagnosticSteps { var extraInfo string if step.extraInfo != "" { extraInfo = "| " + step.extraInfo + " " } fmt.Printf( "%s %s %s| %dms\n", ternary(step.err == nil, "✓ Can", "✗ Can't"), step.name, extraInfo, step.elapsed.Milliseconds(), ) if step.err != nil { fmt.Printf("└╴ error: %v\n", step.err) } } fmt.Println("\`\`\`") } type diagnosticStep struct { name string fn func() (string, error) extraInfo string err error elapsed time.Duration } func testHttpRequest(method, url string, expectedStatusCode int) (string, error) { return testHttpRequestWithHeaders(method, url, nil, expectedStatusCode) } func testHttpRequestWithHeaders(method, url string, headers map[string]string, expectedStatusCode int) (string, error) { ctx, cancel := context.WithTimeout(context.Background(), httpTestRequestTimeout) defer cancel() request, _ := http.NewRequestWithContext(ctx, method, url, nil) for key, value := range headers { request.Header.Add(key, value) } response, err := http.DefaultClient.Do(request) if err != nil { return "", err } defer response.Body.Close() body, err := io.ReadAll(response.Body) if err != nil { return "", err } printableBody := strings.ReplaceAll(string(body), "\n", "") if len(printableBody) > 50 { printableBody = printableBody[:50] + "..." } if len(printableBody) > 0 { printableBody = ", " + printableBody } extraInfo := fmt.Sprintf("%d bytes%s", len(body), printableBody) if response.StatusCode != expectedStatusCode { return extraInfo, fmt.Errorf("expected status code %d, got %d", expectedStatusCode, response.StatusCode) } return extraInfo, nil } func testDNSResolution(domain string) (string, error) { ips, err := net.LookupIP(domain) var ipStrings []string if err == nil { for i := range ips { ipStrings = append(ipStrings, ips[i].String()) } } return strings.Join(ipStrings, ", "), err } ``` ## /internal/glance/embed.go ```go path="/internal/glance/embed.go" package glance import ( "crypto/md5" "embed" "encoding/hex" "io" "io/fs" "log" "strconv" "time" ) //go:embed static var _staticFS embed.FS //go:embed templates var _templateFS embed.FS var staticFS, _ = fs.Sub(_staticFS, "static") var templateFS, _ = fs.Sub(_templateFS, "templates") var staticFSHash = func() string { hash, err := computeFSHash(staticFS) if err != nil { log.Printf("Could not compute static assets cache key: %v", err) return strconv.FormatInt(time.Now().Unix(), 10) } return hash }() func computeFSHash(files fs.FS) (string, error) { hash := md5.New() err := fs.WalkDir(files, ".", func(path string, d fs.DirEntry, err error) error { if err != nil { return err } if d.IsDir() { return nil } file, err := files.Open(path) if err != nil { return err } if _, err := io.Copy(hash, file); err != nil { return err } return nil }) if err != nil { return "", err } return hex.EncodeToString(hash.Sum(nil))[:10], nil } ``` ## /internal/glance/glance.go ```go path="/internal/glance/glance.go" package glance import ( "bytes" "context" "fmt" "html/template" "log" "net/http" "path/filepath" "strconv" "strings" "sync" "time" ) var ( pageTemplate = mustParseTemplate("page.html", "document.html") pageContentTemplate = mustParseTemplate("page-content.html") pageThemeStyleTemplate = mustParseTemplate("theme-style.gotmpl") ) type application struct { Version string Config config ParsedThemeStyle template.HTML slugToPage map[string]*page widgetByID map[uint64]widget } func newApplication(config *config) (*application, error) { app := &application{ Version: buildVersion, Config: *config, slugToPage: make(map[string]*page), widgetByID: make(map[uint64]widget), } app.slugToPage[""] = &config.Pages[0] providers := &widgetProviders{ assetResolver: app.AssetPath, } var err error app.ParsedThemeStyle, err = executeTemplateToHTML(pageThemeStyleTemplate, &app.Config.Theme) if err != nil { return nil, fmt.Errorf("parsing theme style: %v", err) } for p := range config.Pages { page := &config.Pages[p] page.PrimaryColumnIndex = -1 if page.Slug == "" { page.Slug = titleToSlug(page.Title) } app.slugToPage[page.Slug] = page for c := range page.Columns { column := &page.Columns[c] if page.PrimaryColumnIndex == -1 && column.Size == "full" { page.PrimaryColumnIndex = int8(c) } for w := range column.Widgets { widget := column.Widgets[w] app.widgetByID[widget.GetID()] = widget widget.setProviders(providers) } } } config = &app.Config config.Server.BaseURL = strings.TrimRight(config.Server.BaseURL, "/") config.Theme.CustomCSSFile = app.transformUserDefinedAssetPath(config.Theme.CustomCSSFile) if config.Branding.FaviconURL == "" { config.Branding.FaviconURL = app.AssetPath("favicon.png") } else { config.Branding.FaviconURL = app.transformUserDefinedAssetPath(config.Branding.FaviconURL) } config.Branding.LogoURL = app.transformUserDefinedAssetPath(config.Branding.LogoURL) return app, nil } func (p *page) updateOutdatedWidgets() { now := time.Now() var wg sync.WaitGroup context := context.Background() for c := range p.Columns { for w := range p.Columns[c].Widgets { widget := p.Columns[c].Widgets[w] if !widget.requiresUpdate(&now) { continue } wg.Add(1) go func() { defer wg.Done() widget.update(context) }() } } wg.Wait() } func (a *application) transformUserDefinedAssetPath(path string) string { if strings.HasPrefix(path, "/assets/") { return a.Config.Server.BaseURL + path } return path } type pageTemplateData struct { App *application Page *page } func (a *application) handlePageRequest(w http.ResponseWriter, r *http.Request) { page, exists := a.slugToPage[r.PathValue("page")] if !exists { a.handleNotFound(w, r) return } pageData := pageTemplateData{ Page: page, App: a, } var responseBytes bytes.Buffer err := pageTemplate.Execute(&responseBytes, pageData) if err != nil { w.WriteHeader(http.StatusInternalServerError) w.Write([]byte(err.Error())) return } w.Write(responseBytes.Bytes()) } func (a *application) handlePageContentRequest(w http.ResponseWriter, r *http.Request) { page, exists := a.slugToPage[r.PathValue("page")] if !exists { a.handleNotFound(w, r) return } pageData := pageTemplateData{ Page: page, } var err error var responseBytes bytes.Buffer func() { page.mu.Lock() defer page.mu.Unlock() page.updateOutdatedWidgets() err = pageContentTemplate.Execute(&responseBytes, pageData) }() if err != nil { w.WriteHeader(http.StatusInternalServerError) w.Write([]byte(err.Error())) return } w.Write(responseBytes.Bytes()) } func (a *application) handleNotFound(w http.ResponseWriter, _ *http.Request) { // TODO: add proper not found page w.WriteHeader(http.StatusNotFound) w.Write([]byte("Page not found")) } func (a *application) handleWidgetRequest(w http.ResponseWriter, r *http.Request) { widgetValue := r.PathValue("widget") widgetID, err := strconv.ParseUint(widgetValue, 10, 64) if err != nil { a.handleNotFound(w, r) return } widget, exists := a.widgetByID[widgetID] if !exists { a.handleNotFound(w, r) return } widget.handleRequest(w, r) } func (a *application) AssetPath(asset string) string { return a.Config.Server.BaseURL + "/static/" + staticFSHash + "/" + asset } func (a *application) server() (func() error, func() error) { // TODO: add gzip support, static files must have their gzipped contents cached // TODO: add HTTPS support mux := http.NewServeMux() mux.HandleFunc("GET /{$}", a.handlePageRequest) mux.HandleFunc("GET /{page}", a.handlePageRequest) mux.HandleFunc("GET /api/pages/{page}/content/{$}", a.handlePageContentRequest) mux.HandleFunc("/api/widgets/{widget}/{path...}", a.handleWidgetRequest) mux.HandleFunc("GET /api/healthz", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) }) mux.Handle( fmt.Sprintf("GET /static/%s/{path...}", staticFSHash), http.StripPrefix("/static/"+staticFSHash, fileServerWithCache(http.FS(staticFS), 24*time.Hour)), ) var absAssetsPath string if a.Config.Server.AssetsPath != "" { absAssetsPath, _ = filepath.Abs(a.Config.Server.AssetsPath) assetsFS := fileServerWithCache(http.Dir(a.Config.Server.AssetsPath), 2*time.Hour) mux.Handle("/assets/{path...}", http.StripPrefix("/assets/", assetsFS)) } server := http.Server{ Addr: fmt.Sprintf("%s:%d", a.Config.Server.Host, a.Config.Server.Port), Handler: mux, } start := func() error { a.Config.Server.StartedAt = time.Now() log.Printf("Starting server on %s:%d (base-url: \"%s\", assets-path: \"%s\")\n", a.Config.Server.Host, a.Config.Server.Port, a.Config.Server.BaseURL, absAssetsPath, ) if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed { return err } return nil } stop := func() error { return server.Close() } return start, stop } ``` ## /internal/glance/main.go ```go path="/internal/glance/main.go" package glance import ( "fmt" "io" "log" "net/http" "os" ) var buildVersion = "dev" func Main() int { options, err := parseCliOptions() if err != nil { fmt.Println(err) return 1 } switch options.intent { case cliIntentVersionPrint: fmt.Println(buildVersion) case cliIntentServe: // remove in v0.10.0 if serveUpdateNoticeIfConfigLocationNotMigrated(options.configPath) { return 1 } if err := serveApp(options.configPath); err != nil { fmt.Println(err) return 1 } case cliIntentConfigValidate: contents, _, err := parseYAMLIncludes(options.configPath) if err != nil { fmt.Printf("Could not parse config file: %v\n", err) return 1 } if _, err := newConfigFromYAML(contents); err != nil { fmt.Printf("Config file is invalid: %v\n", err) return 1 } case cliIntentConfigPrint: contents, _, err := parseYAMLIncludes(options.configPath) if err != nil { fmt.Printf("Could not parse config file: %v\n", err) return 1 } fmt.Println(string(contents)) case cliIntentSensorsPrint: return cliSensorsPrint() case cliIntentMountpointInfo: return cliMountpointInfo(options.args[1]) case cliIntentDiagnose: runDiagnostic() } return 0 } func serveApp(configPath string) error { exitChannel := make(chan struct{}) hadValidConfigOnStartup := false var stopServer func() error onChange := func(newContents []byte) { if stopServer != nil { log.Println("Config file changed, reloading...") } config, err := newConfigFromYAML(newContents) if err != nil { log.Printf("Config has errors: %v", err) if !hadValidConfigOnStartup { close(exitChannel) } return } else if !hadValidConfigOnStartup { hadValidConfigOnStartup = true } app, err := newApplication(config) if err != nil { log.Printf("Failed to create application: %v", err) return } if stopServer != nil { if err := stopServer(); err != nil { log.Printf("Error while trying to stop server: %v", err) } } go func() { var startServer func() error startServer, stopServer = app.server() if err := startServer(); err != nil { log.Printf("Failed to start server: %v", err) } }() } onErr := func(err error) { log.Printf("Error watching config files: %v", err) } configContents, configIncludes, err := parseYAMLIncludes(configPath) if err != nil { return fmt.Errorf("parsing config: %w", err) } stopWatching, err := configFilesWatcher(configPath, configContents, configIncludes, onChange, onErr) if err == nil { defer stopWatching() } else { log.Printf("Error starting file watcher, config file changes will require a manual restart. (%v)", err) config, err := newConfigFromYAML(configContents) if err != nil { return fmt.Errorf("validating config file: %w", err) } app, err := newApplication(config) if err != nil { return fmt.Errorf("creating application: %w", err) } startServer, _ := app.server() if err := startServer(); err != nil { return fmt.Errorf("starting server: %w", err) } } <-exitChannel return nil } func serveUpdateNoticeIfConfigLocationNotMigrated(configPath string) bool { if !isRunningInsideDockerContainer() { return false } if _, err := os.Stat(configPath); err == nil { return false } // glance.yml wasn't mounted to begin with or was incorrectly mounted as a directory if stat, err := os.Stat("glance.yml"); err != nil || stat.IsDir() { return false } templateFile, _ := templateFS.Open("v0.7-update-notice-page.html") bodyContents, _ := io.ReadAll(templateFile) fmt.Println("!!! WARNING !!!") fmt.Println("The default location of glance.yml in the Docker image has changed starting from v0.7.0.") fmt.Println("Please see https://github.com/glanceapp/glance/blob/main/docs/v0.7.0-upgrade.md for more information.") mux := http.NewServeMux() mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticFS)))) mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusServiceUnavailable) w.Header().Set("Content-Type", "text/html") w.Write([]byte(bodyContents)) }) server := http.Server{ Addr: ":8080", Handler: mux, } server.ListenAndServe() return true } ``` ## /internal/glance/static/app-icon.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/internal/glance/static/app-icon.png ## /internal/glance/static/favicon.png Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/internal/glance/static/favicon.png ## /internal/glance/static/fonts/JetBrainsMono-Regular.woff2 Binary file available at https://raw.githubusercontent.com/glanceapp/glance/refs/heads/main/internal/glance/static/fonts/JetBrainsMono-Regular.woff2 ## /internal/glance/static/icons/codeberg.svg ```svg path="/internal/glance/static/icons/codeberg.svg" ``` ## /internal/glance/static/icons/dockerhub.svg ```svg path="/internal/glance/static/icons/dockerhub.svg" ``` ## /internal/glance/static/icons/github.svg ```svg path="/internal/glance/static/icons/github.svg" ``` ## /internal/glance/static/icons/gitlab.svg ```svg path="/internal/glance/static/icons/gitlab.svg" ``` ## /internal/glance/static/js/animations.js ```js path="/internal/glance/static/js/animations.js" export const easeOutQuint = 'cubic-bezier(0.22, 1, 0.36, 1)'; export function directions(anim, opt, ...dirs) { return dirs.map(dir => anim({ direction: dir, ...opt })); } export function slideFade({ direction = 'left', fill = 'backwards', duration = 200, distance = '1rem', easing = 'ease', offset = 0, }) { const axis = direction === 'left' || direction === 'right' ? 'X' : 'Y'; const negative = direction === 'left' || direction === 'up' ? '-' : ''; const amount = negative + distance; return { keyframes: [ { offset: offset, opacity: 0, transform: `translate${axis}(${amount})`, } ], options: { duration: duration, easing: easing, fill: fill, }, }; } ``` ## /internal/glance/static/js/calendar.js ```js path="/internal/glance/static/js/calendar.js" import { directions, easeOutQuint, slideFade } from "./animations.js"; import { elem, repeat, text } from "./templating.js"; const FULL_MONTH_SLOTS = 7*6; const WEEKDAY_ABBRS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]; const MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; const leftArrowSvg = ` `; const rightArrowSvg = ` `; const undoArrowSvg = ` `; const [datesExitLeft, datesExitRight] = directions( slideFade, { distance: "2rem", duration: 120, offset: 1 }, "left", "right" ); const [datesEntranceLeft, datesEntranceRight] = directions( slideFade, { distance: "0.8rem", duration: 500, easing: easeOutQuint }, "left", "right" ); const undoEntrance = slideFade({ direction: "left", distance: "100%", duration: 300 }); export default function(element) { element.swap(Calendar( Number(element.dataset.firstDayOfWeek ?? 1) )); } // TODO: when viewing the previous/next month, display the current date if it's within the spill-over days function Calendar(firstDay) { let header, dates; let advanceTimeTicker; let now = new Date(); let activeDate; const update = (newDate) => { header.component.update(now, newDate); dates.component.update(now, newDate); activeDate = newDate; }; const autoAdvanceNow = () => { advanceTimeTicker = setTimeout(() => { // TODO: don't auto advance if looking at a different month update(now = new Date()); autoAdvanceNow(); }, msTillNextDay()); }; const adjacentMonth = (dir) => new Date(activeDate.getFullYear(), activeDate.getMonth() + dir, 1); const nextClicked = () => update(adjacentMonth(1)); const prevClicked = () => update(adjacentMonth(-1)); const undoClicked = () => update(now); const calendar = elem().classes("calendar").append( header = Header(nextClicked, prevClicked, undoClicked), dates = Dates(firstDay) ); update(now); autoAdvanceNow(); return calendar.component({ suspend: () => clearTimeout(advanceTimeTicker) }); } function Header(nextClicked, prevClicked, undoClicked) { let month, monthNumber, year, undo; const button = () => elem("button").classes("calendar-header-button"); const monthAndYear = elem().classes("size-h2", "color-highlight").append( month = text(), " ", year = elem("span").classes("size-h3"), undo = button() .hide() .classes("calendar-undo-button") .attr("title", "Back to current month") .on("click", undoClicked) .html(undoArrowSvg) ); const monthSwitcher = elem() .classes("flex", "gap-7", "items-center") .append( button() .attr("title", "Previous month") .on("click", prevClicked) .html(leftArrowSvg), monthNumber = elem() .classes("color-highlight") .styles({ marginTop: "0.1rem" }), button() .attr("title", "Next month") .on("click", nextClicked) .html(rightArrowSvg), ); return elem().classes("flex", "justify-between", "items-center").append( monthAndYear, monthSwitcher ).component({ update: function (now, newDate) { month.text(MONTH_NAMES[newDate.getMonth()]); year.text(newDate.getFullYear()); const m = newDate.getMonth() + 1; monthNumber.text((m < 10 ? "0" : "") + m); if (!datesWithinSameMonth(now, newDate)) { if (undo.isHidden()) undo.show().animate(undoEntrance); } else { undo.hide(); } return this; } }); } function Dates(firstDay) { let dates, lastRenderedDate; const updateFullMonth = function(now, newDate) { const firstWeekday = new Date(newDate.getFullYear(), newDate.getMonth(), 1).getDay(); const previousMonthSpilloverDays = (firstWeekday - firstDay + 7) % 7 || 7; const currentMonthDays = daysInMonth(newDate.getFullYear(), newDate.getMonth()); const nextMonthSpilloverDays = FULL_MONTH_SLOTS - (previousMonthSpilloverDays + currentMonthDays); const previousMonthDays = daysInMonth(newDate.getFullYear(), newDate.getMonth() - 1) const isCurrentMonth = datesWithinSameMonth(now, newDate); const currentDate = now.getDate(); let children = dates.children; let index = 0; for (let i = 0; i < FULL_MONTH_SLOTS; i++) { children[i].clearClasses("calendar-spillover-date", "calendar-current-date"); } for (let i = 0; i < previousMonthSpilloverDays; i++, index++) { children[index].classes("calendar-spillover-date").text( previousMonthDays - previousMonthSpilloverDays + i + 1 ) } for (let i = 1; i <= currentMonthDays; i++, index++) { children[index] .classesIf(isCurrentMonth && i === currentDate, "calendar-current-date") .text(i); } for (let i = 0; i < nextMonthSpilloverDays; i++, index++) { children[index].classes("calendar-spillover-date").text(i + 1); } lastRenderedDate = newDate; }; const update = function(now, newDate) { if (lastRenderedDate === undefined || datesWithinSameMonth(newDate, lastRenderedDate)) { updateFullMonth(now, newDate); return; } const next = newDate > lastRenderedDate; dates.animateUpdate( () => updateFullMonth(now, newDate), next ? datesExitLeft : datesExitRight, next ? datesEntranceRight : datesEntranceLeft, ); } return elem().append( elem().classes("calendar-dates", "margin-top-15").append( ...repeat(7, (i) => elem().classes("size-h6", "color-subdue").text( WEEKDAY_ABBRS[(firstDay + i) % 7] )) ), dates = elem().classes("calendar-dates", "margin-top-3").append( ...elem().classes("calendar-date").duplicate(FULL_MONTH_SLOTS) ) ).component({ update }); } function datesWithinSameMonth(d1, d2) { return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth(); } function daysInMonth(year, month) { return new Date(year, month + 1, 0).getDate(); } function msTillNextDay(now) { now = now || new Date(); return 86_400_000 - ( now.getMilliseconds() + now.getSeconds() * 1000 + now.getMinutes() * 60_000 + now.getHours() * 3_600_000 ); } ``` The content has been capped at 50000 tokens, and files over NaN bytes have been omitted. The user could consider applying other filters to refine the result. The better and more specific the context, the better the LLM can follow instructions. If the context seems verbose, the user can refine the filter using uithub. Thank you for using https://uithub.com - Perfect LLM context for any GitHub repo.