m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-13 07:33:48 -05:00

19 Commits

Author SHA1 Message Date
Sergio
5aeef51961 Update docs 2025-02-28 20:19:48 +02:00
Sergio
b015f67da4 Update links in docs 2025-02-28 19:59:48 +02:00
Sergio
0f0941b555 Add new docs pages 2025-02-28 19:58:02 +02:00
Sergio
fa2629bb4f Update docs 2025-02-28 19:37:48 +02:00
Sergio
e2cc245a50 Update Cup GIF 2025-02-28 19:14:31 +02:00
Sergio
ce26ba8926 Update screenshots 2025-02-28 18:29:45 +02:00
Sergio
f268edf021 Fix refresh button sizing 2025-02-28 18:19:35 +02:00
Sergio
b378e472d6 Update community resources to reflect API changes 2025-02-28 17:42:00 +02:00
Sergio
d841861752 Revert a dbg that was accidentally committed 2025-02-28 17:33:24 +02:00
Sergio
4caa117a4e Fix bugs in Liquid 2025-02-28 17:30:57 +02:00
Sergio
02c5d00e66 Remove caniuse-lite from package.json 2025-02-28 17:20:13 +02:00
Sergio
040513dfd7 Improve image component in web 2025-02-28 17:07:13 +02:00
Sergio
ad03004f33 Improve loading page in web 2025-02-28 16:50:29 +02:00
Sergio
becf647f07 Fix typo in docs 2025-02-27 22:00:19 +02:00
Sergio
c437316291 Update docs 2025-02-27 21:58:49 +02:00
Sergio
2461f3b94b Update docs 2025-02-27 21:57:57 +02:00
Sergio
dd64b62f4b Update docs 2025-02-27 21:57:34 +02:00
Sergio
d77871cd92 Update docs 2025-02-27 21:54:45 +02:00
Sergio
c3dd4d2462 Remove unused code from docs 2025-02-27 21:52:56 +02:00
35 changed files with 313 additions and 360 deletions

View File

@@ -22,7 +22,7 @@ _If you like this project and/or use Cup, please consider starring the project
## Documentation 📘 ## Documentation 📘
Take a look at https://sergi0g.github.io/cup/docs! Take a look at https://cup.sergi0g.dev/docs!
## Limitations ## Limitations
@@ -44,7 +44,7 @@ Here are some ideas to get you started:
- Help optimize Cup and make it even better! - Help optimize Cup and make it even better!
- Add more features to the web UI - Add more features to the web UI
For more information, check the [docs](https://sergi0g.github.io/cup/docs/contributing)! For more information, check the [docs](https://cup.sergi0g.dev/docs/contributing)!
## Support ## Support

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

@@ -1,15 +0,0 @@
import React from "react";
export function GitHubIcon({ className }: { className?: string | undefined }) {
return (
<svg
width="24"
height="24"
fill="currentColor"
viewBox="3 3 18 18"
className={className}
>
<path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
</svg>
);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

@@ -35,9 +35,9 @@ services:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
``` ```
This can be customized further of course, if you choose to use a different port, another config location, or would like to change something else. Cup can run with a non-root user, but needs to be in a docker group. Assuming user id of 1000 and `docker` group id of 999 you can add this to the `services.cup` key in the docker compose:
Cup can run with a non-root user, but needs to be in a docker group. Assuming user id of 1000 and `docker` group id of 999 you can add this to the docker compose:
```yaml ```yaml
user: "1000:999" user: "1000:999"
``` ```
The compose can be customized further of course, if you choose to use a different port, another config location, or would like to change something else. Have fun!

View File

@@ -36,7 +36,7 @@ services:
homepage.widget.mappings[1].field.metrics: up_to_date homepage.widget.mappings[1].field.metrics: up_to_date
homepage.widget.mappings[1].format: number homepage.widget.mappings[1].format: number
homepage.widget.mappings[2].label: Updates homepage.widget.mappings[2].label: Updates
homepage.widget.mappings[2].field.metrics: update_available homepage.widget.mappings[2].field.metrics: updates_available
homepage.widget.mappings[2].format: number homepage.widget.mappings[2].format: number
``` ```
@@ -64,7 +64,7 @@ widget:
label: Up to date label: Up to date
format: number format: number
- field: - field:
metrics: update_available metrics: updates_available
label: Available updates label: Available updates
format: number format: number
- field: - field:

View File

@@ -0,0 +1,12 @@
# Agent mode
If you'd like to have only the server API exposed without the dashboard, you can run Cup in agent mode.
Modify your config like this:
```jsonc
{
"agent": true
// Other options
}
```

View File

@@ -4,7 +4,7 @@ import { Callout } from "nextra/components";
Some registries (or specific images) may require you to be authenticated. For those, you can modify `cup.json` like this: Some registries (or specific images) may require you to be authenticated. For those, you can modify `cup.json` like this:
```json ```jsonc
{ {
"registries": { "registries": {
"<YOUR_REGISTRY_DOMAIN_1>": { "<YOUR_REGISTRY_DOMAIN_1>": {

View File

@@ -0,0 +1,12 @@
# Automatic refresh
Cup can automatically refresh the results when running in server mode. Simply add this to your config:
```jsonc
{
"refresh_interval": "0 0,30 * 0 0" // Check twice an hour
// Other options
}
```
You can use a cron expression to specify the refresh interval. The reference is [here](https://github.com/Hexagon/croner-rust#pattern)

View File

@@ -0,0 +1,22 @@
# Ignored registries
If you want to skip checking images from some registries, you can modify your config like this:
```jsonc
{
"registries": {
"<SOME_REGISTRY_DOMAIN_1>": {
"ignore": true
// Other options
},
"<SOME_REGISTRY_DOMAIN_2>" {
"ignore": false
// Other options
},
// ...
}
// Other options
}
```
This configuration option is a bit redundant, since you can achieve the same with [this option](/docs/configuration/include-exclude-images). It's recommended to use that.

View File

@@ -0,0 +1,35 @@
# Include/Exclude images
If you want to exclude some images (e.g. because they have too many tags and take too long to check), you can add the following to your config:
```jsonc
{
"images": {
"exclude": [
"ghcr.io/immich-app/immich-machine-learning",
"postgres:15"
]
// ...
}
// Other options
}
```
For an image to be excluded, it must start with one of the strings you specify above. That means you could use `ghcr.io` to exclude all images from ghcr.io or `ghcr.io/sergi0g` to exclude all my images (why would you do that?).
If you want Cup to always check some extra images that aren't available locally, you can modify your config like this:
```jsonc
{
"images": {
"extra": [
"mysql:8.0",
"nextcloud:30"
]
// ...
}
// Other options
}
```
Note that you must specify images with version tags, otherwise Cup will exit with an error!

View File

@@ -8,7 +8,7 @@ import {
IconLockOpen, IconLockOpen,
IconKey, IconKey,
IconPlug, IconPlug,
IconServer IconServer,
} from "@tabler/icons-react"; } from "@tabler/icons-react";
# Configuration # Configuration
@@ -71,12 +71,21 @@ Here's a full example:
```json ```json
{ {
"authentication": { "$schema": "https://raw.githubusercontent.com/sergi0g/cup/main/cup.schema.json",
"ghcr.io": "<YOUR_TOKEN_HERE>", "version": 3,
"registry-1.docker.io": "<YOUR_TOKEN_HERE>" "images": {
"exclude": ["ghcr.io/immich-app/immich-machine-learning"],
"extra": ["ghcr.io/sergi0g/cup:v3.0.0"]
}, },
"theme": "blue", "registries": {
"insecure_registries": ["localhost:5000", "my-insecure-registry.example.com"] "myregistry.com": {
"authentication": "<YOUR_TOKEN_HERE>"
}
},
"servers": {
"Raspberry Pi": "https://server.local:8000"
},
"theme": "blue"
} }
``` ```

View File

@@ -8,7 +8,7 @@ To solve this problem, you can specify exceptions in your `cup.json`.
Here's what it looks like: Here's what it looks like:
```json ```jsonc
{ {
"registries": { "registries": {
"<INSECURE_REGISTRY_1>": { "<INSECURE_REGISTRY_1>": {

View File

@@ -4,7 +4,7 @@ Besides checking for local image updates, you might want to be able to view upda
Just add something like this to your config: Just add something like this to your config:
```json ```jsonc
{ {
"servers": { "servers": {
"Cool server 1": "http://your-other-server-running-cup:8000", "Cool server 1": "http://your-other-server-running-cup:8000",

View File

@@ -1,8 +1,8 @@
# Socket # Custom socket
If you need to specify a custom Docker socket (e.g. because you're using Podman), you can use the `socket` option. Here's an example: If you need to specify a custom Docker socket (e.g. because you're using Podman), you can use the `socket` option. Here's an example:
```json ```jsonc
{ {
"socket": "/run/user/1000/podman/podman.sock" "socket": "/run/user/1000/podman/podman.sock"
// Other options // Other options
@@ -11,7 +11,7 @@ If you need to specify a custom Docker socket (e.g. because you're using Podman)
You can also specify a TCP socket if you're using a remote Docker host or a [proxy](https://github.com/Tecnativa/docker-socket-proxy): You can also specify a TCP socket if you're using a remote Docker host or a [proxy](https://github.com/Tecnativa/docker-socket-proxy):
```json ```jsonc
{ {
"socket": "tcp://localhost:2375" "socket": "tcp://localhost:2375"
// Other options // Other options

View File

@@ -21,7 +21,7 @@ Available options are `default` and `blue`.
Here's an example: Here's an example:
```json ```jsonc
{ {
"theme": "blue" "theme": "blue"
// Other options // Other options

View File

@@ -15,7 +15,7 @@ Cup is a lightweight alternative to [What's up Docker?](https://github.com/getwu
- Supports most registries, including Docker Hub, ghcr.io, Quay, lscr.io and even Gitea (or derivatives) - Supports most registries, including Docker Hub, ghcr.io, Quay, lscr.io and even Gitea (or derivatives)
- Doesn't exhaust any rate limits. This is the original reason I created Cup. It was inspired by [What's up docker?](https://github.com/getwud/wud) which would always use it up. - Doesn't exhaust any rate limits. This is the original reason I created Cup. It was inspired by [What's up docker?](https://github.com/getwud/wud) which would always use it up.
- Beautiful CLI and web interface for checking on your containers any time. - Beautiful CLI and web interface for checking on your containers any time.
- The binary is tiny! At the time of writing it's just 5.1 MB. No more pulling 100+ MB docker images for a such a simple program. - The binary is tiny! At the time of writing it's just 5.4 MB. No more pulling 100+ MB docker images for a such a simple program.
- JSON output for both the CLI and web interface so you can connect Cup to integrations. It's easy to parse and makes webhooks and pretty dashboards simple to set up! - JSON output for both the CLI and web interface so you can connect Cup to integrations. It's easy to parse and makes webhooks and pretty dashboards simple to set up!
# Installation # Installation

View File

@@ -12,36 +12,52 @@ Cup's CLI provides the `cup check` command.
```ansi ```ansi
$ cup check $ cup check
 ✓ Done!
mysql:8.0 Major update ~ Local images
node:20 Major update ╭─────────────────────────────────────────┬──────────────────────────────────┬─────────╮
postgres:16-alpine Major update │Reference │Status │Time (ms)│
rust:1.80.1-alpine Minor update ├─────────────────────────────────────────┼──────────────────────────────────┼─────────┤
redis:7.4.0 Patch update │postgres:15-alpine │Major update (15 → 17) │788 │
nginx:alpine Update available │ghcr.io/immich-app/immich-server:v1.118.2│Minor update (1.118.2 → 1.127.0) │2294 │
redis:alpine Update available │ollama/ollama:0.4.1 │Minor update (0.4.1 → 0.5.12) │533 │
ubuntu:latest Update available │adguard/adguardhome:v0.107.52 │Patch update (0.107.52 → 0.107.57)│1738 │
node:iron Up to date │jc21/nginx-proxy-manager:latest │Up to date │583 │
2fauth/2fauth:latest Up to date │louislam/uptime-kuma:1 │Up to date │793 │
c1982/sdns:latest Up to date │moby/buildkit:buildx-stable-1 │Up to date │600 │
registry.acme.com/acme-server:latest Unknown │tecnativa/docker-socket-proxy:latest │Up to date │564 │
INFO ✨ Checked 58 images in 3772ms ubuntu:latest │Up to date │585 │
│wagoodman/dive:latest │Up to date │585 │
│rolebot:latest │Unknown │174 │
╰─────────────────────────────────────────┴──────────────────────────────────┴─────────╯
 INFO ✨ Checked 11 images in 8312ms
``` ```
### Check for updates to specific images ### Check for updates to specific images
```ansi ```ansi
$ cup check node:latest $ cup check node:latest
node:latest Update available ✓ Done!
INFO ✨ Checked 1 images in 1310ms ~ Local images
╭───────────┬────────────────┬─────────╮
│Reference │Status │Time (ms)│
├───────────┼────────────────┼─────────┤
│node:latest│Update available│788 │
╰───────────┴────────────────┴─────────╯
 INFO ✨ Checked 1 images in 310ms
``` ```
```ansi ```ansi
$ cup check nextcloud:30 postgres:14 mysql:8.0 $ cup check nextcloud:30 postgres:14 mysql:8.0
nextcloud:30 Update available ✓ Done!
postgres:14 Update available ~ Local images
mysql:8.0 Up to date ╭────────────┬────────────────────────┬─────────╮
INFO ✨ Checked 3 images in 1769ms │Reference │Status │Time (ms)│
├────────────┼────────────────────────┼─────────┤
│postgres:14 │Major update (14 → 17) │195 │
│mysql:8.0 │Major update (8.0 → 9.2)│382 │
│nextcloud:30│Up to date │585 │
╰────────────┴────────────────────────┴─────────╯
 INFO ✨ Checked 3 images in 769ms
``` ```
## Enable icons ## Enable icons
@@ -62,7 +78,8 @@ $ cup check -r
``` ```
<Callout emoji="⚠️"> <Callout emoji="⚠️">
When parsing Cup's output, capture only `stdout`, otherwise you might not get valid JSON (if there are warnings) When parsing Cup's output, capture only `stdout`, otherwise you might not get
valid JSON (if there are warnings)
</Callout> </Callout>
## Usage with Docker ## Usage with Docker

View File

@@ -7,7 +7,7 @@ import { Cards } from "nextra/components";
# Usage # Usage
You can use Cup in 2 different ways. As a CLI or as a server. You can learn more about each mode in its corresponding page You can use Cup in 2 different ways. As a CLI or as a server. You can learn more about each mode on its corresponding page
<Cards> <Cards>
<Cards.Card icon={<IconTerminal />} title="CLI" href="/docs/usage/cli" /> <Cards.Card icon={<IconTerminal />} title="CLI" href="/docs/usage/cli" />

View File

@@ -8,13 +8,13 @@ The server provides the `cup serve` command.
```ansi ```ansi
$ cup serve $ cup serve
INFO Starting server, please wait...  INFO Starting server, please wait...
INFO ✨ Checked 8 images in 8862ms  INFO ✨ Checked 8 images in 8862ms
INFO Ready to start!  INFO Ready to start!
HTTP GET / 200 in 0ms  HTTP GET / 200 in 0ms
HTTP GET /assets/index.js 200 in 3ms  HTTP GET /assets/index.js 200 in 3ms
HTTP GET /assets/index.css 200 in 0ms  HTTP GET /assets/index.css 200 in 0ms
HTTP GET /api/v3/json 200 in 0ms  HTTP GET /api/v3/json 200 in 0ms
``` ```
This will launch the server on port `8000`. To access it, visit `http://<YOUR_IP>:8000` (replace `<YOUR_IP>` with the IP address of the machine running Cup.) This will launch the server on port `8000`. To access it, visit `http://<YOUR_IP>:8000` (replace `<YOUR_IP>` with the IP address of the machine running Cup.)
@@ -29,13 +29,13 @@ Pass the `-p` argument with the port you want to use
```ansi ```ansi
$ cup serve -p 9000 $ cup serve -p 9000
INFO Starting server, please wait...  INFO Starting server, please wait...
INFO ✨ Checked 8 images in 8862ms  INFO ✨ Checked 8 images in 8862ms
INFO Ready to start!  INFO Ready to start!
HTTP GET / 200 in 0ms  HTTP GET / 200 in 0ms
HTTP GET /assets/index.js 200 in 3ms  HTTP GET /assets/index.js 200 in 3ms
HTTP GET /assets/index.css 200 in 0ms  HTTP GET /assets/index.css 200 in 0ms
HTTP GET /api/v3/json 200 in 0ms  HTTP GET /api/v3/json 200 in 0ms
``` ```
## Usage with Docker ## Usage with Docker

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

@@ -51,10 +51,7 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
if let Some(updates) = json["images"].as_array() { if let Some(updates) = json["images"].as_array() {
let mut server_updates: Vec<Update> = updates let mut server_updates: Vec<Update> = updates
.iter() .iter()
.filter_map(|img| match serde_json::from_value(img.clone()) { .filter_map(|img| serde_json::from_value(img.clone()).ok())
Ok(o) => o,
Err(e) => {dbg!(e);None}
})
.collect(); .collect();
// Add server origin to each image // Add server origin to each image
for update in &mut server_updates { for update in &mut server_updates {

Binary file not shown.

View File

@@ -225,182 +225,97 @@
</div> </div>
<ul> <ul>
{% for server in server_ids %} {% for server in server_ids %}
{% if server == '' %} <li class="mb-4 last:mb-0">
<li class="mb-8 last:mb-0"> <p
<ul class="my-4 text-lg font-semibold text-{{ theme }}-600 dark:text-{{ theme }}-400 px-6"
class="dark:divide-{{theme}}-900 divide-y dark:text-white" >
> {% if server == '' %}
{% for image in servers[server] %} Local images
<li {% else %}
class="flex items-center gap-4 break-all px-6 py-4 text-start hover:bg-{{theme}}-100 hover:dark:bg-{{theme}}-900/50 transition-colors duration-200"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="size-6 shrink-0 text-{{ theme }}-500"
>
<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>
</svg>
<span class="font-mono">{{ image.name }}</span>
{% case image.status %}
{% when 'Up to
date' %}
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="ml-auto text-green-500"
>
<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>
</svg>
{% when 'Unknown' %}
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="text-{{ theme }}-500 ml-auto"
>
<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>
</svg>
{% else %}
{% case image.status %}
{% when 'Major update' %}
{% assign color = 'text-red-500' %}
{% when 'Minor
update' %}
{% assign color = 'text-yellow-500' %}
{% else %}
{% assign color = 'text-blue-500' %}
{% endcase %}
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="ml-auto {{ color }}"
>
<circle cx="12" cy="12" r="10"/><path d="m16 12-4-4-4 4"/><path d="M12 16V8"/>
</svg>
{% endcase %}
</li>
{% endfor %}
</ul>
</li>
{% else %}
<li class="mb-4 last:mb-0">
<p
class="my-4 text-lg font-semibold text-{{ theme }}-600 dark:text-{{ theme }}-400 px-6"
>
{{ server }} {{ server }}
</p> {% endif %}
<ul </p>
class="dark:divide-{{ theme }}-900 divide-y dark:text-white" <ul
> class="dark:divide-{{theme}}-900 divide-y dark:text-white"
{% for image in servers[server] %} >
<li {% for image in servers[server] %}
class="flex items-center gap-4 break-all px-6 py-4 text-start hover:bg-{{ theme }}-100 hover:dark:bg-{{ theme }}-900/50 transition-colors duration-200" <li
class="flex items-center gap-4 break-all px-6 py-4 text-start hover:bg-{{theme}}-100 hover:dark:bg-{{theme}}-900/50 transition-colors duration-200"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="size-6 shrink-0 text-{{ theme }}-500"
> >
<svg <path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>
xmlns="http://www.w3.org/2000/svg" </svg>
width="24" <span class="font-mono">{{ image.name }}</span>
height="24" {% case image.status %}
viewBox="0 0 24 24" {% when 'Up to date' %}
fill="none" <svg
stroke="currentColor" xmlns="http://www.w3.org/2000/svg"
stroke-width="2" width="24"
stroke-linecap="round" height="24"
stroke-linejoin="round" viewBox="0 0 24 24"
class="size-6 shrink-0" fill="none"
> stroke="currentColor"
<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/> stroke-width="2"
</svg> stroke-linecap="round"
{{ image.name }} stroke-linejoin="round"
{% case image.status %} class="ml-auto text-green-500"
{% when 'Up to >
date' %} <circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>
<svg </svg>
xmlns="http://www.w3.org/2000/svg" {% when 'Unknown' %}
width="24" <svg
height="24" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24" width="24"
fill="none" height="24"
stroke="currentColor" viewBox="0 0 24 24"
stroke-width="2" fill="none"
stroke-linecap="round" stroke="currentColor"
stroke-linejoin="round" stroke-width="2"
class="ml-auto text-green-500" stroke-linecap="round"
> stroke-linejoin="round"
<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/> class="text-{{ theme }}-500 ml-auto"
</svg> >
{% when 'Unknown' %} <circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>
<svg </svg>
xmlns="http://www.w3.org/2000/svg" {% else %}
width="24" {% case image.status %}
height="24" {% when 'Major update' %}
viewBox="0 0 24 24" {% assign color = 'text-red-500' %}
fill="none" {% when 'Minor update' %}
stroke="currentColor" {% assign color = 'text-yellow-500' %}
stroke-width="2" {% else %}
stroke-linecap="round" {% assign color = 'text-blue-500' %}
stroke-linejoin="round" {% endcase %}
class="text-{{ theme }}-500 ml-auto" <svg
> xmlns="http://www.w3.org/2000/svg"
<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/> width="24"
</svg> height="24"
{% else %} viewBox="0 0 24 24"
{% case image.status %} fill="none"
{% when 'Major update' %} stroke="currentColor"
{% assign color = 'text-red-500' %} stroke-width="2"
{% when 'Minor stroke-linecap="round"
update' %} stroke-linejoin="round"
{% assign color = 'text-yellow-500' %} class="ml-auto {{ color }}"
{% else %} >
{% assign color = 'text-blue-500' %} <circle cx="12" cy="12" r="10"/><path d="m16 12-4-4-4 4"/><path d="M12 16V8"/>
{% endcase %} </svg>
<svg {% endcase %}
xmlns="http://www.w3.org/2000/svg" </li>
width="24" {% endfor %}
height="24" </ul>
viewBox="0 0 24 24" </li>
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="ml-auto {{ color }}"
>
<circle cx="12" cy="12" r="10"/><path d="m16 12-4-4-4 4"/><path d="M12 16V8"/>
</svg>
{% endcase %}
</li>
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View File

@@ -13,7 +13,6 @@
"dependencies": { "dependencies": {
"@headlessui/react": "^2.1.10", "@headlessui/react": "^2.1.10",
"@radix-ui/react-tooltip": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.2",
"caniuse-lite": "^1.0.30001698",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"lucide-react": "^0.475.0", "lucide-react": "^0.475.0",

View File

@@ -38,6 +38,7 @@ export default function Image({ data }: { data: Image }) {
data.result.info?.type == "version" data.result.info?.type == "version"
? data.reference.split(":")[0] + ":" + data.result.info.new_tag ? data.reference.split(":")[0] + ":" + data.result.info.new_tag
: data.reference; : data.reference;
const info = getInfo(data)!;
let url: string | null = null; let url: string | null = null;
if (clickable_registries.includes(data.parts.registry)) { if (clickable_registries.includes(data.parts.registry)) {
switch (data.parts.registry) { switch (data.parts.registry) {
@@ -57,7 +58,12 @@ export default function Image({ data }: { data: Image }) {
> >
<Box className={`size-6 shrink-0 text-${theme}-500`} /> <Box className={`size-6 shrink-0 text-${theme}-500`} />
<span className="font-mono">{data.reference}</span> <span className="font-mono">{data.reference}</span>
<Icon data={data} /> <WithTooltip
text={info.description}
className={`ml-auto size-6 shrink-0 ${info.color}`}
>
<info.icon />
</WithTooltip>
</li> </li>
</button> </button>
<Dialog open={open} onClose={setOpen} className="relative z-10"> <Dialog open={open} onClose={setOpen} className="relative z-10">
@@ -113,7 +119,8 @@ export default function Image({ data }: { data: Image }) {
</button> </button>
</div> </div>
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<DialogIcon data={data} /> <info.icon className={`size-6 shrink-0 ${info.color}`} />
{info.description}
</div> </div>
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<Timer className="size-6 shrink-0 text-gray-500" /> <Timer className="size-6 shrink-0 text-gray-500" />
@@ -164,118 +171,54 @@ export default function Image({ data }: { data: Image }) {
); );
} }
function Icon({ data }: { data: Image }) { function getInfo(data: Image):
| {
color: string;
icon: typeof HelpCircle;
description: string;
}
| undefined {
switch (data.result.has_update) { switch (data.result.has_update) {
case null: case null:
return ( return {
<WithTooltip color: "text-gray-500",
text="Unknown" icon: HelpCircle,
className="ml-auto size-6 shrink-0 text-gray-500" description: "Unknown",
> };
<HelpCircle />
</WithTooltip>
);
case false: case false:
return ( return {
<WithTooltip color: "text-green-500",
text="Up to date" icon: CircleCheck,
className="ml-auto size-6 shrink-0 text-green-500" description: "Up to date",
> };
<CircleCheck />
</WithTooltip>
);
case true: case true:
if (data.result.info?.type === "version") { if (data.result.info?.type === "version") {
switch (data.result.info.version_update_type) { switch (data.result.info.version_update_type) {
case "major": case "major":
return ( return {
<WithTooltip color: "text-red-500",
text="Major Update" icon: CircleArrowUp,
className="ml-auto size-6 shrink-0 text-red-500" description: "Major update",
> };
<CircleArrowUp />
</WithTooltip>
);
case "minor": case "minor":
return ( return {
<WithTooltip color: "text-yellow-500",
text="Minor Update" icon: CircleArrowUp,
className="ml-auto size-6 shrink-0 text-yellow-500" description: "Minor update",
> };
<CircleArrowUp />
</WithTooltip>
);
case "patch": case "patch":
return ( return {
<WithTooltip color: "text-blue-500",
text="Patch Update" icon: CircleArrowUp,
className="ml-auto size-6 shrink-0 text-blue-500" description: "Patch update",
> };
<CircleArrowUp />
</WithTooltip>
);
} }
} else if (data.result.info?.type === "digest") { } else if (data.result.info?.type === "digest") {
return ( return {
<WithTooltip color: "text-blue-500",
text="Update available" icon: CircleArrowUp,
className="ml-auto size-6 shrink-0 text-blue-500" description: "Update available",
> };
<CircleArrowUp />
</WithTooltip>
);
}
}
}
function DialogIcon({ data }: { data: Image }) {
switch (data.result.has_update) {
case null:
return (
<>
<HelpCircle className="size-6 shrink-0 text-gray-500" />
Unknown
</>
);
case false:
return (
<>
<CircleCheck className="size-6 shrink-0 text-green-500" />
Up to date
</>
);
case true:
if (data.result.info?.type === "version") {
switch (data.result.info.version_update_type) {
case "major":
return (
<>
<CircleArrowUp className="size-6 shrink-0 text-red-500" />
Major update
</>
);
case "minor":
return (
<>
<CircleArrowUp className="size-6 shrink-0 text-yellow-500" />
Minor update
</>
);
case "patch":
return (
<>
<CircleArrowUp className="size-6 shrink-0 text-blue-500" />
Patch update
</>
);
}
} else if (data.result.info?.type === "digest") {
return (
<>
<CircleArrowUp className="size-6 shrink-0 text-blue-500" />
Update available
</>
);
} }
} }
} }

View File

@@ -1,7 +1,7 @@
import { Data } from "../types"; import { Data } from "../types";
import Logo from "./Logo"; import Logo from "./Logo";
import { theme } from "../theme"; import { theme } from "../theme";
import { RefreshCw } from "lucide-react"; import { LoaderCircle } from "lucide-react";
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) { export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
fetch( fetch(
@@ -26,9 +26,16 @@ export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
<Logo /> <Logo />
</div> </div>
<div <div
className={`flex h-full items-center justify-center gap-1 text-${theme}-500 dark:text-${theme}-400`} className={`flex flex-col h-full items-center justify-center gap-1 text-${theme}-500 dark:text-${theme}-400`}
> >
Loading <RefreshCw className="animate-spin" /> <div className="flex gap-1 mb-8">
Loading <LoaderCircle className="animate-spin" />
</div>
<p>
If this takes more than a few seconds, there was probably a
problem fetching the data. Please try reloading the page and
report a bug if the problem persists.
</p>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -21,7 +21,7 @@ export default function RefreshButton() {
}; };
return ( return (
<WithTooltip text="Reload"> <WithTooltip text="Reload">
<button className="group" onClick={refresh} disabled={disabled}> <button className="group shrink-0" onClick={refresh} disabled={disabled}>
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width="24" width="24"
@@ -32,7 +32,7 @@ export default function RefreshButton() {
strokeWidth="2" strokeWidth="2"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
className="shrink-0 group-disabled:animate-spin" className="size-6 group-disabled:animate-spin"
> >
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M4,11A8.1,8.1 0 0 1 19.5,9M20,5v4h-4" /> <path d="M4,11A8.1,8.1 0 0 1 19.5,9M20,5v4h-4" />