announce

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package announce fetches a small remote "announcement" document from a static URL (a raw file in the GitHub repo) so the status window can show occasional messages - a promo, a heads-up, a migration notice - without shipping a new build. It is best-effort and read-only: any error yields an inactive announcement so the UI simply shows nothing.

Index

Constants

This section is empty.

Variables

View Source
var SourceURL = "https://raw.githubusercontent.com/codepurse/extension-guard/main/announcement.json"

SourceURL is the raw announcement document the status window reads. It is a var so tests can point it at a local server. To change what users see, edit the file at this URL and push - no new release required (raw.githubusercontent.com caches for a few minutes).

Functions

This section is empty.

Types

type Announcement

type Announcement struct {
	ID         string `json:"id"`
	Active     bool   `json:"active"`
	Level      string `json:"level"`
	Title      string `json:"title"`
	Message    string `json:"message"`
	URL        string `json:"url"`
	URLFirefox string `json:"urlFirefox"`
	LinkText   string `json:"linkText"`
}

Announcement mirrors the announcement.json document. The schema is shared with the developer's other apps so one format serves all of them; unknown fields are ignored. An empty or Active=false document means "show nothing". Level is one of "info" (default), "warn", or "danger" and only drives banner styling. URL is the primary link (e.g. a Chrome Web Store page); URLFirefox is an optional browser-specific alternative the frontend falls back to.

func Fetch

func Fetch(ctx context.Context) (Announcement, error)

Fetch retrieves the announcement document. On any failure it returns a zero (Active=false) Announcement and the error; callers that only care about "is there anything to show" can ignore the error and check Active.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL