Compare commits
1 Commits
get_update
...
v0.5.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86294dea3c |
@@ -1610,7 +1610,6 @@ class ScriptExecutionHandler {
|
|||||||
// TerminalHandler removed - not used by current application
|
// TerminalHandler removed - not used by current application
|
||||||
|
|
||||||
app.prepare().then(() => {
|
app.prepare().then(() => {
|
||||||
console.log('> Next.js app prepared successfully');
|
|
||||||
const httpServer = createServer(async (req, res) => {
|
const httpServer = createServer(async (req, res) => {
|
||||||
try {
|
try {
|
||||||
// Be sure to pass `true` as the second argument to `url.parse`.
|
// Be sure to pass `true` as the second argument to `url.parse`.
|
||||||
@@ -1716,9 +1715,4 @@ app.prepare().then(() => {
|
|||||||
autoSyncModule.setupGracefulShutdown();
|
autoSyncModule.setupGracefulShutdown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch((err) => {
|
|
||||||
console.error('> Failed to start server:', err.message);
|
|
||||||
console.error('> If you see "Could not find a production build", run: npm run build');
|
|
||||||
console.error('> Full error:', err);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -238,27 +238,6 @@ export const versionRouter = createTRPCRouter({
|
|||||||
// Clear/create the log file
|
// Clear/create the log file
|
||||||
await writeFile(logPath, '', 'utf-8');
|
await writeFile(logPath, '', 'utf-8');
|
||||||
|
|
||||||
// Always fetch the latest update.sh from GitHub before running
|
|
||||||
// This ensures we always use the newest update script, avoiding
|
|
||||||
// the "chicken-and-egg" problem where old scripts can't update properly
|
|
||||||
const updateScriptUrl = 'https://raw.githubusercontent.com/community-scripts/ProxmoxVE-Local/main/update.sh';
|
|
||||||
try {
|
|
||||||
const response = await fetch(updateScriptUrl);
|
|
||||||
if (response.ok) {
|
|
||||||
const latestScript = await response.text();
|
|
||||||
await writeFile(updateScriptPath, latestScript, { mode: 0o755 });
|
|
||||||
// Log that we fetched the latest script
|
|
||||||
await writeFile(logPath, '[INFO] Fetched latest update.sh from GitHub\n', { flag: 'a' });
|
|
||||||
} else {
|
|
||||||
// If fetch fails, log warning but continue with local script
|
|
||||||
await writeFile(logPath, `[WARNING] Could not fetch latest update.sh (HTTP ${response.status}), using local version\n`, { flag: 'a' });
|
|
||||||
}
|
|
||||||
} catch (fetchError) {
|
|
||||||
// If fetch fails, log warning but continue with local script
|
|
||||||
const errorMsg = fetchError instanceof Error ? fetchError.message : 'Unknown error';
|
|
||||||
await writeFile(logPath, `[WARNING] Could not fetch latest update.sh: ${errorMsg}, using local version\n`, { flag: 'a' });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Spawn the update script as a detached process using nohup
|
// Spawn the update script as a detached process using nohup
|
||||||
// This allows it to run independently and kill the parent Node.js process
|
// This allows it to run independently and kill the parent Node.js process
|
||||||
// Redirect output to log file
|
// Redirect output to log file
|
||||||
|
|||||||
Reference in New Issue
Block a user