mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-11 14:43:49 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efea81ef39 | ||
|
|
d3cb5af225 | ||
|
|
5904c2d2e2 | ||
|
|
674bc3d614 | ||
|
|
e4a07f9810 | ||
|
|
4e0f3c3eb9 | ||
|
|
ba20dd3086 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -355,7 +355,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cup"
|
name = "cup"
|
||||||
version = "3.2.1"
|
version = "3.2.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bollard",
|
"bollard",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cup"
|
name = "cup"
|
||||||
version = "3.2.2"
|
version = "3.2.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
},
|
},
|
||||||
"refresh_interval": {
|
"refresh_interval": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The interval at which Cup should check for updates. Must be a valid cron expression. Reference: https://github.com/Hexagon/croner-rust#pattern",
|
"description": "The interval at which Cup should check for updates. Must be a valid cron expression. Seconds are not optional. Reference: https://github.com/Hexagon/croner-rust#pattern",
|
||||||
"minLength": 11
|
"minLength": 11
|
||||||
},
|
},
|
||||||
"registries": {
|
"registries": {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tabler/icons-react": "^3.29.0",
|
"@tabler/icons-react": "^3.29.0",
|
||||||
"geist": "^1.3.1",
|
"geist": "^1.3.1",
|
||||||
"next": "15.2.3",
|
"next": "15.2.4",
|
||||||
"nextra": "^4.1.0",
|
"nextra": "^4.1.0",
|
||||||
"nextra-theme-docs": "^4.1.0",
|
"nextra-theme-docs": "^4.1.0",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ Cup can automatically refresh the results when running in server mode. Simply ad
|
|||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
"refresh_interval": "0 0,30 * * * *" // Check twice an hour
|
"refresh_interval": "0 */30 * * * *", // Check twice an hour
|
||||||
// Other options
|
// Other options
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use a cron expression to specify the refresh interval. The reference is [here](https://github.com/Hexagon/croner-rust#pattern)
|
You can use a cron expression to specify the refresh interval. Note that seconds are not optional. The reference is [here](https://github.com/Hexagon/croner-rust#pattern)
|
||||||
|
|||||||
@@ -182,10 +182,7 @@ pub async fn get_latest_tag(
|
|||||||
));
|
));
|
||||||
get_latest_digest(
|
get_latest_digest(
|
||||||
&Image {
|
&Image {
|
||||||
version_info: Some(VersionInfo {
|
version_info: None, // Overwrite previous version info, since it isn't useful anymore (equal tags means up to date and an image is truly up to date when its digests are up to date, and we'll be checking those anyway)
|
||||||
latest_remote_tag: Some(t.clone()),
|
|
||||||
..image.version_info.as_ref().unwrap().clone()
|
|
||||||
}),
|
|
||||||
time_ms: image.time_ms + elapsed(start),
|
time_ms: image.time_ms + elapsed(start),
|
||||||
..image.clone()
|
..image.clone()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,8 +8,12 @@ pub fn split(reference: &str) -> (String, String, String) {
|
|||||||
0 => unreachable!(),
|
0 => unreachable!(),
|
||||||
1 => (DEFAULT_REGISTRY, reference.to_string()),
|
1 => (DEFAULT_REGISTRY, reference.to_string()),
|
||||||
_ => {
|
_ => {
|
||||||
|
// Check if the image is from Docker Hub
|
||||||
|
if splits[0] == "docker.io" {
|
||||||
|
(DEFAULT_REGISTRY, splits[1..].join("/"))
|
||||||
// Check if we're looking at a domain
|
// Check if we're looking at a domain
|
||||||
if splits[0] == "localhost" || splits[0].contains('.') || splits[0].contains(':') {
|
} else if splits[0] == "localhost" || splits[0].contains('.') || splits[0].contains(':')
|
||||||
|
{
|
||||||
(splits[0], splits[1..].join("/"))
|
(splits[0], splits[1..].join("/"))
|
||||||
} else {
|
} else {
|
||||||
(DEFAULT_REGISTRY, reference.to_string())
|
(DEFAULT_REGISTRY, reference.to_string())
|
||||||
@@ -64,6 +68,7 @@ mod tests {
|
|||||||
assert_eq!(split("localhost:1234/test" ), (String::from("localhost:1234" ), String::from("test" ), String::from("latest")));
|
assert_eq!(split("localhost:1234/test" ), (String::from("localhost:1234" ), String::from("test" ), String::from("latest")));
|
||||||
assert_eq!(split("test:1234/idk" ), (String::from("test:1234" ), String::from("idk" ), String::from("latest")));
|
assert_eq!(split("test:1234/idk" ), (String::from("test:1234" ), String::from("idk" ), String::from("latest")));
|
||||||
assert_eq!(split("alpine:3.7" ), (String::from(DEFAULT_REGISTRY ), String::from("library/alpine" ), String::from("3.7" )));
|
assert_eq!(split("alpine:3.7" ), (String::from(DEFAULT_REGISTRY ), String::from("library/alpine" ), String::from("3.7" )));
|
||||||
|
assert_eq!(split("docker.io/library/alpine" ), (String::from(DEFAULT_REGISTRY ), String::from("library/alpine" ), String::from("latest")));
|
||||||
assert_eq!(split("docker.example.com/examplerepo/alpine:3.7" ), (String::from("docker.example.com" ), String::from("examplerepo/alpine" ), String::from("3.7" )));
|
assert_eq!(split("docker.example.com/examplerepo/alpine:3.7" ), (String::from("docker.example.com" ), String::from("examplerepo/alpine" ), String::from("3.7" )));
|
||||||
assert_eq!(split("docker.example.com/examplerepo/alpine/test2:3.7" ), (String::from("docker.example.com" ), String::from("examplerepo/alpine/test2" ), String::from("3.7" )));
|
assert_eq!(split("docker.example.com/examplerepo/alpine/test2:3.7" ), (String::from("docker.example.com" ), String::from("examplerepo/alpine/test2" ), String::from("3.7" )));
|
||||||
assert_eq!(split("docker.example.com/examplerepo/alpine/test2/test3:3.7"), (String::from("docker.example.com" ), String::from("examplerepo/alpine/test2/test3"), String::from("3.7" )));
|
assert_eq!(split("docker.example.com/examplerepo/alpine/test2/test3:3.7"), (String::from("docker.example.com" ), String::from("examplerepo/alpine/test2/test3"), String::from("3.7" )));
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default function RefreshButton() {
|
|||||||
request.open(
|
request.open(
|
||||||
"GET",
|
"GET",
|
||||||
process.env.NODE_ENV === "production"
|
process.env.NODE_ENV === "production"
|
||||||
? "/api/v3/refresh"
|
? "./api/v3/refresh"
|
||||||
: `http://${window.location.hostname}:8000/api/v3/refresh`,
|
: `http://${window.location.hostname}:8000/api/v3/refresh`,
|
||||||
);
|
);
|
||||||
request.send();
|
request.send();
|
||||||
|
|||||||
Reference in New Issue
Block a user