From 5eb9e5a45ee87a1d6606672e086c203eb36bc7a3 Mon Sep 17 00:00:00 2001 From: TrianguloY Date: Mon, 19 Aug 2024 18:16:45 +0200 Subject: [PATCH] dynamically update timestamp of assets fixes #374 --- .github/workflows/assets-updater.yml | 11 ++++++++++- .../modules/companions/ClearUrlCatalog.java | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/assets-updater.yml b/.github/workflows/assets-updater.yml index 0034aad..24dad7d 100644 --- a/.github/workflows/assets-updater.yml +++ b/.github/workflows/assets-updater.yml @@ -89,9 +89,18 @@ jobs: exit 1 fi - # create and push commit with the new file # at this point we know the new file is different from the last because hashes are different (old==remote!=new) git add "$FILE_PATH" + + # update the timestamp + marker="/\*$FILE_NAME-timestamp\*/" + grep -rli "$marker" * | while read file ; do + echo "Updating timestamp from file $file" + sed -i "s|$marker\(.*\)$marker|$marker$(date +%s)000L$marker|" "$file" + git add "$file" + done + + # create and push commit with the changes git commit -m " [action] Updated $FILE_NAME diff --git a/app/src/main/java/com/trianguloy/urlchecker/modules/companions/ClearUrlCatalog.java b/app/src/main/java/com/trianguloy/urlchecker/modules/companions/ClearUrlCatalog.java index aa6595d..84cf3ed 100644 --- a/app/src/main/java/com/trianguloy/urlchecker/modules/companions/ClearUrlCatalog.java +++ b/app/src/main/java/com/trianguloy/urlchecker/modules/companions/ClearUrlCatalog.java @@ -60,7 +60,7 @@ public class ClearUrlCatalog { catalogURL = new GenericPref.Str("clearurl_catalogURL", "https://rules2.clearurls.xyz/data.minify.json", cntx); hashURL = new GenericPref.Str("clearurl_hashURL", "https://rules2.clearurls.xyz/rules.minify.hash", cntx); autoUpdate = new GenericPref.Bool("clearurl_autoUpdate", false, cntx); - lastUpdate = new GenericPref.Lng("clearurl_lastUpdate", 1661990400000L, cntx); // time when the data.minify.json asset file was updated (floored to previous UTC day) + lastUpdate = new GenericPref.Lng("clearurl_lastUpdate", /*data.minify.json-timestamp*/1716151560000L/*data.minify.json-timestamp*/, cntx); lastCheck = new GenericPref.Lng("clearurl_lastCheck", -1L, cntx); lastAuto = new GenericPref.Bool("clearurl_lastAuto", false, cntx);