From 8eb4355ae3dc8cd51ad62df3a0ebfae3c6b6534c Mon Sep 17 00:00:00 2001 From: juls0730 <62722391+juls0730@users.noreply.github.com> Date: Thu, 3 Apr 2025 19:49:16 +0000 Subject: [PATCH] fix font family and bugs, better docs --- .env example => .env.example | 0 README.md | 25 ++++++++++++++++++------- main.go | 7 ++----- styles/main.css | 4 ++++ 4 files changed, 24 insertions(+), 12 deletions(-) rename .env example => .env.example (100%) diff --git a/.env example b/.env.example similarity index 100% rename from .env example rename to .env.example diff --git a/README.md b/README.md index 9977787..1242328 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,27 @@ Passport is a simple, fast, and lightweight web dashboard/new tab replacement. ### Usage 1. Clone the repository -2. Configure the `.env` file, an example is provided in the `.env example` file - - The `OPENWEATHER_API_KEY` is required for the weather data to be displayed, if you want to disable the weather data, set `PASSPORT_ENABLE_WEATHER` to `false` - - The `OPENWEATHER_LAT` and `OPENWEATHER_LON` are required for the weather data to be displayed - - The `PASSPORT_ADMIN_USERNAME` and `PASSPORT_ADMIN_PASSWORD` are required for the admin dashboard - - The `PASSPORT_SEARCH_PROVIDER` is the search provider used for the search bar, %s is replaced with the search query - - The `UPTIMEROBOT_API_KEY` is required for the uptime data to be displayed, if you want to disable the uptime data, set `PASSPORT_ENABLE_UPTIME` to `false` -3. Run `zqdgr build` to build a standalone binary +2. Configure the `.env` file, an example is provided in the `.env.example` file, see below for every available environment variable 4. Deploy `passport` to your web server 5. profit +#### Configuration + +| Environment Variable | Description | Required | Default | +| --- | --- | --- | --- | +| `PASSPORT_DEV_MODE` | Enables dev mode | false | false | +| `PASSPORT_ENABLE_WEATHER` | Enables weather data, requires an OpenWeather API key | false | true | +| `PASSPORT_ENABLE_UPTIME` | Enables uptime data, requires an UptimeRobot API key | false | true | +| `PASSPORT_ADMIN_USERNAME` | The username for the admin dashboard | true | +| `PASSPORT_ADMIN_PASSWORD` | The password for the admin dashboard | true | +| `PASSPORT_SEARCH_PROVIDER` | The search provider to use for the search bar | true | +| `OPENWEATHER_API_KEY` | The OpenWeather API key | if enabled | +| `OPENWEATHER_LAT` | The latitude of your location | if enabled | +| `OPENWEATHER_LON` | The longitude of your location | if enabled | +| `OPENWEATHER_UPDATE_INTERVAL` | The interval in minutes to update the weather data | false | 15 | +| `UPTIMEROBOT_API_KEY` | The UptimeRobot API key | if enabled | +| `UPTIMEROBOT_UPDATE_INTERVAL` | The interval in seconds to update the uptime data | false | 300 | + ### Adding links and categories The admin dashboard can be accessed at `/admin`, you will be redirected to the login page if you are not logged in, use the credentials you configured in the `.env` file to login. Once logged in you can add links and categories. diff --git a/main.go b/main.go index b1ce438..c623ff6 100644 --- a/main.go +++ b/main.go @@ -135,7 +135,7 @@ func NewUptimeManager() *UptimeManager { updateInterval, err := strconv.Atoi(os.Getenv("UPTIMEROBOT_UPDATE_INTERVAL")) if err != nil || updateInterval < 1 { - updateInterval = 5 + updateInterval = 300 } uptimeManager := &UptimeManager{ @@ -159,7 +159,7 @@ func (u *UptimeManager) getUptime() []UptimeRobotSite { } func (u *UptimeManager) updateWorker() { - ticker := time.NewTicker(time.Duration(u.updateInterval) * time.Minute) + ticker := time.NewTicker(time.Duration(u.updateInterval) * time.Second) defer ticker.Stop() for { @@ -196,8 +196,6 @@ func (u *UptimeManager) update() { return } - fmt.Printf("%+v", monitors.Monitors) - u.mutex.Lock() u.sites = monitors.Monitors u.lastUpdate = time.Now() @@ -675,7 +673,6 @@ func main() { } if os.Getenv("PASSPORT_ENABLE_UPTIME") != "false" { - fmt.Printf("%+v", app.UptimeManager.getUptime()) renderData["UptimeData"] = app.UptimeManager.getUptime() } diff --git a/styles/main.css b/styles/main.css index 7fdd61a..71503d6 100644 --- a/styles/main.css +++ b/styles/main.css @@ -6,6 +6,10 @@ font-display: swap; } +:root { + --default-font-family: "Instrument Sans", ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; +} + html { line-height: normal; color-scheme: dark;