From 0c6c7d037b6436a08e68eebfe393b89b22938868 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:33:55 +0000 Subject: [PATCH 1/5] Initial plan From b45abacd6a639c4b060f2282fe24aabc8c5e6b36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:42:38 +0000 Subject: [PATCH 2/5] Add version display and report issue link in footer Co-authored-by: horner <6094599+horner@users.noreply.github.com> --- create-a-container/.gitignore | 1 + create-a-container/public/style.css | 77 +++++++++++++++++++++ create-a-container/server.js | 8 +++ create-a-container/utils/index.js | 34 ++++++++- create-a-container/views/layouts/footer.ejs | 20 ++++++ 5 files changed, 138 insertions(+), 2 deletions(-) diff --git a/create-a-container/.gitignore b/create-a-container/.gitignore index 6ed48a98..d83eef34 100644 --- a/create-a-container/.gitignore +++ b/create-a-container/.gitignore @@ -1,2 +1,3 @@ .env node_modules +data/ diff --git a/create-a-container/public/style.css b/create-a-container/public/style.css index f88134b3..0c53c9d5 100644 --- a/create-a-container/public/style.css +++ b/create-a-container/public/style.css @@ -404,3 +404,80 @@ main { margin: 0.5rem 0 0 0; font-size: 0.9em; } + +/* Footer with version info */ +.version-footer { + position: fixed; + bottom: 0; + left: 0; + right: 0; + background-color: #1a252f; + color: #adb5bd; + padding: 0.5rem 1rem; + display: flex; + justify-content: space-between; + align-items: center; + font-size: 0.85rem; + z-index: 1000; + border-top: 1px solid #2c3e50; +} + +.version-info { + display: flex; + align-items: center; + gap: 0.5rem; +} + +.version-label { + font-weight: 600; + color: #6c757d; +} + +.version-link { + color: #3498db; + text-decoration: none; + font-family: 'Courier New', monospace; + transition: color 0.2s; +} + +.version-link:hover { + color: #5dade2; + text-decoration: underline; +} + +.version-date { + color: #6c757d; + font-size: 0.8rem; +} + +.issue-report { + display: flex; + align-items: center; +} + +.report-issue-link { + display: flex; + align-items: center; + gap: 0.4rem; + color: #adb5bd; + text-decoration: none; + padding: 0.25rem 0.75rem; + border-radius: 4px; + background-color: #2c3e50; + transition: all 0.2s; + font-size: 0.85rem; +} + +.report-issue-link:hover { + background-color: #3498db; + color: #fff; +} + +.report-issue-link i { + font-size: 1rem; +} + +/* Add padding to main content to prevent footer overlap */ +main { + padding-bottom: 3rem; +} diff --git a/create-a-container/server.js b/create-a-container/server.js index 6083c2f9..b1cedb8f 100644 --- a/create-a-container/server.js +++ b/create-a-container/server.js @@ -92,6 +92,14 @@ async function main() { max: 100, // limit each IP to 100 requests per windowMs })); + // Middleware to inject version info into all views + const { getVersionInfo } = require('./utils'); + const versionInfo = getVersionInfo(); + app.use((req, res, next) => { + res.locals.versionInfo = versionInfo; + next(); + }); + // Middleware to load sites for authenticated users app.use((req, res, next) => { if (req.session && req.session.user) { diff --git a/create-a-container/utils/index.js b/create-a-container/utils/index.js index 1283b26f..d74f8c4f 100644 --- a/create-a-container/utils/index.js +++ b/create-a-container/utils/index.js @@ -1,4 +1,4 @@ -const { spawn } = require('child_process'); +const { spawn, execSync } = require('child_process'); const ProxmoxApi = require('./proxmox-api'); function run(cmd, args, opts) { @@ -26,6 +26,35 @@ function run(cmd, args, opts) { }); } +/** + * Get version information from git + * @returns {Object} Version information with hash, date, and tag + */ +function getVersionInfo() { + try { + const commitHash = execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).trim(); + const commitDate = execSync('git log -1 --format=%ad --date=short', { encoding: 'utf8' }).trim(); + const tag = execSync('git describe --tags --exact-match 2>/dev/null || echo ""', { encoding: 'utf8' }).trim(); + + return { + hash: commitHash, + date: commitDate, + tag: tag || null, + display: tag ? `${tag} (${commitHash})` : commitHash, + url: `https://github.com/mieweb/opensource-server/commit/${commitHash}` + }; + } catch (error) { + console.error('Error getting version info:', error); + return { + hash: 'unknown', + date: new Date().toISOString().split('T')[0], + tag: null, + display: 'development', + url: 'https://github.com/mieweb/opensource-server' + }; + } +} + /** * Helper to validate that a redirect URL is a safe relative path. * @param {string} url - the URL to validate @@ -45,5 +74,6 @@ function isSafeRelativeUrl(url) { module.exports = { ProxmoxApi, run, - isSafeRelativeUrl + isSafeRelativeUrl, + getVersionInfo }; diff --git a/create-a-container/views/layouts/footer.ejs b/create-a-container/views/layouts/footer.ejs index 1935e964..386950af 100644 --- a/create-a-container/views/layouts/footer.ejs +++ b/create-a-container/views/layouts/footer.ejs @@ -2,6 +2,26 @@ + + +