Skip to content

Commit 3f81cd9

Browse files
authored
Merge pull request #2505 from mneunomne/master
Minor fixes + add version-check for reference
2 parents 56e3594 + bb4ffe8 commit 3f81cd9

File tree

3 files changed

+48
-9
lines changed

3 files changed

+48
-9
lines changed

src/js/adn/core.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,19 +1940,19 @@ const adnauseam = (function () {
19401940
const verifyVersion = exports.verifyVersion = async function () {
19411941
const version = vAPI.app.version;
19421942
console.log("current version: " + version);
1943-
if (version.includes('b')) {
1944-
console.log("beta version, don't check for updates");
1945-
return;
1946-
}
1943+
//if (version.includes('b')) {
1944+
//console.log("beta version, don't check for updates");
1945+
//return;
1946+
//}
19471947
// run get request on /repos/dhowe/AdNauseam/releases
1948-
const response = await fetch("https://api.github.com/repos/dhowe/AdNauseam/releases");
1948+
const response = await fetch("https://api.github.com/repos/dhowe/AdNauseam/releases/latest");
19491949
// validate
19501950
if (!response.ok) {
19511951
//throw new Error(`HTTP error! status: ${response.status}`);
19521952
}
19531953
// parse response
1954-
const releases = await response.json();
1955-
const latestRelease = releases[0];
1954+
const latestRelease = await response.json();
1955+
console.log("latestRelease", latestRelease)
19561956
const latestVersion = latestRelease.tag_name.replace('v', '');
19571957
console.log("latest version: " + latestVersion);
19581958

tools/make-artifacts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ case "$(uname -sr)" in
1212
Darwin*)
1313
echo 'Mac OS X'
1414
CHROME=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
15-
FIREFOX=/Applications/Firefox.app/Contents/MacOS/firefox-bin
15+
FIREFOX=/Applications/Firefox.app/Contents/MacOS/firefox
1616
OPERA=/Applications/Opera.app/Contents/MacOS/Opera
1717
;;
1818
Linux*)
@@ -126,7 +126,7 @@ fi
126126
if [ $DO_FIREFOX = true ]
127127
then
128128
printf '\n%s' "*** Target -> "
129-
command "${FIREFOX}" -v || { echo >&2 "Firefox is not installed."; exit 1; }
129+
# command "${FIREFOX}" -v || { echo >&2 "Firefox is not installed."; exit 1; }
130130
./tools/make-firefox.sh all
131131
web-ext build -s ${DES}/adnauseam.firefox -a ${ARTS}
132132
mv ${ARTS}/adnauseam-${VERSION}.zip ${ARTS}/adnauseam-${VERSION}.firefox.zip

tools/version-check.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Make sure you have jq installed AND be on the folder where 'adnauseam.chromium' is located
4+
5+
# Path to the adnauseam.chromium directory
6+
EXTENSION_DIR="adnauseam.chromium"
7+
8+
# Path to the manifest.json file
9+
MANIFEST_FILE="$EXTENSION_DIR/manifest.json"
10+
11+
# Check if the directory exists
12+
if [ -d "$EXTENSION_DIR" ]; then
13+
# Get the current version from the manifest file
14+
CURRENT_VERSION=$(jq -r .version "$MANIFEST_FILE")
15+
CURRENT_VERSION="v$CURRENT_VERSION"
16+
echo "Current version: $CURRENT_VERSION"
17+
18+
# Replace URL with the actual URL you want to use
19+
URL="https://api.github.com/repos/dhowe/AdNauseam/releases/latest"
20+
21+
# Get the latest release information using curl and jq
22+
LATEST_RELEASE=$(curl -s "$URL" | jq -r '.tag_name')
23+
24+
# Check if the latest version is different from the current version
25+
if [ "$LATEST_RELEASE" != "$CURRENT_VERSION" ]; then
26+
echo "Updating AdNauseam extension..."
27+
28+
# Download and extract the latest release
29+
curl -L -o "$EXTENSION_DIR.zip" "https://github.com/dhowe/AdNauseam/releases/download/$LATEST_RELEASE/adnauseam.chromium.zip"
30+
unzip -q "$EXTENSION_DIR.zip" -d "./"
31+
rm "$EXTENSION_DIR.zip"
32+
33+
echo "Update complete. Installed version: $LATEST_RELEASE"
34+
else
35+
echo "AdNauseam is already up to date. Installed version: $CURRENT_VERSION"
36+
fi
37+
else
38+
echo "AdNauseam extension directory not found. Please make sure it is installed."
39+
fi

0 commit comments

Comments
 (0)