Compare commits
1 Commits
v3-nightly
...
v3.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f9c5d1466 |
@@ -22,7 +22,7 @@ _If you like this project and/or use Cup, please consider starring the project
|
||||
|
||||
## Documentation 📘
|
||||
|
||||
Take a look at https://sergi0g.github.io/cup/docs!
|
||||
Take a look at https://cup.sergi0g.dev/docs!
|
||||
|
||||
## Limitations
|
||||
|
||||
@@ -44,7 +44,7 @@ Here are some ideas to get you started:
|
||||
- Help optimize Cup and make it even better!
|
||||
- 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
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 85 KiB |
@@ -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>
|
||||
);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 240 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 233 KiB After Width: | Height: | Size: 124 KiB |
@@ -35,9 +35,9 @@ services:
|
||||
- /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 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 `services.cup` key in the docker compose:
|
||||
```yaml
|
||||
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!
|
||||
@@ -36,7 +36,7 @@ services:
|
||||
homepage.widget.mappings[1].field.metrics: up_to_date
|
||||
homepage.widget.mappings[1].format: number
|
||||
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
|
||||
```
|
||||
|
||||
@@ -64,7 +64,7 @@ widget:
|
||||
label: Up to date
|
||||
format: number
|
||||
- field:
|
||||
metrics: update_available
|
||||
metrics: updates_available
|
||||
label: Available updates
|
||||
format: number
|
||||
- field:
|
||||
|
||||
12
docs/src/content/docs/configuration/agent.mdx
Normal 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
|
||||
}
|
||||
```
|
||||
@@ -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:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"registries": {
|
||||
"<YOUR_REGISTRY_DOMAIN_1>": {
|
||||
|
||||
12
docs/src/content/docs/configuration/automatic-refresh.mdx
Normal 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)
|
||||
22
docs/src/content/docs/configuration/ignore-registry.mdx
Normal 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.
|
||||
@@ -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!
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
IconLockOpen,
|
||||
IconKey,
|
||||
IconPlug,
|
||||
IconServer
|
||||
IconServer,
|
||||
} from "@tabler/icons-react";
|
||||
|
||||
# Configuration
|
||||
@@ -71,12 +71,21 @@ Here's a full example:
|
||||
|
||||
```json
|
||||
{
|
||||
"authentication": {
|
||||
"ghcr.io": "<YOUR_TOKEN_HERE>",
|
||||
"registry-1.docker.io": "<YOUR_TOKEN_HERE>"
|
||||
"$schema": "https://raw.githubusercontent.com/sergi0g/cup/main/cup.schema.json",
|
||||
"version": 3,
|
||||
"images": {
|
||||
"exclude": ["ghcr.io/immich-app/immich-machine-learning"],
|
||||
"extra": ["ghcr.io/sergi0g/cup:v3.0.0"]
|
||||
},
|
||||
"theme": "blue",
|
||||
"insecure_registries": ["localhost:5000", "my-insecure-registry.example.com"]
|
||||
"registries": {
|
||||
"myregistry.com": {
|
||||
"authentication": "<YOUR_TOKEN_HERE>"
|
||||
}
|
||||
},
|
||||
"servers": {
|
||||
"Raspberry Pi": "https://server.local:8000"
|
||||
},
|
||||
"theme": "blue"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ To solve this problem, you can specify exceptions in your `cup.json`.
|
||||
|
||||
Here's what it looks like:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"registries": {
|
||||
"<INSECURE_REGISTRY_1>": {
|
||||
|
||||
@@ -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:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"servers": {
|
||||
"Cool server 1": "http://your-other-server-running-cup:8000",
|
||||
|
||||
@@ -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:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"socket": "/run/user/1000/podman/podman.sock"
|
||||
// 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):
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"socket": "tcp://localhost:2375"
|
||||
// Other options
|
||||
|
||||
@@ -21,7 +21,7 @@ Available options are `default` and `blue`.
|
||||
|
||||
Here's an example:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"theme": "blue"
|
||||
// Other options
|
||||
|
||||
@@ -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)
|
||||
- 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.
|
||||
- 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!
|
||||
|
||||
# Installation
|
||||
|
||||
@@ -12,36 +12,52 @@ Cup's CLI provides the `cup check` command.
|
||||
|
||||
```ansi
|
||||
$ cup check
|
||||
[38;5;1m
|
||||
mysql:8.0 Major update
|
||||
node:20 Major update
|
||||
postgres:16-alpine Major update[0m[38;5;3m
|
||||
rust:1.80.1-alpine Minor update[0m[38;5;12m
|
||||
redis:7.4.0 Patch update
|
||||
nginx:alpine Update available
|
||||
redis:alpine Update available
|
||||
ubuntu:latest Update available[0m[38;5;2m
|
||||
node:iron Up to date
|
||||
2fauth/2fauth:latest Up to date
|
||||
c1982/sdns:latest Up to date[0m[38;5;8m
|
||||
registry.acme.com/acme-server:latest Unknown
|
||||
[36;1mINFO [0m✨ Checked 58 images in 3772ms
|
||||
[32;1m✓[0m Done!
|
||||
[90;1m~ Local images[0m
|
||||
[90;1m╭─────────────────────────────────────────┬──────────────────────────────────┬─────────╮[0m
|
||||
[90;1m│[36;1mReference [90;1m│[36;1mStatus [90;1m│[36;1mTime (ms)[90;1m│[0m
|
||||
[90;1m├─────────────────────────────────────────┼──────────────────────────────────┼─────────┤[0m
|
||||
[90;1m│[0mpostgres:15-alpine [90;1m│[0m[31mMajor update (15 → 17) [0m[90;1m│[0m788 [90;1m│[0m
|
||||
[90;1m│[0mghcr.io/immich-app/immich-server:v1.118.2[90;1m│[0m[33mMinor update (1.118.2 → 1.127.0) [0m[90;1m│[0m2294 [90;1m│[0m
|
||||
[90;1m│[0mollama/ollama:0.4.1 [90;1m│[0m[33mMinor update (0.4.1 → 0.5.12) [0m[90;1m│[0m533 [90;1m│[0m
|
||||
[90;1m│[0madguard/adguardhome:v0.107.52 [90;1m│[0m[34mPatch update (0.107.52 → 0.107.57)[0m[90;1m│[0m1738 [90;1m│[0m
|
||||
[90;1m│[0mjc21/nginx-proxy-manager:latest [90;1m│[0m[32mUp to date [0m[90;1m│[0m583 [90;1m│[0m
|
||||
[90;1m│[0mlouislam/uptime-kuma:1 [90;1m│[0m[32mUp to date [0m[90;1m│[0m793 [90;1m│[0m
|
||||
[90;1m│[0mmoby/buildkit:buildx-stable-1 [90;1m│[0m[32mUp to date [0m[90;1m│[0m600 [90;1m│[0m
|
||||
[90;1m│[0mtecnativa/docker-socket-proxy:latest [90;1m│[0m[32mUp to date [0m[90;1m│[0m564 [90;1m│[0m
|
||||
[90;1m│[0mubuntu:latest [90;1m│[0m[32mUp to date [0m[90;1m│[0m585 [90;1m│[0m
|
||||
[90;1m│[0mwagoodman/dive:latest [90;1m│[0m[32mUp to date [0m[90;1m│[0m585 [90;1m│[0m
|
||||
[90;1m│[0mrolebot:latest [90;1m│[0m[90mUnknown [0m[90;1m│[0m174 [90;1m│[0m
|
||||
[90;1m╰─────────────────────────────────────────┴──────────────────────────────────┴─────────╯[0m
|
||||
[36;1m INFO[0m ✨ Checked 11 images in 8312ms
|
||||
```
|
||||
|
||||
### Check for updates to specific images
|
||||
|
||||
```ansi
|
||||
$ cup check node:latest[38;5;12m
|
||||
node:latest Update available
|
||||
[36;1mINFO [0m✨ Checked 1 images in 1310ms
|
||||
$ cup check node:latest
|
||||
[32;1m✓[0m Done!
|
||||
[90;1m~ Local images[0m
|
||||
[90;1m╭───────────┬────────────────┬─────────╮[0m
|
||||
[90;1m│[36;1mReference [90;1m│[36;1mStatus [90;1m│[36;1mTime (ms)[90;1m│[0m
|
||||
[90;1m├───────────┼────────────────┼─────────┤[0m
|
||||
[90;1m│[0mnode:latest[90;1m│[0m[34mUpdate available[0m[90;1m│[0m788 [90;1m│[0m
|
||||
[90;1m╰───────────┴────────────────┴─────────╯[0m
|
||||
[36;1m INFO[0m ✨ Checked 1 images in 310ms
|
||||
```
|
||||
|
||||
```ansi
|
||||
$ cup check nextcloud:30 postgres:14 mysql:8.0[38;5;12m
|
||||
nextcloud:30 Update available
|
||||
postgres:14 Update available[38;5;2m
|
||||
mysql:8.0 Up to date
|
||||
[36;1mINFO [0m✨ Checked 3 images in 1769ms
|
||||
[32;1m✓[0m Done!
|
||||
[90;1m~ Local images[0m
|
||||
[90;1m╭────────────┬────────────────────────┬─────────╮[0m
|
||||
[90;1m│[36;1mReference [90;1m│[36;1mStatus [90;1m│[36;1mTime (ms)[90;1m│[0m
|
||||
[90;1m├────────────┼────────────────────────┼─────────┤[0m
|
||||
[90;1m│[0mpostgres:14 [90;1m│[0m[31mMajor update (14 → 17) [0m[90;1m│[0m195 [90;1m│[0m
|
||||
[90;1m│[0mmysql:8.0 [90;1m│[0m[31mMajor update (8.0 → 9.2)[0m[90;1m│[0m382 [90;1m│[0m
|
||||
[90;1m│[0mnextcloud:30[90;1m│[0m[32mUp to date [0m[90;1m│[0m585 [90;1m│[0m
|
||||
[90;1m╰────────────┴────────────────────────┴─────────╯[0m
|
||||
[36;1m INFO[0m ✨ Checked 3 images in 769ms
|
||||
```
|
||||
|
||||
## Enable icons
|
||||
@@ -62,7 +78,8 @@ $ cup check -r
|
||||
```
|
||||
|
||||
<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>
|
||||
|
||||
## Usage with Docker
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Cards } from "nextra/components";
|
||||
|
||||
# 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.Card icon={<IconTerminal />} title="CLI" href="/docs/usage/cli" />
|
||||
|
||||
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 124 KiB |
@@ -51,10 +51,7 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
|
||||
if let Some(updates) = json["images"].as_array() {
|
||||
let mut server_updates: Vec<Update> = updates
|
||||
.iter()
|
||||
.filter_map(|img| match serde_json::from_value(img.clone()) {
|
||||
Ok(o) => o,
|
||||
Err(e) => {dbg!(e);None}
|
||||
})
|
||||
.filter_map(|img| serde_json::from_value(img.clone()).ok())
|
||||
.collect();
|
||||
// Add server origin to each image
|
||||
for update in &mut server_updates {
|
||||
|
||||
BIN
web/bun.lockb
107
web/index.html
@@ -225,8 +225,16 @@
|
||||
</div>
|
||||
<ul>
|
||||
{% for server in server_ids %}
|
||||
<li class="mb-4 last:mb-0">
|
||||
<p
|
||||
class="my-4 text-lg font-semibold text-{{ theme }}-600 dark:text-{{ theme }}-400 px-6"
|
||||
>
|
||||
{% if server == '' %}
|
||||
<li class="mb-8 last:mb-0">
|
||||
Local images
|
||||
{% else %}
|
||||
{{ server }}
|
||||
{% endif %}
|
||||
</p>
|
||||
<ul
|
||||
class="dark:divide-{{theme}}-900 divide-y dark:text-white"
|
||||
>
|
||||
@@ -250,8 +258,7 @@
|
||||
</svg>
|
||||
<span class="font-mono">{{ image.name }}</span>
|
||||
{% case image.status %}
|
||||
{% when 'Up to
|
||||
date' %}
|
||||
{% when 'Up to date' %}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
@@ -285,8 +292,7 @@
|
||||
{% case image.status %}
|
||||
{% when 'Major update' %}
|
||||
{% assign color = 'text-red-500' %}
|
||||
{% when 'Minor
|
||||
update' %}
|
||||
{% when 'Minor update' %}
|
||||
{% assign color = 'text-yellow-500' %}
|
||||
{% else %}
|
||||
{% assign color = 'text-blue-500' %}
|
||||
@@ -310,97 +316,6 @@
|
||||
{% 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 }}
|
||||
</p>
|
||||
<ul
|
||||
class="dark:divide-{{ theme }}-900 divide-y dark:text-white"
|
||||
>
|
||||
{% for image in servers[server] %}
|
||||
<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"
|
||||
>
|
||||
<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>
|
||||
{{ image.name }}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^2.1.10",
|
||||
"@radix-ui/react-tooltip": "^1.1.2",
|
||||
"caniuse-lite": "^1.0.30001698",
|
||||
"clsx": "^2.1.1",
|
||||
"date-fns": "^3.6.0",
|
||||
"lucide-react": "^0.475.0",
|
||||
|
||||
@@ -38,6 +38,7 @@ export default function Image({ data }: { data: Image }) {
|
||||
data.result.info?.type == "version"
|
||||
? data.reference.split(":")[0] + ":" + data.result.info.new_tag
|
||||
: data.reference;
|
||||
const info = getInfo(data)!;
|
||||
let url: string | null = null;
|
||||
if (clickable_registries.includes(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`} />
|
||||
<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>
|
||||
</button>
|
||||
<Dialog open={open} onClose={setOpen} className="relative z-10">
|
||||
@@ -113,7 +119,8 @@ export default function Image({ data }: { data: Image }) {
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<DialogIcon data={data} />
|
||||
<info.icon className={`size-6 shrink-0 ${info.color}`} />
|
||||
{info.description}
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<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) {
|
||||
case null:
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Unknown"
|
||||
className="ml-auto size-6 shrink-0 text-gray-500"
|
||||
>
|
||||
<HelpCircle />
|
||||
</WithTooltip>
|
||||
);
|
||||
return {
|
||||
color: "text-gray-500",
|
||||
icon: HelpCircle,
|
||||
description: "Unknown",
|
||||
};
|
||||
case false:
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Up to date"
|
||||
className="ml-auto size-6 shrink-0 text-green-500"
|
||||
>
|
||||
<CircleCheck />
|
||||
</WithTooltip>
|
||||
);
|
||||
return {
|
||||
color: "text-green-500",
|
||||
icon: CircleCheck,
|
||||
description: "Up to date",
|
||||
};
|
||||
case true:
|
||||
if (data.result.info?.type === "version") {
|
||||
switch (data.result.info.version_update_type) {
|
||||
case "major":
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Major Update"
|
||||
className="ml-auto size-6 shrink-0 text-red-500"
|
||||
>
|
||||
<CircleArrowUp />
|
||||
</WithTooltip>
|
||||
);
|
||||
return {
|
||||
color: "text-red-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Major update",
|
||||
};
|
||||
case "minor":
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Minor Update"
|
||||
className="ml-auto size-6 shrink-0 text-yellow-500"
|
||||
>
|
||||
<CircleArrowUp />
|
||||
</WithTooltip>
|
||||
);
|
||||
return {
|
||||
color: "text-yellow-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Minor update",
|
||||
};
|
||||
case "patch":
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Patch Update"
|
||||
className="ml-auto size-6 shrink-0 text-blue-500"
|
||||
>
|
||||
<CircleArrowUp />
|
||||
</WithTooltip>
|
||||
);
|
||||
return {
|
||||
color: "text-blue-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Patch update",
|
||||
};
|
||||
}
|
||||
} else if (data.result.info?.type === "digest") {
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Update available"
|
||||
className="ml-auto size-6 shrink-0 text-blue-500"
|
||||
>
|
||||
<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
|
||||
</>
|
||||
);
|
||||
return {
|
||||
color: "text-blue-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Update available",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Data } from "../types";
|
||||
import Logo from "./Logo";
|
||||
import { theme } from "../theme";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
import { LoaderCircle } from "lucide-react";
|
||||
|
||||
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
||||
fetch(
|
||||
@@ -26,9 +26,16 @@ export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
||||
<Logo />
|
||||
</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>
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function RefreshButton() {
|
||||
};
|
||||
return (
|
||||
<WithTooltip text="Reload">
|
||||
<button className="group" onClick={refresh} disabled={disabled}>
|
||||
<button className="group shrink-0" onClick={refresh} disabled={disabled}>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
@@ -32,7 +32,7 @@ export default function RefreshButton() {
|
||||
strokeWidth="2"
|
||||
strokeLinecap="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 d="M4,11A8.1,8.1 0 0 1 19.5,9M20,5v4h-4" />
|
||||
|
||||