Compare commits
5 Commits
b7decc3f98
...
v1.6.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 27a98598bd | |||
| 42c3fff9a8 | |||
| e71c47f781 | |||
| ad01b3a1c1 | |||
| 40ce55f568 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/dist
|
/dist
|
||||||
.env
|
.env
|
||||||
|
/public/banner.png
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "waifu-board",
|
"name": "waifu-board",
|
||||||
"version": "v1.2.0",
|
"version": "v1.6.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "waifu-board",
|
"name": "waifu-board",
|
||||||
"version": "v1.2.0",
|
"version": "v1.6.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ryuziii/discord-rpc": "^1.0.1-rc.1",
|
"@ryuziii/discord-rpc": "^1.0.1-rc.1",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module.exports = function (db) {
|
|||||||
'INSERT INTO favorites (id, title, image_url, thumbnail_url, tags) VALUES (?, ?, ?, ?, ?)';
|
'INSERT INTO favorites (id, title, image_url, thumbnail_url, tags) VALUES (?, ?, ?, ?, ?)';
|
||||||
db.run(
|
db.run(
|
||||||
stmt,
|
stmt,
|
||||||
[fav.id, fav.title, fav.imageUrl, fav.thumbnailUrl, fav.tags],
|
[fav.id, fav.title, fav.image_url, fav.thumbnail_url, fav.tags],
|
||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.code.includes('SQLITE_CONSTRAINT')) {
|
if (err.code.includes('SQLITE_CONSTRAINT')) {
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
|
const GITEA_INSTANCE = 'https://git.waifuboard.app';
|
||||||
const REPO_OWNER = 'ItsSkaiya';
|
const REPO_OWNER = 'ItsSkaiya';
|
||||||
const REPO_NAME = 'WaifuBoard-Extensions';
|
const REPO_NAME = 'WaifuBoard-Extensions';
|
||||||
const API_URL = `https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/contents/extensions?ref=main`;
|
|
||||||
|
let DETECTED_BRANCH = 'main';
|
||||||
|
|
||||||
|
const API_URL_BASE = `${GITEA_INSTANCE}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/contents`;
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const browseGrid = document.getElementById('marketplace-grid');
|
const browseGrid = document.getElementById('marketplace-grid');
|
||||||
const installedGrid = document.getElementById('installed-grid');
|
const installedGrid = document.getElementById('installed-grid');
|
||||||
|
|
||||||
const statTotal = document.getElementById('stat-total');
|
const statTotal = document.getElementById('stat-total');
|
||||||
const statInstalled = document.getElementById('stat-installed');
|
const statInstalled = document.getElementById('stat-installed');
|
||||||
|
|
||||||
const tabBrowse = document.getElementById('tab-browse');
|
const tabBrowse = document.getElementById('tab-browse');
|
||||||
const tabInstalled = document.getElementById('tab-installed');
|
const tabInstalled = document.getElementById('tab-installed');
|
||||||
const viewBrowse = document.getElementById('view-browse');
|
const viewBrowse = document.getElementById('view-browse');
|
||||||
const viewInstalled = document.getElementById('view-installed');
|
const viewInstalled = document.getElementById('view-installed');
|
||||||
|
const messageBar = document.getElementById('message-bar');
|
||||||
|
|
||||||
let allRemoteExtensions = [];
|
let allRemoteExtensions = [];
|
||||||
let installedExtensionsList = [];
|
let installedExtensionsList = [];
|
||||||
|
|
||||||
const messageBar = document.getElementById('message-bar');
|
|
||||||
|
|
||||||
function showMessage(msg, type = 'success') {
|
function showMessage(msg, type = 'success') {
|
||||||
if (!messageBar) return;
|
if (!messageBar) return;
|
||||||
messageBar.textContent = msg;
|
messageBar.textContent = msg;
|
||||||
@@ -34,56 +35,17 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
|
|
||||||
function showRestartToast() {
|
function showRestartToast() {
|
||||||
if (document.getElementById('restart-toast')) return;
|
if (document.getElementById('restart-toast')) return;
|
||||||
|
|
||||||
const toast = document.createElement('div');
|
const toast = document.createElement('div');
|
||||||
toast.id = 'restart-toast';
|
toast.id = 'restart-toast';
|
||||||
toast.style.cssText = `
|
toast.style.cssText = `position: fixed; bottom: 20px; right: 20px; background: #1f2937; border: 1px solid var(--accent); border-radius: 12px; padding: 1rem 1.5rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 2000; animation: slideUp 0.3s ease-out;`;
|
||||||
position: fixed;
|
toast.innerHTML = `<div style="display:flex; flex-direction:column;"><span style="color:#fff; font-weight:600;">Restart Required</span><span style="color:#9ca3af; font-size:0.8rem;">Changes will apply after restart.</span></div><button id="btn-restart-now" style="background: var(--accent); color: white; border: none; padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 0.85rem; transition: 0.2s;">Restart Now</button>`;
|
||||||
bottom: 20px;
|
|
||||||
right: 20px;
|
|
||||||
background: #1f2937;
|
|
||||||
border: 1px solid var(--accent);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 1rem 1.5rem;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 1rem;
|
|
||||||
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
|
|
||||||
z-index: 2000;
|
|
||||||
animation: slideUp 0.3s ease-out;
|
|
||||||
`;
|
|
||||||
|
|
||||||
toast.innerHTML = `
|
|
||||||
<div style="display:flex; flex-direction:column;">
|
|
||||||
<span style="color:#fff; font-weight:600;">Restart Required</span>
|
|
||||||
<span style="color:#9ca3af; font-size:0.8rem;">Changes will apply after restart.</span>
|
|
||||||
</div>
|
|
||||||
<button id="btn-restart-now" style="
|
|
||||||
background: var(--accent);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
transition: 0.2s;
|
|
||||||
">Restart Now</button>
|
|
||||||
`;
|
|
||||||
|
|
||||||
document.body.appendChild(toast);
|
document.body.appendChild(toast);
|
||||||
|
|
||||||
const btn = document.getElementById('btn-restart-now');
|
const btn = document.getElementById('btn-restart-now');
|
||||||
btn.onmouseover = () => btn.style.opacity = '0.9';
|
btn.onmouseover = () => btn.style.opacity = '0.9';
|
||||||
btn.onmouseout = () => btn.style.opacity = '1';
|
btn.onmouseout = () => btn.style.opacity = '1';
|
||||||
|
|
||||||
btn.onclick = () => {
|
btn.onclick = () => {
|
||||||
if (window.api && typeof window.api.restartApp === 'function') {
|
if (window.api && typeof window.api.restartApp === 'function') window.api.restartApp();
|
||||||
window.api.restartApp();
|
else alert("Please close and reopen the application manually.");
|
||||||
} else {
|
|
||||||
console.error("Restart API not found in window.api");
|
|
||||||
alert("Please close and reopen the application manually.");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,44 +79,67 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
|
|
||||||
async function fetchRemoteExtensions() {
|
async function fetchRemoteExtensions() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(API_URL);
|
let res = await fetch(API_URL_BASE);
|
||||||
if (!res.ok) throw new Error(`GitHub API Error: ${res.status}`);
|
|
||||||
|
if (res.status === 404) {
|
||||||
|
console.warn("Default branch failed, trying 'main'...");
|
||||||
|
DETECTED_BRANCH = 'main';
|
||||||
|
res = await fetch(`${API_URL_BASE}?ref=main`);
|
||||||
|
}
|
||||||
|
if (res.status === 404) {
|
||||||
|
console.warn("Main branch failed, trying 'master'...");
|
||||||
|
DETECTED_BRANCH = 'master';
|
||||||
|
res = await fetch(`${API_URL_BASE}?ref=master`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!res.ok) throw new Error(`Gitea API Error: ${res.status}`);
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
allRemoteExtensions = data.filter(item => item.name.endsWith('.js'));
|
if (Array.isArray(data)) {
|
||||||
renderBrowseGrid(allRemoteExtensions);
|
allRemoteExtensions = data.filter(item => item.name.endsWith('.js'));
|
||||||
updateStats();
|
renderBrowseGrid(allRemoteExtensions);
|
||||||
|
updateStats();
|
||||||
|
} else {
|
||||||
|
throw new Error("Invalid API response format");
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
if(browseGrid) browseGrid.innerHTML = `<div class="loading-state"><p style="color:#ef4444">Failed to load marketplace.<br>${e.message}</p></div>`;
|
if(browseGrid) browseGrid.innerHTML = `<div class="loading-state"><p style="color:#ef4444">Failed to load marketplace.<br>${e.message}</p></div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRawUrl(filename) {
|
||||||
|
return `${GITEA_INSTANCE}/${REPO_OWNER}/${REPO_NAME}/raw/branch/main/${filename}`;
|
||||||
|
}
|
||||||
|
|
||||||
async function getExtensionDetails(url) {
|
async function getExtensionDetails(url) {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
|
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
|
||||||
const text = await res.text();
|
const text = await res.text();
|
||||||
|
|
||||||
const baseUrlMatch = text.match(/baseUrl\s*=\s*["']([^"']+)["']/);
|
const regex = /(?:this\.|const\s+|let\s+|var\s+)?baseUrl\s*=\s*(["'`])(.*?)\1/i;
|
||||||
let baseUrl = baseUrlMatch ? baseUrlMatch[1] : null;
|
const match = text.match(regex);
|
||||||
|
|
||||||
if (baseUrl) {
|
let finalHostname = null;
|
||||||
|
if (match && match[2]) {
|
||||||
|
let rawUrl = match[2].trim();
|
||||||
|
if (!rawUrl.startsWith('http')) rawUrl = 'https://' + rawUrl;
|
||||||
try {
|
try {
|
||||||
const urlObj = new URL(baseUrl);
|
const urlObj = new URL(rawUrl);
|
||||||
baseUrl = urlObj.hostname;
|
finalHostname = urlObj.hostname;
|
||||||
} catch(e) {
|
} catch(e) {}
|
||||||
console.warn("Invalid URL in extension:", baseUrl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const classMatch = text.match(/class\s+(\w+)/);
|
const classMatch = text.match(/class\s+(\w+)/);
|
||||||
const name = classMatch ? classMatch[1] : null;
|
const name = classMatch ? classMatch[1] : null;
|
||||||
|
|
||||||
let type = 'Image';
|
let type = 'Image';
|
||||||
if (text.includes('type = "book-board"') || text.includes("type = 'book-board'")) {
|
if (text.includes('type = "book-board"') || text.includes("type = 'book-board'")) type = 'Book';
|
||||||
type = 'Book';
|
|
||||||
}
|
|
||||||
|
|
||||||
return { baseUrl, name, type };
|
return { baseUrl: finalHostname, name, type };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return { baseUrl: null, name: null, type: 'Unknown' };
|
return { baseUrl: null, name: null, type: 'Unknown' };
|
||||||
}
|
}
|
||||||
@@ -163,29 +148,32 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
async function createCard(item, isLocalOnly = false) {
|
async function createCard(item, isLocalOnly = false) {
|
||||||
const isInstalled = installedExtensionsList.includes(item.name);
|
const isInstalled = installedExtensionsList.includes(item.name);
|
||||||
|
|
||||||
const downloadUrl = item.download_url || null;
|
const downloadUrl = getRawUrl(item.name);
|
||||||
let sizeKB = item.size ? (item.size / 1024).toFixed(1) + ' KB' : 'Local';
|
|
||||||
|
|
||||||
|
let sizeKB = item.size ? (item.size / 1024).toFixed(1) + ' KB' : 'Local';
|
||||||
let iconUrl = '';
|
let iconUrl = '';
|
||||||
let displayName = item.name.replace('.js', '');
|
let displayName = item.name.replace('.js', '');
|
||||||
let typeLabel = 'Extension';
|
let typeLabel = 'Extension';
|
||||||
let typeClass = 'type-image';
|
let typeClass = 'type-image';
|
||||||
|
|
||||||
if (downloadUrl) {
|
const fallbackIcon = `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22gray%22 stroke-width=%222%22><rect x=%223%22 y=%223%22 width=%2218%22 height=%2218%22 rx=%222%22/></svg>`;
|
||||||
|
|
||||||
|
if (!isLocalOnly) {
|
||||||
const details = await getExtensionDetails(downloadUrl);
|
const details = await getExtensionDetails(downloadUrl);
|
||||||
displayName = details.name || displayName;
|
displayName = details.name || displayName;
|
||||||
const domain = details.baseUrl || 'github.com';
|
|
||||||
iconUrl = `https://www.google.com/s2/favicons?domain=${domain}&sz=128`;
|
if (details.baseUrl) {
|
||||||
|
iconUrl = `https://www.google.com/s2/favicons?domain=${details.baseUrl}&sz=128`;
|
||||||
|
} else {
|
||||||
|
iconUrl = `https://ui-avatars.com/api/?name=${displayName}&background=1f2937&color=fff&length=1`;
|
||||||
|
}
|
||||||
|
|
||||||
if (details.type === 'Book') {
|
if (details.type === 'Book') {
|
||||||
typeLabel = 'Book Board';
|
typeLabel = 'Book Board';
|
||||||
typeClass = 'type-book';
|
typeClass = 'type-book';
|
||||||
} else {
|
|
||||||
typeLabel = 'Image Board';
|
|
||||||
typeClass = 'type-image';
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
iconUrl = `https://ui-avatars.com/api/?name=${displayName}&background=18181b&color=fff&length=1`;
|
iconUrl = `https://ui-avatars.com/api/?name=${displayName}&background=1f2937&color=fff&length=1`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const card = document.createElement('div');
|
const card = document.createElement('div');
|
||||||
@@ -199,16 +187,14 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
const renderInner = (installed) => `
|
const renderInner = (installed) => `
|
||||||
<div class="card-header-row">
|
<div class="card-header-row">
|
||||||
<div class="ext-icon-box">
|
<div class="ext-icon-box">
|
||||||
<img src="${iconUrl}" class="ext-icon" onerror="this.src='data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22gray%22 stroke-width=%222%22><rect x=%223%22 y=%223%22 width=%2218%22 height=%2218%22 rx=%222%22/></svg>'">
|
<img src="${iconUrl}" class="ext-icon" onerror="this.onerror=null; this.src='${fallbackIcon}'">
|
||||||
</div>
|
</div>
|
||||||
<span class="type-badge ${typeClass}">${typeLabel}</span>
|
<span class="type-badge ${typeClass}">${typeLabel}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ext-info">
|
<div class="ext-info">
|
||||||
<h3 class="ext-name">${displayName}</h3>
|
<h3 class="ext-name">${displayName}</h3>
|
||||||
<div class="ext-filename">${item.name}</div>
|
<div class="ext-filename">${item.name}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<div class="ext-status-group">${installed ? `<span class="status-badge status-installed">${checkIcon} Installed</span>` : ''}
|
<div class="ext-status-group">${installed ? `<span class="status-badge status-installed">${checkIcon} Installed</span>` : ''}
|
||||||
<span class="ext-size-badge">${sizeKB}</span>
|
<span class="ext-size-badge">${sizeKB}</span>
|
||||||
@@ -233,12 +219,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
installedExtensionsList = installedExtensionsList.filter(n => n !== item.name);
|
installedExtensionsList = installedExtensionsList.filter(n => n !== item.name);
|
||||||
card.innerHTML = renderInner(false);
|
card.innerHTML = renderInner(false);
|
||||||
updateStats();
|
updateStats();
|
||||||
|
|
||||||
if (tabInstalled.classList.contains('active')) {
|
if (tabInstalled.classList.contains('active')) {
|
||||||
card.remove();
|
card.remove();
|
||||||
if (installedGrid.children.length === 0) {
|
if (installedGrid.children.length === 0) installedGrid.innerHTML = '<div class="loading-state"><p>No extensions installed.</p></div>';
|
||||||
installedGrid.innerHTML = '<div class="loading-state"><p>No extensions installed.</p></div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
showRestartToast();
|
showRestartToast();
|
||||||
} else {
|
} else {
|
||||||
@@ -250,6 +233,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
btn.innerHTML = '<svg class="spinner" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="currentColor" stroke-width="5"></circle></svg>';
|
btn.innerHTML = '<svg class="spinner" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="currentColor" stroke-width="5"></circle></svg>';
|
||||||
|
|
||||||
const success = await window.api.installExtension(item.name, downloadUrl);
|
const success = await window.api.installExtension(item.name, downloadUrl);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
installedExtensionsList.push(item.name);
|
installedExtensionsList.push(item.name);
|
||||||
card.innerHTML = renderInner(true);
|
card.innerHTML = renderInner(true);
|
||||||
@@ -258,6 +242,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
showRestartToast();
|
showRestartToast();
|
||||||
} else {
|
} else {
|
||||||
showMessage('Failed to install', 'error');
|
showMessage('Failed to install', 'error');
|
||||||
|
console.error("Install failed for URL:", downloadUrl);
|
||||||
btn.innerHTML = originalHTML;
|
btn.innerHTML = originalHTML;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,7 +269,6 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
installedGrid.innerHTML = '<div class="loading-state"><p>No extensions installed.</p></div>';
|
installedGrid.innerHTML = '<div class="loading-state"><p>No extensions installed.</p></div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const filename of installedExtensionsList) {
|
for (const filename of installedExtensionsList) {
|
||||||
const remoteData = allRemoteExtensions.find(r => r.name === filename);
|
const remoteData = allRemoteExtensions.find(r => r.name === filename);
|
||||||
const item = remoteData || { name: filename, download_url: null, size: 0 };
|
const item = remoteData || { name: filename, download_url: null, size: 0 };
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await window.api.getChapters(currentSource, id);
|
const response = await window.api.getChapters(currentSource, id);
|
||||||
currentChapters = response.success ? response.data : [];
|
currentChapters = response.success ? response.data.chapters : [];
|
||||||
currentChapterPage = 1;
|
currentChapterPage = 1;
|
||||||
|
|
||||||
if (!highResCover && response.extra && response.extra.cover) {
|
if (!highResCover && response.extra && response.extra.cover) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const GITHUB_OWNER = 'ItsSkaiya';
|
const Gitea_OWNER = 'ItsSkaiya';
|
||||||
const GITHUB_REPO = 'WaifuBoard';
|
const Gitea_REPO = 'WaifuBoard';
|
||||||
const CURRENT_VERSION = 'v1.6.2';
|
const CURRENT_VERSION = 'v1.6.2';
|
||||||
const UPDATE_CHECK_INTERVAL = 5 * 60 * 1000;
|
const UPDATE_CHECK_INTERVAL = 5 * 60 * 1000;
|
||||||
|
|
||||||
@@ -58,20 +58,36 @@ function isVersionOutdated(versionA, versionB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkForUpdates() {
|
async function checkForUpdates() {
|
||||||
console.log(`Checking for updates for ${GITHUB_OWNER}/${GITHUB_REPO}...`);
|
console.log(`Checking for updates for ${Gitea_OWNER}/${Gitea_REPO}...`);
|
||||||
const apiUrl = `https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPO}/releases/latest`;
|
|
||||||
|
const apiUrl = `https://git.waifuboard.app/api/v1/repos/${Gitea_OWNER}/${Gitea_REPO}/releases/latest`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(apiUrl);
|
const response = await fetch(apiUrl, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`GitHub API error: ${response.statusText}`);
|
if (response.status === 404) {
|
||||||
|
console.info('No releases found for this repository.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error(`Gitea API error: ${response.status} ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
const latestVersion = data.tag_name;
|
const latestVersion = data.tag_name;
|
||||||
console.log(`Latest GitHub Release: ${latestVersion}`);
|
|
||||||
|
if (!latestVersion) {
|
||||||
|
console.warn("Release found but no tag_name present");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Latest Gitea Release: ${latestVersion}`);
|
||||||
|
|
||||||
if (isVersionOutdated(CURRENT_VERSION, latestVersion)) {
|
if (isVersionOutdated(CURRENT_VERSION, latestVersion)) {
|
||||||
console.warn('Update available!');
|
console.warn('Update available!');
|
||||||
@@ -82,6 +98,6 @@ async function checkForUpdates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch GitHub release:', error);
|
console.error('Failed to fetch Gitea release:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user