Compare commits
95 Commits
v3.2.2
...
v3.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d0da37e36 | ||
|
|
780d7a088d | ||
|
|
bcb9f63735 | ||
|
|
4d691dd5fa | ||
|
|
685219ea62 | ||
|
|
756462cd7c | ||
|
|
f020ac0906 | ||
|
|
4b03a48d88 | ||
|
|
ba1cfac64b | ||
|
|
05d4c7c630 | ||
|
|
cf22ec300f | ||
|
|
5b428dbf67 | ||
|
|
787a730ab5 | ||
|
|
925989fd80 | ||
|
|
5656003058 | ||
|
|
f79d7ff03a | ||
|
|
550fb955a3 | ||
|
|
6ae95bf83b | ||
|
|
2262df0355 | ||
|
|
1beb7dc020 | ||
|
|
a0de565367 | ||
|
|
0314ef2f05 | ||
|
|
f1c8a45122 | ||
|
|
ce3f8176f1 | ||
|
|
8b520182ed | ||
|
|
e8fee79d20 | ||
|
|
24f160803a | ||
|
|
2ef77c9a55 | ||
|
|
a5bbdd0e33 | ||
|
|
b5aa0309ee | ||
|
|
4bbb53cd67 | ||
|
|
3ac6fb57e9 | ||
|
|
ead74dadd6 | ||
|
|
6e6afdb757 | ||
|
|
0c10134829 | ||
|
|
c0c7f7c0e9 | ||
|
|
aeeffaccba | ||
|
|
a1711b7ac8 | ||
|
|
9d628e3ab2 | ||
|
|
d3b18a6587 | ||
|
|
76a812f52f | ||
|
|
fe779c9c4e | ||
|
|
84609d5189 | ||
|
|
ded441cf75 | ||
|
|
0a8295fff4 | ||
|
|
9c8e6ccdea | ||
|
|
f1e1bcbf1c | ||
|
|
31f7bfbbcb | ||
|
|
15eb553e50 | ||
|
|
359147770f | ||
|
|
0a4e302322 | ||
|
|
5ed64c92fd | ||
|
|
6d08d75ac3 | ||
|
|
dc38b84e87 | ||
|
|
09b6880295 | ||
|
|
4f1075b2b2 | ||
|
|
c84270603f | ||
|
|
4aa28f2cc5 | ||
|
|
eadda5f776 | ||
|
|
622b156eed | ||
|
|
dca19b5ae2 | ||
|
|
f6ac43aac0 | ||
|
|
e5e60c4abc | ||
|
|
33a72c8c0d | ||
|
|
e544ef6ca5 | ||
|
|
afc34a0847 | ||
|
|
ce08e00bb4 | ||
|
|
6a77b85141 | ||
|
|
215e88ae0f | ||
|
|
178acfb2f6 | ||
|
|
59894343de | ||
|
|
61bc60493f | ||
|
|
be7d55d126 | ||
|
|
36a3a13c04 | ||
|
|
d85fadfb39 | ||
|
|
0f95be26dc | ||
|
|
0b7e064980 | ||
|
|
9e9bb78db7 | ||
|
|
88d346b480 | ||
|
|
4519c534a1 | ||
|
|
6b83f51749 | ||
|
|
0c3f293fa8 | ||
|
|
d94abecf35 | ||
|
|
c11b5e6432 | ||
|
|
022dc0b2cb | ||
|
|
51609da4ff | ||
|
|
3ed79e69bd | ||
|
|
078a51c4fa | ||
|
|
8d70d7ae4d | ||
|
|
6d45409928 | ||
|
|
bcfb9ef27a | ||
|
|
5c4de36052 | ||
|
|
eda30229e2 | ||
|
|
8fd012efbe | ||
|
|
8ab073d562 |
13
.github/actions/build-image/Dockerfile
vendored
@@ -1,13 +0,0 @@
|
||||
FROM --platform=$BUILDPLATFORM alpine AS builder
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETOS
|
||||
|
||||
COPY binaries/* /
|
||||
RUN mv cup-$TARGETOS-$TARGETARCH cup
|
||||
RUN chmod +x cup
|
||||
|
||||
FROM scratch
|
||||
COPY --from=builder /cup /cup
|
||||
EXPOSE 8000
|
||||
ENTRYPOINT ["/cup"]
|
||||
52
.github/actions/build-image/action.yml
vendored
@@ -1,52 +0,0 @@
|
||||
name: Build Image
|
||||
inputs:
|
||||
tags:
|
||||
description: "Docker image tags"
|
||||
required: true
|
||||
gh-token:
|
||||
description: "Github token"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: .
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/sergi0g/cup
|
||||
tags: ${{ inputs.tags }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: sergi0g
|
||||
password: ${{ inputs.gh-token }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./.github/actions/build-image/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
37
.github/workflows/nightly.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
||||
- name: Set up Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
|
||||
@@ -62,25 +62,38 @@ jobs:
|
||||
cup-linux-arm64
|
||||
|
||||
build-image:
|
||||
needs:
|
||||
- get-tag
|
||||
- build-binaries
|
||||
needs: get-tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/build-image
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
tags: |
|
||||
${{ needs.get-tag.outputs.tag }}
|
||||
gh-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64, linux/arm64
|
||||
push: true
|
||||
tags: ghcr.io/sergi0g/cup:${{ needs.get-tag.outputs.tag }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
nightly-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- get-tag
|
||||
- build-binaries
|
||||
- build-image
|
||||
needs: [build-binaries, get-tag]
|
||||
steps:
|
||||
- name: Download binaries
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
33
.github/workflows/release.yml
vendored
@@ -60,19 +60,34 @@ jobs:
|
||||
cup-linux-arm64
|
||||
|
||||
build-image:
|
||||
needs:
|
||||
- get-tag
|
||||
- build-binaries
|
||||
needs: get-tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/build-image
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
tags: |
|
||||
${{ needs.get-tag.outputs.tag }}
|
||||
latest
|
||||
gh-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64, linux/arm64
|
||||
push: true
|
||||
tags: ghcr.io/sergi0g/cup:${{ needs.get-tag.outputs.tag }},ghcr.io/sergi0g/cup:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -92,4 +107,4 @@ jobs:
|
||||
prerelease: true
|
||||
tag_name: ${{ needs.get-tag.outputs.tag }}
|
||||
name: ${{ needs.get-tag.outputs.tag }}
|
||||
files: binaries/*
|
||||
files: binaries/*
|
||||
1157
Cargo.lock
generated
10
Cargo.toml
@@ -1,15 +1,15 @@
|
||||
[package]
|
||||
name = "cup"
|
||||
version = "3.2.2"
|
||||
version = "3.0.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.7", features = ["derive"] }
|
||||
indicatif = { version = "0.17.8", optional = true }
|
||||
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
|
||||
xitca-web = { version = "0.6.2", optional = true }
|
||||
xitca-web = { version = "0.5.0", optional = true }
|
||||
liquid = { version = "0.26.6", optional = true }
|
||||
bollard = "0.18.1"
|
||||
bollard = "0.16.1"
|
||||
once_cell = "1.19.0"
|
||||
http-auth = { version = "0.1.9", default-features = false }
|
||||
termsize = { version = "0.1.8", optional = true }
|
||||
@@ -17,11 +17,11 @@ regex = { version = "1.10.5", default-features = false, features = ["perf"] }
|
||||
chrono = { version = "0.4.38", default-features = false, features = ["std", "alloc", "clock"], optional = true }
|
||||
reqwest = { version = "0.12.7", default-features = false, features = ["rustls-tls"] }
|
||||
futures = "0.3.30"
|
||||
reqwest-retry = "0.7.0"
|
||||
reqwest-retry = "0.6.1"
|
||||
reqwest-middleware = "0.3.3"
|
||||
rustc-hash = "2.0.0"
|
||||
http-link = "1.0.1"
|
||||
itertools = "0.14.0"
|
||||
itertools = "0.13.0"
|
||||
serde_json = "1.0.133"
|
||||
serde = "1.0.215"
|
||||
tokio-cron-scheduler = { version = "0.13.0", default-features = false, optional = true }
|
||||
|
||||
@@ -15,7 +15,7 @@ RUN ~/.bun/bin/bun install
|
||||
RUN ~/.bun/bin/bun run build
|
||||
|
||||
### Build Cup ###
|
||||
FROM rust:1-alpine AS build
|
||||
FROM rust:1.80.1-alpine AS build
|
||||
|
||||
# Requirements
|
||||
RUN apk add musl-dev
|
||||
@@ -39,5 +39,4 @@ FROM scratch
|
||||
# Copy binary
|
||||
COPY --from=build /cup/target/release/cup /cup
|
||||
|
||||
EXPOSE 8000
|
||||
ENTRYPOINT ["/cup"]
|
||||
ENTRYPOINT ["/cup"]
|
||||
20
README.md
@@ -1,13 +1,5 @@
|
||||
# Cup 🥤
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
[](https://discord.gg/jmh5ctzwNG)
|
||||
|
||||
|
||||
Cup is the easiest way to check for container image updates.
|
||||
|
||||

|
||||
@@ -23,20 +15,20 @@ _If you like this project and/or use Cup, please consider starring the project
|
||||
|
||||
- Extremely fast. Cup takes full advantage of your CPU and is hightly optimized, resulting in lightning fast speed. On my Raspberry Pi 5, it took 3.7 seconds for 58 images!
|
||||
- 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. I feel that this feature is especially relevant now with [Docker Hub reducing its pull limits for unauthenticated users](https://docs.docker.com/docker-hub/usage/).
|
||||
- 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.4 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.1 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!
|
||||
|
||||
## Documentation 📘
|
||||
|
||||
Take a look at https://cup.sergi0g.dev/docs!
|
||||
Take a look at https://sergi0g.github.io/cup/docs!
|
||||
|
||||
## Limitations
|
||||
|
||||
Cup is a work in progress. It might not have as many features as other alternatives. If one of these features is really important for you, please consider using another tool.
|
||||
|
||||
- Cup cannot directly trigger your integrations. If you want that to happen automatically, please use What's up Docker instead. Cup was created to be simple. The data is there, and it's up to you to retrieve it (e.g. by running `cup check -r` with a cronjob or periodically requesting the `/api/v3/json` url from the server).
|
||||
- Cup cannot directly trigger your integrations. If you want that to happen automatically, please use What's up Docker instead. Cup was created to be simple. The data is there, and it's up to you to retrieve it (e.g. by running `cup check -r` with a cronjob or periodically requesting the `/json` url from the server).
|
||||
|
||||
## Roadmap
|
||||
Take a sneak peek at what's coming up in future releases on the [roadmap](https://github.com/users/sergi0g/projects/2)!
|
||||
@@ -52,11 +44,11 @@ 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://cup.sergi0g.dev/docs/contributing)!
|
||||
For more information, check the [docs](https://sergi0g.github.io/cup/docs/contributing)!
|
||||
|
||||
## Support
|
||||
|
||||
If you have any questions about Cup, feel free to ask in the [discussions](https://github.com/sergi0g/cup/discussions)! You can also join our [discord server](https://discord.gg/jmh5ctzwNG).
|
||||
If you have any questions about Cup, feel free to ask in the [discussions](https://github.com/sergi0g/cup/discussions)!
|
||||
|
||||
If you find a bug, or want to propose a feature, search for it in the [issues](https://github.com/sergi0g/cup/issues). If there isn't already an open issue, please open one.
|
||||
|
||||
|
||||
BIN
docs/bun.lockb
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build && pagefind --site out --output-path out/_pagefind",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"fmt": "bun prettier --write ."
|
||||
@@ -12,7 +12,7 @@
|
||||
"dependencies": {
|
||||
"@tabler/icons-react": "^3.29.0",
|
||||
"geist": "^1.3.1",
|
||||
"next": "15.2.3",
|
||||
"next": "15.1.5",
|
||||
"nextra": "^4.1.0",
|
||||
"nextra-theme-docs": "^4.1.0",
|
||||
"react": "^19.0.0",
|
||||
@@ -26,7 +26,6 @@
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-next": "15.1.5",
|
||||
"pagefind": "^1.3.0",
|
||||
"postcss": "^8.5.1",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
|
||||
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 136 KiB |
15
docs/src/app/assets/GitHubIcon.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
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: 134 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 232 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 240 KiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 233 KiB |
@@ -10,12 +10,12 @@ export function Card({
|
||||
description: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="p-4 bg-white dark:bg-black group">
|
||||
<Icon className="text-black size-7 group-hover:size-9 dark:text-white inline mr-2 transition-[width,height] duration-200" />
|
||||
<div>
|
||||
<Icon className="text-black size-7 dark:text-white inline mr-2" />
|
||||
<span className="align-middle text-2xl font-bold text-black dark:text-white">
|
||||
{name}
|
||||
</span>
|
||||
<p className="text-xl font-semibold text-neutral-500 dark:text-neutral-500">
|
||||
<p className="text-2xl font-semibold text-neutral-500 dark:text-neutral-500">
|
||||
{description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
28
docs/src/app/components/CopyableCode.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { IconCopy, IconCopyCheck } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function CopyableCode({ children }: { children: string }) {
|
||||
const [success, setSuccess] = useState(false);
|
||||
const handleClick = () => {
|
||||
navigator.clipboard.writeText(children);
|
||||
setSuccess(true);
|
||||
setTimeout(() => setSuccess(false), 3000);
|
||||
};
|
||||
return (
|
||||
<div className="relative rounded-md xl:w-auto">
|
||||
<button
|
||||
className="hover:bg-black/10 dark:hover:bg-black/60 flex w-full items-center justify-center gap-4 rounded-md border border-black/10 bg-black/5 px-8 py-3 font-mono text-sm font-medium text-black/70 transition-colors duration-200 md:px-10 md:py-3 md:text-base md:leading-6 dark:border-white/15 dark:bg-black dark:text-gray-300 backdrop-blur-md"
|
||||
onClick={handleClick}
|
||||
>
|
||||
{children}
|
||||
{success ? (
|
||||
<IconCopyCheck className="stroke-black/40 dark:stroke-white/50" />
|
||||
) : (
|
||||
<IconCopy className="stroke-black/40 dark:stroke-white/50" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ export function GridPattern() {
|
||||
return (
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute inset-0 bottom-0 left-0 right-0 top-0 h-full w-full -z-10 bg-white stroke-neutral-200 dark:stroke-white/10 dark:bg-black"
|
||||
className="pointer-events-none absolute inset-0 bottom-0 left-0 right-0 top-0 -z-10 h-full w-full stroke-neutral-200 dark:stroke-neutral-600/30"
|
||||
>
|
||||
<defs>
|
||||
<pattern
|
||||
@@ -22,6 +22,7 @@ export function GridPattern() {
|
||||
<path
|
||||
d={`M.5 ${SIZE}V.5H${SIZE}`}
|
||||
fill="none"
|
||||
strokeDasharray={"4 2"}
|
||||
/>
|
||||
</pattern>
|
||||
</defs>
|
||||
|
||||
28
docs/src/app/components/Section.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { ReactNode } from "react";
|
||||
import { GradientText } from "./GradientText";
|
||||
|
||||
export function Section({
|
||||
title,
|
||||
className,
|
||||
children,
|
||||
}: {
|
||||
title: string;
|
||||
className: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="border-t border-t-neutral-300 bg-neutral-50 py-32 dark:border-t-neutral-600/30 dark:bg-neutral-950">
|
||||
<div className="mx-auto w-full max-w-screen-xl">
|
||||
<GradientText
|
||||
text={title}
|
||||
className="mx-auto mb-20 w-fit text-center text-4xl font-bold tracking-tighter"
|
||||
innerClassName={className}
|
||||
blur={12}
|
||||
/>
|
||||
<div className="m-2 grid w-full auto-cols-fr gap-20 lg:grid-cols-3">
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,28 +1,29 @@
|
||||
import React from "react";
|
||||
import "./styles.css";
|
||||
import "./styles.css"
|
||||
|
||||
import CopyableCode from "../CopyableCode";
|
||||
import { Browser } from "../Browser";
|
||||
import { Card } from "../Card";
|
||||
import {
|
||||
IconAdjustments,
|
||||
IconArrowRight,
|
||||
IconBarrierBlockOff,
|
||||
IconBolt,
|
||||
IconBraces,
|
||||
IconDevices,
|
||||
IconFeather,
|
||||
IconGitMerge,
|
||||
IconPuzzle,
|
||||
IconServer,
|
||||
IconTerminal,
|
||||
IconLockCheck,
|
||||
} from "@tabler/icons-react";
|
||||
import { GitHubIcon } from "nextra/icons";
|
||||
import { GridPattern } from "../GridPattern";
|
||||
import { GradientText } from "../GradientText";
|
||||
import { Section } from "../Section";
|
||||
import { Steps } from "nextra/components";
|
||||
import Link from "next/link";
|
||||
|
||||
export default async function Home() {
|
||||
return (
|
||||
<>
|
||||
<div className="relative home bg-radial-[ellipse_at_center] from-transparent from-20% to-white dark:to-black">
|
||||
<div className="relative home">
|
||||
<GridPattern />
|
||||
<div className="px-4 pt-16 pb-8 sm:pt-24 lg:px-8">
|
||||
<div className="flex w-full flex-col items-center justify-between">
|
||||
@@ -36,7 +37,7 @@ export default async function Home() {
|
||||
blur={30}
|
||||
/>
|
||||
</h1>
|
||||
<h3 className="mx-auto mt-6 max-w-3xl text-center text-xl leading-tight font-medium text-neutral-500 dark:text-neutral-400">
|
||||
<h3 className="mx-auto mt-6 max-w-3xl text-center text-xl leading-tight font-medium text-gray-400">
|
||||
Cup is a small utility with a big impact. Simplify your
|
||||
container management workflow with fast and efficient update
|
||||
checking, a full-featured CLI and web interface, and more.
|
||||
@@ -53,7 +54,7 @@ export default async function Home() {
|
||||
<a
|
||||
href="https://github.com/sergi0g/cup"
|
||||
target="_blank"
|
||||
className="hide-focus h-full bg-white dark:bg-black text-nowrap border border-black/15 transition-colors duration-200 ease-in-out hover:border-black/40 dark:border-white/15 hover:dark:border-white/40 hover:dark:shadow-sm focus:dark:border-white/30"
|
||||
className="hide-focus h-full text-nowrap border border-neutral-400 transition-colors duration-200 ease-in-out hover:border-neutral-600 focus:border-neutral-600 dark:border-neutral-600 hover:dark:border-neutral-400 hover:dark:shadow-sm hover:dark:shadow-neutral-600 focus:dark:border-neutral-400"
|
||||
>
|
||||
Star on GitHub
|
||||
<GitHubIcon className="ml-auto size-4 md:size-5" />
|
||||
@@ -65,49 +66,68 @@ export default async function Home() {
|
||||
<Browser />
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white dark:bg-black py-12 px-8 w-full">
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<div className="grid md:grid-cols-2 md:grid-rows-4 lg:grid-cols-4 lg:grid-rows-2 w-full max-w-7xl gap-px border border-transparent bg-black/10 dark:bg-white/10">
|
||||
<Card
|
||||
name="Built for speed."
|
||||
icon={IconBolt}
|
||||
description="Cup is written in Rust and every release goes through extensive profiling to squeeze out every last drop of performance."
|
||||
/>
|
||||
<Card
|
||||
name="Configurable."
|
||||
icon={IconAdjustments}
|
||||
description="Make Cup yours with the extensive configuration options available. Customize and tailor it to your needs."
|
||||
/>
|
||||
<Card
|
||||
name="Extend it."
|
||||
icon={IconPuzzle}
|
||||
description="JSON output enables you to connect Cup with your favorite integrations, build automations and more."
|
||||
/>
|
||||
<Card
|
||||
name="CLI available."
|
||||
icon={IconTerminal}
|
||||
description="Do you like terminals? Cup has a CLI. Check for updates quickly without spinning up a server."
|
||||
/>
|
||||
<Card
|
||||
name="Multiple servers."
|
||||
icon={IconServer}
|
||||
description="Run multiple Cup instances and effortlessly check on them through one web interface."
|
||||
/>
|
||||
<Card
|
||||
name="Unstoppable."
|
||||
icon={IconBarrierBlockOff}
|
||||
description="Cup is designed to check for updates without using up any rate limits. 10 images per hour won't be a problem, even with 100 images."
|
||||
/>
|
||||
<Card
|
||||
name="Lightweight."
|
||||
icon={IconFeather}
|
||||
description="No need for a powerful server and endless storage. The tiny 5.4 MB binary won't hog your CPU and memory."
|
||||
/>
|
||||
<Card
|
||||
name="Open source."
|
||||
icon={IconGitMerge}
|
||||
description="All source code is publicly available in our GitHub repository. We're looking for contributors!"
|
||||
/>
|
||||
<Section
|
||||
title="Powerful at its core."
|
||||
className="bg-gradient-to-r from-red-500 to-amber-500"
|
||||
>
|
||||
<Card
|
||||
name="100% Safe Code"
|
||||
icon={IconLockCheck}
|
||||
description="Built with safe Rust and Typescript to ensure security and reliability."
|
||||
/>
|
||||
<Card
|
||||
name="Lightning Fast Performance"
|
||||
icon={IconBolt}
|
||||
description="Heavily optimized to squeeze out every last drop of performance. Each release is extensively benchmarked and profiled so that you'll never have to stare at a loading spinner for long."
|
||||
/>
|
||||
<Card
|
||||
name="Lightweight"
|
||||
icon={IconFeather}
|
||||
description="No runtimes or libraries are needed. All you need is the 5.1 MB static binary that works out of the box on any system."
|
||||
/>
|
||||
</Section>
|
||||
<Section
|
||||
title="Efficient, yet flexible."
|
||||
className="bg-gradient-to-r from-blue-500 to-indigo-500"
|
||||
>
|
||||
<Card
|
||||
name="JSON output"
|
||||
description="Connect Cup to your favorite intergrations with JSON output for the CLI and an API for the server. Now go make that cool dashboard you've been dreaming of!"
|
||||
icon={IconBraces}
|
||||
/>
|
||||
<Card
|
||||
name="Both CLI and web interface"
|
||||
description="Whether you prefer the command line or the web, Cup runs wherever you choose."
|
||||
icon={IconDevices}
|
||||
/>
|
||||
<Card
|
||||
name="Configurable"
|
||||
description="The simple configuration file provides you with all the tools you need to specify a custom Docker socket, manage registry connection options, choose a theme for the web interface and more."
|
||||
icon={IconAdjustments}
|
||||
/>
|
||||
</Section>
|
||||
<div className="relative py-24 border-t border-t-neutral-300 dark:border-t-neutral-600/30 text-black dark:text-white">
|
||||
<GridPattern />
|
||||
<div className="mx-auto flex w-full max-w-screen-xl flex-col items-center">
|
||||
<p className="mb-8 text-center text-3xl font-bold">
|
||||
Still not convinced? Try it out now!
|
||||
</p>
|
||||
<div>
|
||||
<Steps>
|
||||
<h3 className="mb-2">Open a terminal and run</h3>
|
||||
<CopyableCode>
|
||||
docker run --rm -t -v /var/run/docker.sock:/var/run/docker.sock
|
||||
-p 8000:8000 ghcr.io/sergi0g/cup serve
|
||||
</CopyableCode>
|
||||
<h3 className="mb-2">Open the dashboard in your browser</h3>
|
||||
<p>
|
||||
Visit{" "}
|
||||
<a href="http://localhost:8000" className="underline">
|
||||
http://localhost:8000
|
||||
</a>{" "}
|
||||
in your browser to try it out!
|
||||
</p>
|
||||
</Steps>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@ const logo = (
|
||||
);
|
||||
|
||||
const navbar = (
|
||||
<Navbar logo={logo} projectLink="https://github.com/sergi0g/cup" chatLink="https://discord.gg/jmh5ctzwNG">
|
||||
<Navbar logo={logo} projectLink="https://github.com/sergi0g/cup">
|
||||
<ThemeSwitch lite className="cursor-pointer" />
|
||||
</Navbar>
|
||||
);
|
||||
@@ -45,7 +45,7 @@ export default async function RootLayout({
|
||||
navbar={navbar}
|
||||
pageMap={await getPageMap()}
|
||||
footer={footer}
|
||||
docsRepositoryBase="https://github.com/sergi0g/cup/blob/main/docs"
|
||||
docsRepositoryBase="https://github.com/sergi0g/cup"
|
||||
>
|
||||
<div>{children}</div>
|
||||
</Layout>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Callout } from "nextra/components";
|
||||
|
||||
# Docker Compose
|
||||
|
||||
Many users find it useful to run Cup with Docker Compose, as it enables them to have it constantly running in the background and easily control it. Cup's lightweight resource use makes it ideal for this use case.
|
||||
@@ -37,13 +35,9 @@ services:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
|
||||
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:
|
||||
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:
|
||||
```yaml
|
||||
user: "1000:999"
|
||||
```
|
||||
|
||||
<Callout>
|
||||
You can use the command `getent group docker | cut -d: -f3` to find the group id for the docker group.
|
||||
</Callout>
|
||||
|
||||
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!
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
import Image from "next/image";
|
||||
|
||||
import screenshot from "@/app/assets/ha-cup-component.png";
|
||||
|
||||
# Home Assistant integration
|
||||
|
||||
Many thanks to [@bastgau](https://github.com/bastgau) for creating this integration.
|
||||
|
||||
## About
|
||||
|
||||
The **HA Cup Component** integration for Home Assistant allows you to retrieve update statistics for Docker containers directly from your Home Assistant interface.
|
||||
|
||||
With this integration, you can easily track the status of your Docker containers and receive notifications when updates are available.
|
||||
|
||||
The following sensors are currently implemented:
|
||||
|
||||
<Image
|
||||
src={screenshot}
|
||||
alt="Screenshot of Home Assistant showing a card with update information provided by Cup"
|
||||
/>
|
||||
|
||||
## Installation
|
||||
|
||||
### Via HACS
|
||||
|
||||
1. Open Home Assistant and go to HACS
|
||||
2. Navigate to "Integrations" and click on "Add a custom repository".
|
||||
3. Use https://github.com/bastgau/ha-cup-component as the URL
|
||||
4. Search for "HA Cup Component" and install it.
|
||||
5. Restart Home Assistant.
|
||||
|
||||
### One-click install
|
||||
|
||||
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=bastgau&repository=ha-cup-component&category=Integration)
|
||||
|
||||
### Manual Installation
|
||||
|
||||
1. Download the integration files from the GitHub repository.
|
||||
2. Place the integration folder in the custom_components directory of Home Assistant.
|
||||
3. Restart Home Assistant.
|
||||
|
||||
## Support & Contributions
|
||||
|
||||
If you encounter any issues or wish to contribute to improving this integration, feel free to open an issue or a pull request in the [GitHub repository](https://github.com/bastgau/ha-cup-component).
|
||||
|
||||
Support the author:
|
||||
[](https://www.buymeacoffee.com/bastgau)
|
||||
@@ -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: updates_available
|
||||
homepage.widget.mappings[2].field.metrics: update_available
|
||||
homepage.widget.mappings[2].format: number
|
||||
```
|
||||
|
||||
@@ -64,7 +64,7 @@ widget:
|
||||
label: Up to date
|
||||
format: number
|
||||
- field:
|
||||
metrics: updates_available
|
||||
metrics: update_available
|
||||
label: Available updates
|
||||
format: number
|
||||
- field:
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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:
|
||||
|
||||
```jsonc
|
||||
```json
|
||||
{
|
||||
"registries": {
|
||||
"<YOUR_REGISTRY_DOMAIN_1>": {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# 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 * * * *" // 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)
|
||||
@@ -1,22 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,35 +0,0 @@
|
||||
# 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,21 +71,12 @@ Here's a full example:
|
||||
|
||||
```json
|
||||
{
|
||||
"$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"]
|
||||
"authentication": {
|
||||
"ghcr.io": "<YOUR_TOKEN_HERE>",
|
||||
"registry-1.docker.io": "<YOUR_TOKEN_HERE>"
|
||||
},
|
||||
"registries": {
|
||||
"myregistry.com": {
|
||||
"authentication": "<YOUR_TOKEN_HERE>"
|
||||
}
|
||||
},
|
||||
"servers": {
|
||||
"Raspberry Pi": "https://server.local:8000"
|
||||
},
|
||||
"theme": "blue"
|
||||
"theme": "blue",
|
||||
"insecure_registries": ["localhost:5000", "my-insecure-registry.example.com"]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ To solve this problem, you can specify exceptions in your `cup.json`.
|
||||
|
||||
Here's what it looks like:
|
||||
|
||||
```jsonc
|
||||
```json
|
||||
{
|
||||
"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:
|
||||
|
||||
```jsonc
|
||||
```json
|
||||
{
|
||||
"servers": {
|
||||
"Cool server 1": "http://your-other-server-running-cup:8000",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Custom socket
|
||||
# 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:
|
||||
|
||||
```jsonc
|
||||
```json
|
||||
{
|
||||
"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):
|
||||
|
||||
```jsonc
|
||||
```json
|
||||
{
|
||||
"socket": "tcp://localhost:2375"
|
||||
// Other options
|
||||
|
||||
@@ -21,7 +21,7 @@ Available options are `default` and `blue`.
|
||||
|
||||
Here's an example:
|
||||
|
||||
```jsonc
|
||||
```json
|
||||
{
|
||||
"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.4 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.1 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Callout, Cards } from "nextra/components";
|
||||
import { IconServer, IconTerminal } from "@tabler/icons-react";
|
||||
import { IconServer, IconTerminal } from "@tabler/icons-react"
|
||||
|
||||
# Integrations
|
||||
|
||||
@@ -34,7 +34,6 @@ The data returned from the API or from the CLI is in JSON and looks like this:
|
||||
"repository": "sergi0g/cup",
|
||||
"tag": "latest",
|
||||
},
|
||||
"url": "https://github.com/sergi0g/cup", // The URL specified in the "org.opencontainers.image.url" label, otherwise null
|
||||
"result": {
|
||||
"has_update": true, // `true` when an image has an update of any kind, `false` when up to date and `null` when unknown.
|
||||
"info": {
|
||||
@@ -78,7 +77,3 @@ For retrieving the above data, refer to the CLI and server pages:
|
||||
href="/docs/usage/server"
|
||||
/>
|
||||
</Cards>
|
||||
|
||||
## Refresh Cup
|
||||
|
||||
If you'd like to fetch the latest information, you can manually trigger a refresh by making a `GET` request to the `/api/v3/refresh` endpoint. Once the request completes, you can fetch the data as described above.
|
||||
|
||||
@@ -12,52 +12,36 @@ Cup's CLI provides the `cup check` command.
|
||||
|
||||
```ansi
|
||||
$ cup check
|
||||
[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
|
||||
[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
|
||||
```
|
||||
|
||||
### Check for updates to specific images
|
||||
|
||||
```ansi
|
||||
$ 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
|
||||
$ cup check node:latest[38;5;12m
|
||||
node:latest Update available
|
||||
[36;1mINFO [0m✨ Checked 1 images in 1310ms
|
||||
```
|
||||
|
||||
```ansi
|
||||
$ cup check nextcloud:30 postgres:14 mysql:8.0[38;5;12m
|
||||
[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
|
||||
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
|
||||
```
|
||||
|
||||
## Enable icons
|
||||
@@ -78,8 +62,7 @@ $ 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 on 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 in its corresponding page
|
||||
|
||||
<Cards>
|
||||
<Cards.Card icon={<IconTerminal />} title="CLI" href="/docs/usage/cli" />
|
||||
|
||||
@@ -8,13 +8,13 @@ The server provides the `cup serve` command.
|
||||
|
||||
```ansi
|
||||
$ cup serve
|
||||
[36;1m INFO [0mStarting server, please wait...
|
||||
[36;1m INFO [0m✨ Checked 8 images in 8862ms
|
||||
[36;1m INFO [0mReady to start!
|
||||
[94;1m HTTP [0m[32mGET[0m / [32m200[0m in 0ms
|
||||
[94;1m HTTP [0m[32mGET[0m /assets/index.js [32m200[0m in 3ms
|
||||
[94;1m HTTP [0m[32mGET[0m /assets/index.css [32m200[0m in 0ms
|
||||
[94;1m HTTP [0m[32mGET[0m /api/v3/json [32m200[0m in 0ms
|
||||
[36;1mINFO [0mStarting server, please wait...
|
||||
[36;1mINFO [0m✨ Checked 8 images in 8862ms
|
||||
[36;1mINFO [0mReady to start!
|
||||
[94;1mHTTP [0m[32mGET[0m / [32m200[0m in 0ms
|
||||
[94;1mHTTP [0m[32mGET[0m /assets/index.js [32m200[0m in 3ms
|
||||
[94;1mHTTP [0m[32mGET[0m /assets/index.css [32m200[0m in 0ms
|
||||
[94;1mHTTP [0m[32mGET[0m /api/v3/json [32m200[0m 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.)
|
||||
@@ -29,13 +29,13 @@ Pass the `-p` argument with the port you want to use
|
||||
|
||||
```ansi
|
||||
$ cup serve -p 9000
|
||||
[36;1m INFO [0mStarting server, please wait...
|
||||
[36;1m INFO [0m✨ Checked 8 images in 8862ms
|
||||
[36;1m INFO [0mReady to start!
|
||||
[94;1m HTTP [0m[32mGET[0m / [32m200[0m in 0ms
|
||||
[94;1m HTTP [0m[32mGET[0m /assets/index.js [32m200[0m in 3ms
|
||||
[94;1m HTTP [0m[32mGET[0m /assets/index.css [32m200[0m in 0ms
|
||||
[94;1m HTTP [0m[32mGET[0m /api/v3/json [32m200[0m in 0ms
|
||||
[36;1mINFO [0mStarting server, please wait...
|
||||
[36;1mINFO [0m✨ Checked 8 images in 8862ms
|
||||
[36;1mINFO [0mReady to start!
|
||||
[94;1mHTTP [0m[32mGET[0m / [32m200[0m in 0ms
|
||||
[94;1mHTTP [0m[32mGET[0m /assets/index.js [32m200[0m in 3ms
|
||||
[94;1mHTTP [0m[32mGET[0m /assets/index.css [32m200[0m in 0ms
|
||||
[94;1mHTTP [0m[32mGET[0m /api/v3/json [32m200[0m in 0ms
|
||||
```
|
||||
|
||||
## Usage with Docker
|
||||
|
||||
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 90 KiB |
54
src/check.rs
@@ -17,7 +17,7 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
|
||||
|
||||
let handles: Vec<_> = ctx.config.servers
|
||||
.iter()
|
||||
.map(|(name, url)| async move {
|
||||
.map(|(name, url)| async {
|
||||
let base_url = if url.starts_with("http://") || url.starts_with("https://") {
|
||||
format!("{}/api/v3/", url.trim_end_matches('/'))
|
||||
} else {
|
||||
@@ -26,10 +26,10 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
|
||||
let json_url = base_url.clone() + "json";
|
||||
if refresh {
|
||||
let refresh_url = base_url + "refresh";
|
||||
match client.get(&refresh_url, &[], false).await {
|
||||
match client.get(&(&refresh_url), vec![], false).await {
|
||||
Ok(response) => {
|
||||
if response.status() != 200 {
|
||||
ctx.logger.warn(format!("GET {}: Failed to refresh server. Server returned invalid response code: {}", refresh_url, response.status()));
|
||||
ctx.logger.warn(format!("GET {}: Failed to refresh server. Server returned invalid response code: {}",refresh_url,response.status()));
|
||||
return Vec::new();
|
||||
}
|
||||
},
|
||||
@@ -40,14 +40,13 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
|
||||
}
|
||||
|
||||
}
|
||||
match client.get(&json_url, &[], false).await {
|
||||
match client.get(&json_url, vec![], false).await {
|
||||
Ok(response) => {
|
||||
if response.status() != 200 {
|
||||
ctx.logger.warn(format!("GET {}: Failed to fetch updates from server. Server returned invalid response code: {}", json_url, response.status()));
|
||||
ctx.logger.warn(format!("GET {}: Failed to fetch updates from server. Server returned invalid response code: {}",json_url,response.status()));
|
||||
return Vec::new();
|
||||
}
|
||||
let json = parse_json(&get_response_body(response).await);
|
||||
ctx.logger.debug(format!("JSON response for {}: {}", name, json));
|
||||
if let Some(updates) = json["images"].as_array() {
|
||||
let mut server_updates: Vec<Update> = updates
|
||||
.iter()
|
||||
@@ -58,7 +57,6 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
|
||||
update.server = Some(name.clone());
|
||||
update.status = update.get_status();
|
||||
}
|
||||
ctx.logger.debug(format!("Updates for {}: {:#?}", name, server_updates));
|
||||
return server_updates;
|
||||
}
|
||||
|
||||
@@ -81,29 +79,20 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
|
||||
|
||||
/// Returns a list of updates for all images passed in.
|
||||
pub async fn get_updates(
|
||||
references: &Option<Vec<String>>, // If a user requested _specific_ references to be checked, this will have a value
|
||||
references: &Option<Vec<String>>,
|
||||
refresh: bool,
|
||||
ctx: &Context,
|
||||
) -> Vec<Update> {
|
||||
let client = Client::new(ctx);
|
||||
|
||||
// Merge references argument with references from config
|
||||
let all_references = match &references {
|
||||
Some(refs) => {
|
||||
refs.clone().extend_from_slice(&ctx.config.images.extra);
|
||||
refs
|
||||
}
|
||||
None => &ctx.config.images.extra,
|
||||
};
|
||||
|
||||
// Get local images
|
||||
ctx.logger.debug("Retrieving images to be checked");
|
||||
let mut images = get_images_from_docker_daemon(ctx, references).await;
|
||||
|
||||
// Add extra images from references
|
||||
if !all_references.is_empty() {
|
||||
if let Some(refs) = references {
|
||||
let image_refs: FxHashSet<&String> = images.iter().map(|image| &image.reference).collect();
|
||||
let extra = all_references
|
||||
let extra = refs
|
||||
.iter()
|
||||
.filter(|&reference| !image_refs.contains(reference))
|
||||
.map(|reference| Image::from_reference(reference))
|
||||
@@ -129,16 +118,6 @@ pub async fn get_updates(
|
||||
.iter()
|
||||
.map(|image| &image.parts.registry)
|
||||
.unique()
|
||||
.filter(|®istry| match ctx.config.registries.get(registry) {
|
||||
Some(config) => {
|
||||
if config.ignore {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
None => true,
|
||||
})
|
||||
.collect::<Vec<&String>>();
|
||||
|
||||
// Create request client. All network requests share the same client for better performance.
|
||||
@@ -157,7 +136,7 @@ pub async fn get_updates(
|
||||
|
||||
// Retrieve an authentication token (if required) for each registry.
|
||||
let mut tokens: FxHashMap<&str, Option<String>> = FxHashMap::default();
|
||||
for registry in registries.clone() {
|
||||
for registry in registries {
|
||||
let credentials = if let Some(registry_config) = ctx.config.registries.get(registry) {
|
||||
®istry_config.authentication
|
||||
} else {
|
||||
@@ -182,11 +161,24 @@ pub async fn get_updates(
|
||||
|
||||
ctx.logger.debug(format!("Tokens: {:?}", tokens));
|
||||
|
||||
let ignored_registries = ctx
|
||||
.config
|
||||
.registries
|
||||
.iter()
|
||||
.filter_map(|(registry, registry_config)| {
|
||||
if registry_config.ignore {
|
||||
Some(registry)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<&String>>();
|
||||
|
||||
let mut handles = Vec::with_capacity(images.len());
|
||||
|
||||
// Loop through images check for updates
|
||||
for image in &images {
|
||||
let is_ignored = !registries.contains(&&image.parts.registry)
|
||||
let is_ignored = ignored_registries.contains(&&image.parts.registry)
|
||||
|| ctx
|
||||
.config
|
||||
.images
|
||||
|
||||
@@ -42,26 +42,7 @@ pub async fn get_images_from_docker_daemon(
|
||||
references: &Option<Vec<String>>,
|
||||
) -> Vec<Image> {
|
||||
let client: Docker = create_docker_client(ctx.config.socket.as_deref());
|
||||
let mut swarm_images = match client.list_services::<String>(None).await {
|
||||
Ok(services) => services
|
||||
.iter()
|
||||
.filter_map(|service| match &service.spec {
|
||||
Some(service_spec) => match &service_spec.task_template {
|
||||
Some(task_spec) => match &task_spec.container_spec {
|
||||
Some(container_spec) => match &container_spec.image {
|
||||
Some(image) => Image::from_inspect_data(ctx, image),
|
||||
None => None,
|
||||
},
|
||||
None => None,
|
||||
},
|
||||
None => None,
|
||||
},
|
||||
None => None,
|
||||
})
|
||||
.collect(),
|
||||
Err(_) => Vec::new(),
|
||||
};
|
||||
let mut local_images = match references {
|
||||
match references {
|
||||
Some(refs) => {
|
||||
let mut inspect_handles = Vec::with_capacity(refs.len());
|
||||
for reference in refs {
|
||||
@@ -75,7 +56,7 @@ pub async fn get_images_from_docker_daemon(
|
||||
.collect();
|
||||
inspects
|
||||
.iter()
|
||||
.filter_map(|inspect| Image::from_inspect_data(ctx, inspect.clone()))
|
||||
.filter_map(|inspect| Image::from_inspect_data(inspect.clone()))
|
||||
.collect()
|
||||
}
|
||||
None => {
|
||||
@@ -87,10 +68,8 @@ pub async fn get_images_from_docker_daemon(
|
||||
};
|
||||
images
|
||||
.iter()
|
||||
.filter_map(|image| Image::from_inspect_data(ctx, image.clone()))
|
||||
.collect::<Vec<Image>>()
|
||||
.filter_map(|image| Image::from_inspect_data(image.clone()))
|
||||
.collect()
|
||||
}
|
||||
};
|
||||
local_images.append(&mut swarm_images);
|
||||
local_images
|
||||
}
|
||||
}
|
||||
|
||||
12
src/http.rs
@@ -42,7 +42,7 @@ impl Client {
|
||||
&self,
|
||||
url: &str,
|
||||
method: RequestMethod,
|
||||
headers: &[(&str, Option<&str>)],
|
||||
headers: Vec<(&str, Option<&str>)>,
|
||||
ignore_401: bool,
|
||||
) -> Result<Response, String> {
|
||||
let mut request = match method {
|
||||
@@ -51,7 +51,7 @@ impl Client {
|
||||
};
|
||||
for (name, value) in headers {
|
||||
if let Some(v) = value {
|
||||
request = request.header(*name, *v)
|
||||
request = request.header(name, v)
|
||||
}
|
||||
}
|
||||
match request.send().await {
|
||||
@@ -95,10 +95,6 @@ impl Client {
|
||||
let message = format!("{} {}: Connection timed out!", method, url);
|
||||
self.ctx.logger.warn(&message);
|
||||
Err(message)
|
||||
} else if error.is_middleware() {
|
||||
let message = format!("{} {}: Connection failed after 3 retries!", method, url);
|
||||
self.ctx.logger.warn(&message);
|
||||
Err(message)
|
||||
} else {
|
||||
error!(
|
||||
"{} {}: Unexpected error: {}",
|
||||
@@ -114,7 +110,7 @@ impl Client {
|
||||
pub async fn get(
|
||||
&self,
|
||||
url: &str,
|
||||
headers: &[(&str, Option<&str>)],
|
||||
headers: Vec<(&str, Option<&str>)>,
|
||||
ignore_401: bool,
|
||||
) -> Result<Response, String> {
|
||||
self.request(url, RequestMethod::GET, headers, ignore_401)
|
||||
@@ -124,7 +120,7 @@ impl Client {
|
||||
pub async fn head(
|
||||
&self,
|
||||
url: &str,
|
||||
headers: &[(&str, Option<&str>)],
|
||||
headers: Vec<(&str, Option<&str>)>,
|
||||
) -> Result<Response, String> {
|
||||
self.request(url, RequestMethod::HEAD, headers, false).await
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::{
|
||||
pub async fn check_auth(registry: &str, ctx: &Context, client: &Client) -> Option<String> {
|
||||
let protocol = get_protocol(registry, &ctx.config.registries);
|
||||
let url = format!("{}://{}/v2/", protocol, registry);
|
||||
let response = client.get(&url, &[], true).await;
|
||||
let response = client.get(&url, Vec::new(), true).await;
|
||||
match response {
|
||||
Ok(response) => {
|
||||
let status = response.status();
|
||||
@@ -57,9 +57,9 @@ pub async fn get_latest_digest(
|
||||
protocol, &image.parts.registry, &image.parts.repository, &image.parts.tag
|
||||
);
|
||||
let authorization = to_bearer_string(&token);
|
||||
let headers = [("Accept", Some("application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.index.v1+json")), ("Authorization", authorization.as_deref())];
|
||||
let headers = vec![("Accept", Some("application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.index.v1+json")), ("Authorization", authorization.as_deref())];
|
||||
|
||||
let response = client.head(&url, &headers).await;
|
||||
let response = client.head(&url, headers).await;
|
||||
let time = start.elapsed().unwrap().as_millis() as u32;
|
||||
ctx.logger.debug(format!(
|
||||
"Checked for digest update to {} in {}ms",
|
||||
@@ -95,7 +95,7 @@ pub async fn get_latest_digest(
|
||||
}
|
||||
|
||||
pub async fn get_token(
|
||||
images: &[&Image],
|
||||
images: &Vec<&Image>,
|
||||
auth_url: &str,
|
||||
credentials: &Option<String>,
|
||||
client: &Client,
|
||||
@@ -105,9 +105,9 @@ pub async fn get_token(
|
||||
url = format!("{}&scope=repository:{}:pull", url, image.parts.repository);
|
||||
}
|
||||
let authorization = credentials.as_ref().map(|creds| format!("Basic {}", creds));
|
||||
let headers = [("Authorization", authorization.as_deref())];
|
||||
let headers = vec![("Authorization", authorization.as_deref())];
|
||||
|
||||
let response = client.get(&url, &headers, false).await;
|
||||
let response = client.get(&url, headers, false).await;
|
||||
let response_json = match response {
|
||||
Ok(response) => parse_json(&get_response_body(response).await),
|
||||
Err(_) => error!("GET {}: Request failed!", url),
|
||||
@@ -131,7 +131,7 @@ pub async fn get_latest_tag(
|
||||
protocol, &image.parts.registry, &image.parts.repository,
|
||||
);
|
||||
let authorization = to_bearer_string(&token);
|
||||
let headers = [
|
||||
let headers = vec![
|
||||
("Accept", Some("application/json")),
|
||||
("Authorization", authorization.as_deref()),
|
||||
];
|
||||
@@ -147,7 +147,7 @@ pub async fn get_latest_tag(
|
||||
));
|
||||
let (new_tags, next) = match get_extra_tags(
|
||||
&next_url.unwrap(),
|
||||
&headers,
|
||||
headers.clone(),
|
||||
base,
|
||||
&image.version_info.as_ref().unwrap().format_str,
|
||||
client,
|
||||
@@ -205,21 +205,18 @@ pub async fn get_latest_tag(
|
||||
}
|
||||
}
|
||||
}
|
||||
None => error!(
|
||||
"Image {} has no remote version tags! Local tag: {}",
|
||||
image.reference, image.parts.tag
|
||||
),
|
||||
None => unreachable!("{:?}", tags),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_extra_tags(
|
||||
url: &str,
|
||||
headers: &[(&str, Option<&str>)],
|
||||
headers: Vec<(&str, Option<&str>)>,
|
||||
base: &Version,
|
||||
format_str: &str,
|
||||
client: &Client,
|
||||
) -> Result<(Vec<Version>, Option<String>), String> {
|
||||
let response = client.get(url, &headers, false).await;
|
||||
let response = client.get(url, headers, false).await;
|
||||
|
||||
match response {
|
||||
Ok(res) => {
|
||||
|
||||
@@ -8,7 +8,6 @@ use tokio::sync::Mutex;
|
||||
use tokio_cron_scheduler::{Job, JobScheduler};
|
||||
use xitca_web::{
|
||||
body::ResponseBody,
|
||||
bytes::Bytes,
|
||||
error::Error,
|
||||
handler::{handler_service, path::PathRef, state::StateRef},
|
||||
http::{StatusCode, WebResponse},
|
||||
@@ -20,7 +19,6 @@ use xitca_web::{
|
||||
use crate::{
|
||||
check::get_updates,
|
||||
config::Theme,
|
||||
error,
|
||||
structs::update::Update,
|
||||
utils::{
|
||||
json::{to_full_json, to_simple_json},
|
||||
@@ -33,9 +31,9 @@ use crate::{
|
||||
const HTML: &str = include_str!("static/index.html");
|
||||
const JS: &str = include_str!("static/assets/index.js");
|
||||
const CSS: &str = include_str!("static/assets/index.css");
|
||||
const FAVICON_ICO: Bytes = Bytes::from_static(include_bytes!("static/favicon.ico"));
|
||||
const FAVICON_SVG: Bytes = Bytes::from_static(include_bytes!("static/favicon.svg"));
|
||||
const APPLE_TOUCH_ICON: Bytes = Bytes::from_static(include_bytes!("static/apple-touch-icon.png"));
|
||||
const FAVICON_ICO: &[u8] = include_bytes!("static/favicon.ico");
|
||||
const FAVICON_SVG: &[u8] = include_bytes!("static/favicon.svg");
|
||||
const APPLE_TOUCH_ICON: &[u8] = include_bytes!("static/apple-touch-icon.png");
|
||||
|
||||
const SORT_ORDER: [&str; 8] = [
|
||||
"monitored_images",
|
||||
@@ -57,24 +55,13 @@ pub async fn serve(port: &u16, ctx: &Context) -> std::io::Result<()> {
|
||||
if let Some(interval) = &ctx.config.refresh_interval {
|
||||
scheduler
|
||||
.add(
|
||||
match Job::new_async(interval, move |_uuid, _lock| {
|
||||
Job::new_async(interval, move |_uuid, _lock| {
|
||||
let data_copy = data_copy.clone();
|
||||
Box::pin(async move {
|
||||
data_copy.lock().await.refresh().await;
|
||||
})
|
||||
}) {
|
||||
Ok(job) => job,
|
||||
Err(e) => match e {
|
||||
tokio_cron_scheduler::JobSchedulerError::ParseSchedule => error!(
|
||||
"Failed to parse cron schedule: {}. Please ensure it is valid!",
|
||||
interval
|
||||
),
|
||||
e => error!(
|
||||
"An unexpected error occured while scheduling automatic refresh: {}",
|
||||
e
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
.unwrap(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -92,16 +79,12 @@ pub async fn serve(port: &u16, ctx: &Context) -> std::io::Result<()> {
|
||||
.at("/", get(handler_service(_static)))
|
||||
.at("/*", get(handler_service(_static)));
|
||||
}
|
||||
match app_builder
|
||||
app_builder
|
||||
.enclosed_fn(logger)
|
||||
.serve()
|
||||
.bind(format!("0.0.0.0:{}", port))
|
||||
{
|
||||
Ok(r) => r,
|
||||
Err(_) => error!("Failed to bind to port {}. Is it in use?", port),
|
||||
}
|
||||
.run()
|
||||
.wait()
|
||||
.bind(format!("0.0.0.0:{}", port))?
|
||||
.run()
|
||||
.wait()
|
||||
}
|
||||
|
||||
async fn _static(data: StateRef<'_, Arc<Mutex<ServerData>>>, path: PathRef<'_>) -> WebResponse {
|
||||
|
||||
@@ -35,7 +35,6 @@ pub struct VersionInfo {
|
||||
pub struct Image {
|
||||
pub reference: String,
|
||||
pub parts: Parts,
|
||||
pub url: Option<String>,
|
||||
pub digest_info: Option<DigestInfo>,
|
||||
pub version_info: Option<VersionInfo>,
|
||||
pub error: Option<String>,
|
||||
@@ -44,30 +43,16 @@ pub struct Image {
|
||||
|
||||
impl Image {
|
||||
/// Creates and populates the fields of an Image object based on the ImageSummary from the Docker daemon
|
||||
pub fn from_inspect_data<T: InspectData>(ctx: &Context, image: T) -> Option<Self> {
|
||||
pub fn from_inspect_data<T: InspectData>(image: T) -> Option<Self> {
|
||||
let tags = image.tags().unwrap();
|
||||
let digests = image.digests().unwrap();
|
||||
if !tags.is_empty() && !digests.is_empty() {
|
||||
let reference = tags[0].clone();
|
||||
if reference.contains('@') {
|
||||
return None; // As far as I know, references that contain @ are either manually pulled by the user or automatically created because of swarm. In the first case AFAICT we can't know what tag was originally pulled, so we'd have to make assumptions and I've decided to remove this. The other case is already handled seperately, so this also ensures images aren't displayed twice, once with and once without a digest.
|
||||
};
|
||||
let (registry, repository, tag) = split(&reference);
|
||||
let version_tag = Version::from_tag(&tag);
|
||||
let local_digests = digests
|
||||
.iter()
|
||||
.filter_map(
|
||||
|digest| match digest.split('@').collect::<Vec<&str>>().get(1) {
|
||||
Some(digest) => Some(digest.to_string()),
|
||||
None => {
|
||||
ctx.logger.warn(format!(
|
||||
"Ignoring invalid digest {} for image {}!",
|
||||
digest, reference
|
||||
));
|
||||
None
|
||||
}
|
||||
},
|
||||
)
|
||||
.map(|digest| digest.split('@').collect::<Vec<&str>>()[1].to_string())
|
||||
.collect();
|
||||
Some(Self {
|
||||
reference,
|
||||
@@ -76,7 +61,6 @@ impl Image {
|
||||
repository,
|
||||
tag,
|
||||
},
|
||||
url: image.url(),
|
||||
digest_info: Some(DigestInfo {
|
||||
local_digests,
|
||||
remote_digest: None,
|
||||
@@ -157,7 +141,6 @@ impl Image {
|
||||
Update {
|
||||
reference: self.reference.clone(),
|
||||
parts: self.parts.clone(),
|
||||
url: self.url.clone(),
|
||||
result: UpdateResult {
|
||||
has_update: has_update.to_option_bool(),
|
||||
info: match has_update {
|
||||
|
||||
@@ -1,62 +1,26 @@
|
||||
use bollard::secret::{ImageInspect, ImageSummary};
|
||||
|
||||
pub trait InspectData {
|
||||
fn tags(&self) -> Option<Vec<String>>;
|
||||
fn digests(&self) -> Option<Vec<String>>;
|
||||
fn url(&self) -> Option<String>;
|
||||
fn tags(&self) -> Option<&Vec<String>>;
|
||||
fn digests(&self) -> Option<&Vec<String>>;
|
||||
}
|
||||
|
||||
impl InspectData for ImageInspect {
|
||||
fn tags(&self) -> Option<Vec<String>> {
|
||||
self.repo_tags.clone()
|
||||
fn tags(&self) -> Option<&Vec<String>> {
|
||||
self.repo_tags.as_ref()
|
||||
}
|
||||
|
||||
fn digests(&self) -> Option<Vec<String>> {
|
||||
self.repo_digests.clone()
|
||||
}
|
||||
|
||||
fn url(&self) -> Option<String> {
|
||||
match &self.config {
|
||||
Some(config) => match &config.labels {
|
||||
Some(labels) => labels.get("org.opencontainers.image.url").cloned(),
|
||||
None => None,
|
||||
},
|
||||
None => None,
|
||||
}
|
||||
fn digests(&self) -> Option<&Vec<String>> {
|
||||
self.repo_digests.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl InspectData for ImageSummary {
|
||||
fn tags(&self) -> Option<Vec<String>> {
|
||||
Some(self.repo_tags.clone())
|
||||
fn tags(&self) -> Option<&Vec<String>> {
|
||||
Some(&self.repo_tags)
|
||||
}
|
||||
|
||||
fn digests(&self) -> Option<Vec<String>> {
|
||||
Some(self.repo_digests.clone())
|
||||
}
|
||||
|
||||
fn url(&self) -> Option<String> {
|
||||
self.labels.get("org.opencontainers.image.url").cloned()
|
||||
}
|
||||
}
|
||||
|
||||
impl InspectData for &String {
|
||||
fn tags(&self) -> Option<Vec<String>> {
|
||||
self.split('@').next().map(|tag| vec![tag.to_string()])
|
||||
}
|
||||
|
||||
fn digests(&self) -> Option<Vec<String>> {
|
||||
match self.split_once('@') {
|
||||
Some((reference, digest)) => Some(vec![format!(
|
||||
"{}@{}",
|
||||
reference.split(':').next().unwrap(),
|
||||
digest
|
||||
)]),
|
||||
None => Some(vec![]),
|
||||
}
|
||||
}
|
||||
|
||||
fn url(&self) -> Option<String> {
|
||||
None
|
||||
fn digests(&self) -> Option<&Vec<String>> {
|
||||
Some(&self.repo_digests)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
/// Enum for image status
|
||||
#[derive(Ord, Eq, PartialEq, PartialOrd, Clone, Debug)]
|
||||
#[derive(Ord, Eq, PartialEq, PartialOrd, Clone)]
|
||||
#[cfg_attr(test, derive(Debug))]
|
||||
pub enum Status {
|
||||
UpdateMajor,
|
||||
UpdateMinor,
|
||||
|
||||
@@ -2,12 +2,11 @@ use serde::{ser::SerializeStruct, Deserialize, Serialize};
|
||||
|
||||
use super::{parts::Parts, status::Status};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq, Default))]
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(test, derive(PartialEq, Debug, Default))]
|
||||
pub struct Update {
|
||||
pub reference: String,
|
||||
pub parts: Parts,
|
||||
pub url: Option<String>,
|
||||
pub result: UpdateResult,
|
||||
pub time: u32,
|
||||
pub server: Option<String>,
|
||||
@@ -15,16 +14,16 @@ pub struct Update {
|
||||
pub status: Status,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq, Default))]
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(test, derive(PartialEq, Debug, Default))]
|
||||
pub struct UpdateResult {
|
||||
pub has_update: Option<bool>,
|
||||
pub info: UpdateInfo,
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq, Default))]
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(test, derive(PartialEq, Debug, Default))]
|
||||
#[serde(untagged)]
|
||||
pub enum UpdateInfo {
|
||||
#[cfg_attr(test, default)]
|
||||
@@ -33,8 +32,8 @@ pub enum UpdateInfo {
|
||||
Digest(DigestUpdateInfo),
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Deserialize, Clone)]
|
||||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
pub struct VersionUpdateInfo {
|
||||
pub version_update_type: String,
|
||||
pub new_tag: String,
|
||||
@@ -42,8 +41,8 @@ pub struct VersionUpdateInfo {
|
||||
pub new_version: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Deserialize, Clone)]
|
||||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
pub struct DigestUpdateInfo {
|
||||
pub local_digests: Vec<String>,
|
||||
pub remote_digest: Option<String>,
|
||||
@@ -54,12 +53,10 @@ impl Serialize for VersionUpdateInfo {
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
let mut state = serializer.serialize_struct("VersionUpdateInfo", 5)?;
|
||||
let mut state = serializer.serialize_struct("VersionUpdateInfo", 3)?;
|
||||
let _ = state.serialize_field("type", "version");
|
||||
let _ = state.serialize_field("version_update_type", &self.version_update_type);
|
||||
let _ = state.serialize_field("new_tag", &self.new_tag);
|
||||
let _ = state.serialize_field("current_version", &self.current_version);
|
||||
let _ = state.serialize_field("new_version", &self.new_version);
|
||||
state.end()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,24 +49,18 @@ impl Version {
|
||||
positions.push((major.start(), major.end()));
|
||||
match major.as_str().parse() {
|
||||
Ok(m) => m,
|
||||
Err(_) => return None,
|
||||
Err(_) => return None
|
||||
}
|
||||
}
|
||||
None => return None,
|
||||
};
|
||||
let minor: Option<u32> = c.name("minor").map(|minor| {
|
||||
positions.push((minor.start(), minor.end()));
|
||||
minor
|
||||
.as_str()
|
||||
.parse()
|
||||
.unwrap_or_else(|_| panic!("Minor version invalid in tag {}", tag))
|
||||
minor.as_str().parse().unwrap_or_else(|_| panic!("Minor version invalid in tag {}", tag))
|
||||
});
|
||||
let patch: Option<u32> = c.name("patch").map(|patch| {
|
||||
positions.push((patch.start(), patch.end()));
|
||||
patch
|
||||
.as_str()
|
||||
.parse()
|
||||
.unwrap_or_else(|_| panic!("Patch version invalid in tag {}", tag))
|
||||
patch.as_str().parse().unwrap_or_else(|_| panic!("Patch version invalid in tag {}", tag))
|
||||
});
|
||||
let mut format_str = tag.to_string();
|
||||
positions.reverse();
|
||||
|
||||
@@ -16,12 +16,7 @@ pub fn split(reference: &str) -> (String, String, String) {
|
||||
}
|
||||
}
|
||||
};
|
||||
let splits = repository_and_tag
|
||||
.split('@')
|
||||
.next()
|
||||
.unwrap()
|
||||
.split(':')
|
||||
.collect::<Vec<&str>>();
|
||||
let splits = repository_and_tag.split(':').collect::<Vec<&str>>();
|
||||
let (repository, tag) = match splits.len() {
|
||||
1 | 2 => {
|
||||
let repository_components = splits[0].split('/').collect::<Vec<&str>>();
|
||||
@@ -43,9 +38,7 @@ pub fn split(reference: &str) -> (String, String, String) {
|
||||
};
|
||||
(repository, tag)
|
||||
}
|
||||
_ => {
|
||||
panic!("Failed to parse reference! Splits: {:?}", splits)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
(registry.to_string(), repository, tag.to_string())
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ pub fn parse_www_authenticate(www_auth: &str) -> String {
|
||||
.fold(String::new(), |acc, (key, value)| {
|
||||
if *key == "realm" {
|
||||
acc.to_owned() + value.as_escaped() + "?"
|
||||
} else if value.unescaped_len() != 0 {
|
||||
format!("{}&{}={}", acc, key, value.as_escaped())
|
||||
} else {
|
||||
acc
|
||||
format!("{}&{}={}", acc, key, value.as_escaped())
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
1
web/.tool-versions
Normal file
@@ -0,0 +1 @@
|
||||
nodejs 22.8.0
|
||||
BIN
web/bun.lockb
272
web/index.html
@@ -3,7 +3,6 @@
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
{% if theme == 'neutral' %}
|
||||
<meta
|
||||
name="theme-color"
|
||||
@@ -27,9 +26,9 @@
|
||||
content="#030712"
|
||||
>
|
||||
{% endif %}
|
||||
<link rel="icon" type="image/svg+xml" href="./favicon.svg">
|
||||
<link rel="icon" type="image/x-icon" href="./favicon.ico">
|
||||
<link rel="apple-touch-icon" href="./apple-touch-icon.png">
|
||||
<link rel="icon" type="image/svg+xml" href="favicon.svg">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
||||
<title>Cup</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -226,97 +225,182 @@
|
||||
</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 == '' %}
|
||||
Local images
|
||||
{% else %}
|
||||
{{ server }}
|
||||
{% endif %}
|
||||
</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 text-{{ theme }}-500"
|
||||
{% if server == '' %}
|
||||
<li class="mb-8 last:mb-0">
|
||||
<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"
|
||||
>
|
||||
<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>
|
||||
<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 }}
|
||||
</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,6 +13,7 @@
|
||||
"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",
|
||||
|
||||
@@ -24,7 +24,6 @@ const SORT_ORDER = [
|
||||
function App() {
|
||||
const [data, setData] = useState<Data | null>(null);
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
|
||||
if (!data) return <Loading onLoad={setData} />;
|
||||
return (
|
||||
<div
|
||||
@@ -64,15 +63,13 @@ function App() {
|
||||
<LastChecked datetime={data.last_updated} />
|
||||
<RefreshButton />
|
||||
</div>
|
||||
<div className="flex gap-2 px-6 text-black dark:text-white">
|
||||
<Search onChange={setSearchQuery} />
|
||||
</div>
|
||||
<Search onChange={setSearchQuery} />
|
||||
<ul>
|
||||
{Object.entries(
|
||||
data.images.reduce<Record<string, typeof data.images>>(
|
||||
(acc, image) => {
|
||||
const server = image.server ?? "";
|
||||
if (!Object.hasOwn(acc, server)) acc[server] = [];
|
||||
if (!acc[server]) acc[server] = [];
|
||||
acc[server].push(image);
|
||||
return acc;
|
||||
},
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { ArrowRight } from "lucide-react";
|
||||
import { theme } from "../theme";
|
||||
|
||||
export default function Badge({ from, to }: { from: string; to: string }) {
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center rounded-full bg-${theme}-50 px-2 py-1 text-xs font-medium text-${theme}-700 ring-1 ring-inset ring-${theme}-700/10 dark:bg-${theme}-400/10 dark:text-${theme}-400 dark:ring-${theme}-400/30 break-keep`}
|
||||
>
|
||||
{from}
|
||||
<ArrowRight className="size-3" />
|
||||
{to}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -21,8 +21,6 @@ export function CodeBlock({
|
||||
};
|
||||
};
|
||||
|
||||
const copyText = children instanceof Array ? children.join("") : children;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`group relative flex w-full items-center rounded-lg bg-${theme}-100 px-3 py-2 font-mono text-${theme}-700 dark:bg-${theme}-950 dark:text-${theme}-300`}
|
||||
@@ -37,7 +35,7 @@ export function CodeBlock({
|
||||
) : (
|
||||
<button
|
||||
className={`duration-50 absolute right-3 bg-${theme}-100 py-1 pl-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-${theme}-950`}
|
||||
onClick={handleCopy(`${copyText}`)}
|
||||
onClick={handleCopy(`docker pull ${children}`)}
|
||||
>
|
||||
<Clipboard className="size-5" />
|
||||
</button>
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
TriangleAlert,
|
||||
X,
|
||||
} from "lucide-react";
|
||||
import Badge from "./Badge";
|
||||
|
||||
const clickable_registries = [
|
||||
"registry-1.docker.io",
|
||||
@@ -39,11 +38,8 @@ 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 (data.url) {
|
||||
url = data.url;
|
||||
} else if (clickable_registries.includes(data.parts.registry)) {
|
||||
if (clickable_registries.includes(data.parts.registry)) {
|
||||
switch (data.parts.registry) {
|
||||
case "registry-1.docker.io":
|
||||
url = `https://hub.docker.com/r/${data.parts.repository}`;
|
||||
@@ -61,20 +57,7 @@ export default function Image({ data }: { data: Image }) {
|
||||
>
|
||||
<Box className={`size-6 shrink-0 text-${theme}-500`} />
|
||||
<span className="font-mono">{data.reference}</span>
|
||||
<div className="ml-auto flex gap-2">
|
||||
{data.result.info?.type === "version" ? (
|
||||
<Badge
|
||||
from={data.result.info.current_version}
|
||||
to={data.result.info.new_version}
|
||||
/>
|
||||
) : null}
|
||||
<WithTooltip
|
||||
text={info.description}
|
||||
className={`size-6 shrink-0 ${info.color}`}
|
||||
>
|
||||
<info.icon />
|
||||
</WithTooltip>
|
||||
</div>
|
||||
<Icon data={data} />
|
||||
</li>
|
||||
</button>
|
||||
<Dialog open={open} onClose={setOpen} className="relative z-10">
|
||||
@@ -93,14 +76,14 @@ export default function Image({ data }: { data: Image }) {
|
||||
>
|
||||
<div className="mb-4 flex items-center gap-3">
|
||||
<Box className={`size-6 shrink-0 text-${theme}-500`} />
|
||||
<DialogTitle className="break-all font-mono text-black dark:text-white">
|
||||
<DialogTitle className="font-mono text-black dark:text-white">
|
||||
{url ? (
|
||||
<>
|
||||
<a
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={`group w-fit hover:underline`}
|
||||
className={`group w-fit text-black hover:underline dark:text-white`}
|
||||
>
|
||||
<span>
|
||||
{data.reference}
|
||||
@@ -130,8 +113,7 @@ export default function Image({ data }: { data: Image }) {
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<info.icon className={`size-6 shrink-0 ${info.color}`} />
|
||||
{info.description}
|
||||
<DialogIcon data={data} />
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<Timer className="size-6 shrink-0 text-gray-500" />
|
||||
@@ -182,54 +164,118 @@ export default function Image({ data }: { data: Image }) {
|
||||
);
|
||||
}
|
||||
|
||||
function getInfo(data: Image):
|
||||
| {
|
||||
color: string;
|
||||
icon: typeof HelpCircle;
|
||||
description: string;
|
||||
}
|
||||
| undefined {
|
||||
function Icon({ data }: { data: Image }) {
|
||||
switch (data.result.has_update) {
|
||||
case null:
|
||||
return {
|
||||
color: "text-gray-500",
|
||||
icon: HelpCircle,
|
||||
description: "Unknown",
|
||||
};
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Unknown"
|
||||
className="ml-auto size-6 shrink-0 text-gray-500"
|
||||
>
|
||||
<HelpCircle />
|
||||
</WithTooltip>
|
||||
);
|
||||
case false:
|
||||
return {
|
||||
color: "text-green-500",
|
||||
icon: CircleCheck,
|
||||
description: "Up to date",
|
||||
};
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Up to date"
|
||||
className="ml-auto size-6 shrink-0 text-green-500"
|
||||
>
|
||||
<CircleCheck />
|
||||
</WithTooltip>
|
||||
);
|
||||
case true:
|
||||
if (data.result.info?.type === "version") {
|
||||
switch (data.result.info.version_update_type) {
|
||||
case "major":
|
||||
return {
|
||||
color: "text-red-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Major update",
|
||||
};
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Major Update"
|
||||
className="ml-auto size-6 shrink-0 text-red-500"
|
||||
>
|
||||
<CircleArrowUp />
|
||||
</WithTooltip>
|
||||
);
|
||||
case "minor":
|
||||
return {
|
||||
color: "text-yellow-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Minor update",
|
||||
};
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Minor Update"
|
||||
className="ml-auto size-6 shrink-0 text-yellow-500"
|
||||
>
|
||||
<CircleArrowUp />
|
||||
</WithTooltip>
|
||||
);
|
||||
case "patch":
|
||||
return {
|
||||
color: "text-blue-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Patch update",
|
||||
};
|
||||
return (
|
||||
<WithTooltip
|
||||
text="Patch Update"
|
||||
className="ml-auto size-6 shrink-0 text-blue-500"
|
||||
>
|
||||
<CircleArrowUp />
|
||||
</WithTooltip>
|
||||
);
|
||||
}
|
||||
} else if (data.result.info?.type === "digest") {
|
||||
return {
|
||||
color: "text-blue-500",
|
||||
icon: CircleArrowUp,
|
||||
description: "Update available",
|
||||
};
|
||||
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
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Data } from "../types";
|
||||
import Logo from "./Logo";
|
||||
import { theme } from "../theme";
|
||||
import { LoaderCircle } from "lucide-react";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
|
||||
export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
||||
fetch(
|
||||
process.env.NODE_ENV === "production"
|
||||
? "./api/v3/json"
|
||||
? "/api/v3/json"
|
||||
: `http://${window.location.hostname}:8000/api/v3/json`,
|
||||
).then((response) =>
|
||||
response.json().then((data) => {
|
||||
@@ -26,16 +26,9 @@ export default function Loading({ onLoad }: { onLoad: (data: Data) => void }) {
|
||||
<Logo />
|
||||
</div>
|
||||
<div
|
||||
className={`flex h-full flex-col items-center justify-center gap-1 text-${theme}-500 dark:text-${theme}-400`}
|
||||
className={`flex h-full items-center justify-center gap-1 text-${theme}-500 dark:text-${theme}-400`}
|
||||
>
|
||||
<div className="mb-8 flex gap-1">
|
||||
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>
|
||||
Loading <RefreshCw className="animate-spin" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function RefreshButton() {
|
||||
};
|
||||
return (
|
||||
<WithTooltip text="Reload">
|
||||
<button className="group shrink-0" onClick={refresh} disabled={disabled}>
|
||||
<button className="group" 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="size-6 group-disabled:animate-spin"
|
||||
className="shrink-0 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" />
|
||||
|
||||
@@ -23,30 +23,30 @@ export default function Search({
|
||||
onChange("");
|
||||
};
|
||||
return (
|
||||
<div
|
||||
className={`flex w-full items-center rounded-md border border-${theme}-200 dark:border-${theme}-700 gap-1 px-2 bg-${theme}-100 dark:bg-${theme}-900 group relative flex-nowrap`}
|
||||
>
|
||||
<SearchIcon
|
||||
className={`size-5 text-${theme}-600 dark:text-${theme}-400`}
|
||||
/>
|
||||
<div className="w-full">
|
||||
<input
|
||||
className={`h-10 w-full text-sm text-${theme}-800 dark:text-${theme}-200 peer bg-transparent focus:outline-none placeholder:text-${theme}-600 placeholder:dark:text-${theme}-400`}
|
||||
placeholder="Search"
|
||||
onChange={handleChange}
|
||||
value={searchQuery}
|
||||
></input>
|
||||
</div>
|
||||
{showClear && (
|
||||
<button
|
||||
onClick={handleClear}
|
||||
className={`hover:text-${theme}-600 dark:hover:text-${theme}-400 transition-colors duration-200`}
|
||||
>
|
||||
<X className="size-5" />
|
||||
</button>
|
||||
)}
|
||||
<div className={`w-full px-6 text-black dark:text-white`}>
|
||||
<div
|
||||
className="absolute -bottom-px left-1/2 h-full w-0 -translate-x-1/2 rounded-md border-b-2 border-b-blue-600 transition-all duration-200 group-has-[:focus]:w-[calc(100%+2px)]"
|
||||
className={`flex w-full items-center rounded-md border border-${theme}-200 dark:border-${theme}-700 gap-1 px-2 bg-${theme}-100 dark:bg-${theme}-900 peer flex-nowrap`}
|
||||
>
|
||||
<SearchIcon className={`size-5 text-${theme}-600 dark:text-${theme}-400`} />
|
||||
<div className="w-full">
|
||||
<input
|
||||
className={`h-10 w-full text-sm text-${theme}-800 dark:text-${theme}-200 peer bg-transparent focus:outline-none placeholder:text-${theme}-600 placeholder:dark:text-${theme}-400`}
|
||||
placeholder="Search"
|
||||
onChange={handleChange}
|
||||
value={searchQuery}
|
||||
></input>
|
||||
</div>
|
||||
{showClear && (
|
||||
<button
|
||||
onClick={handleClear}
|
||||
className={`hover:text-${theme}-600 dark:hover:text-${theme}-400 transition-colors duration-200`}
|
||||
>
|
||||
<X className="size-5" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className="relative left-1/2 h-[8px] w-0 -translate-x-1/2 -translate-y-[8px] rounded-md border-b-2 border-b-blue-600 transition-all duration-200 peer-has-[:focus]:w-full"
|
||||
style={{ clipPath: "inset(calc(100% - 2px) 0 0 0)" }}
|
||||
></div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,6 @@ export interface Image {
|
||||
repository: string;
|
||||
tag: string;
|
||||
};
|
||||
url: string | null;
|
||||
result: {
|
||||
has_update: boolean | null;
|
||||
info: VersionInfo | DigestInfo | null;
|
||||
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
variants: ["hover"],
|
||||
},
|
||||
{
|
||||
pattern: /bg-(gray|neutral)-(400|900|950)/,
|
||||
pattern: /bg-(gray|neutral)-(900|950)/,
|
||||
variants: ["dark"],
|
||||
},
|
||||
{
|
||||
@@ -27,16 +27,24 @@ export default {
|
||||
variants: ["before:dark", "after:dark", "dark", "hover:dark"],
|
||||
},
|
||||
{
|
||||
pattern: /text-(gray|neutral)-(50|300|200|400)/,
|
||||
pattern: /text-(gray|neutral)-(50|300|200)/,
|
||||
variants: ["dark"],
|
||||
},
|
||||
{
|
||||
pattern: /text-(gray|neutral)-600/,
|
||||
variants: ["*", "dark", "hover", "placeholder"],
|
||||
variants: ["dark", "hover"],
|
||||
},
|
||||
{
|
||||
pattern: /text-(gray|neutral)-400/,
|
||||
variants: ["*:dark", "dark", "dark:hover", "placeholder:dark"],
|
||||
variants: ["dark", "dark:hover"],
|
||||
},
|
||||
{
|
||||
pattern: /text-(gray|neutral)-600/,
|
||||
variants: ["placeholder"],
|
||||
},
|
||||
{
|
||||
pattern: /text-(gray|neutral)-400/,
|
||||
variants: ["placeholder:dark"],
|
||||
},
|
||||
{
|
||||
pattern: /text-(gray|neutral)-700/,
|
||||
@@ -60,12 +68,5 @@ export default {
|
||||
pattern: /border-(gray|neutral)-(700|800|900)/,
|
||||
variants: ["dark"],
|
||||
},
|
||||
{
|
||||
pattern: /ring-(gray|neutral)-700/,
|
||||
},
|
||||
{
|
||||
pattern: /ring-(gray|neutral)-400/,
|
||||
variants: ["dark"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -4,7 +4,6 @@ import react from "@vitejs/plugin-react-swc";
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
base: "./",
|
||||
build: {
|
||||
rollupOptions: {
|
||||
// https://stackoverflow.com/q/69614671/vite-without-hash-in-filename#75344943
|
||||
|
||||