Display fediwall version in page footer

This commit is contained in:
Marcel Hellkamp 2023-07-20 11:44:25 +02:00
parent aae24de78b
commit bb03f7db94
6 changed files with 81 additions and 9 deletions

2
env.d.ts vendored
View File

@ -1 +1,3 @@
/// <reference types="vite/client" /> /// <reference types="vite/client" />
const __VERSION__: readonly string

64
package-lock.json generated
View File

@ -21,6 +21,7 @@
"@types/node": "^18.16.17", "@types/node": "^18.16.17",
"@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue": "^4.2.3",
"@vue/tsconfig": "^0.4.0", "@vue/tsconfig": "^0.4.0",
"git-describe": "^4.1.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"typescript": "~5.0.4", "typescript": "~5.0.4",
"vite": "^4.3.9", "vite": "^4.3.9",
@ -418,6 +419,12 @@
"integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==",
"dev": true "dev": true
}, },
"node_modules/@types/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
"dev": true
},
"node_modules/@types/web-bluetooth": { "node_modules/@types/web-bluetooth": {
"version": "0.0.17", "version": "0.0.17",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz", "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz",
@ -1109,6 +1116,22 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/git-describe": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/git-describe/-/git-describe-4.1.1.tgz",
"integrity": "sha512-JC8ganO5kO80G8+XE98TDDjnMXQN3Estk3qdJuG2EGRF/l6zuMTMcN+8OSfQZ5FWpqIRLB015anWX4aSRgnxAQ==",
"dev": true,
"dependencies": {
"@types/semver": "^7.3.8",
"lodash": "^4.17.21"
},
"engines": {
"node": ">=4.0.0"
},
"optionalDependencies": {
"semver": "^5.6.0"
}
},
"node_modules/globalthis": { "node_modules/globalthis": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz",
@ -1502,6 +1525,12 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@ -1858,9 +1887,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "5.7.1", "version": "5.7.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
"dev": true, "dev": true,
"bin": { "bin": {
"semver": "bin/semver" "semver": "bin/semver"
@ -2667,6 +2696,12 @@
"integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==",
"dev": true "dev": true
}, },
"@types/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
"dev": true
},
"@types/web-bluetooth": { "@types/web-bluetooth": {
"version": "0.0.17", "version": "0.0.17",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz", "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz",
@ -3228,6 +3263,17 @@
"get-intrinsic": "^1.1.1" "get-intrinsic": "^1.1.1"
} }
}, },
"git-describe": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/git-describe/-/git-describe-4.1.1.tgz",
"integrity": "sha512-JC8ganO5kO80G8+XE98TDDjnMXQN3Estk3qdJuG2EGRF/l6zuMTMcN+8OSfQZ5FWpqIRLB015anWX4aSRgnxAQ==",
"dev": true,
"requires": {
"@types/semver": "^7.3.8",
"lodash": "^4.17.21",
"semver": "^5.6.0"
}
},
"globalthis": { "globalthis": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz",
@ -3502,6 +3548,12 @@
"strip-bom": "^3.0.0" "strip-bom": "^3.0.0"
} }
}, },
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"lru-cache": { "lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@ -3751,9 +3803,9 @@
} }
}, },
"semver": { "semver": {
"version": "5.7.1", "version": "5.7.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
"dev": true "dev": true
}, },
"shebang-command": { "shebang-command": {

View File

@ -6,8 +6,8 @@
"bugs": "https://github.com/defnull/fediwall/issues", "bugs": "https://github.com/defnull/fediwall/issues",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"author": { "author": {
"name" : "Marcel Hellkamp", "name": "Marcel Hellkamp",
"url" : "https://defnull.de/" "url": "https://defnull.de/"
}, },
"private": true, "private": true,
"scripts": { "scripts": {
@ -29,6 +29,7 @@
"@types/node": "^18.16.17", "@types/node": "^18.16.17",
"@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue": "^4.2.3",
"@vue/tsconfig": "^0.4.0", "@vue/tsconfig": "^0.4.0",
"git-describe": "^4.1.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"typescript": "~5.0.4", "typescript": "~5.0.4",
"vite": "^4.3.9", "vite": "^4.3.9",

View File

@ -5,6 +5,7 @@ import { useDocumentVisibility, useWindowSize, watchDebounced } from '@vueuse/co
import ConfigModal from './components/ConfigModal.vue'; import ConfigModal from './components/ConfigModal.vue';
import { loadConfig, type Config } from './config'; import { loadConfig, type Config } from './config';
import InfoBar from './components/InfoBar.vue'; import InfoBar from './components/InfoBar.vue';
import { gitVersion } from '@/defaults'
const config = ref<Config>(); const config = ref<Config>();
@ -418,9 +419,10 @@ const privacyLink = computed(() => {
}} mode]</button> }} mode]</button>
<button class="btn btn-link text-muted" data-bs-toggle="modal" data-bs-target="#configModal">[Customize]</button> <button class="btn btn-link text-muted" data-bs-toggle="modal" data-bs-target="#configModal">[Customize]</button>
<div> <div>
<a :href="privacyLink" target="_blank" class="mx-1">Privacy policy</a> <a href="https://github.com/defnull/fediwall" target="_blank" class="mx-1 text-muted">Fediwall <span v-if="gitVersion">{{ gitVersion }}</span></a>
- <a href="https://github.com/defnull/fediwall" target="_blank" class="mx-1">Github</a> - <a href="https://github.com/defnull/fediwall" target="_blank" class="mx-1">Github</a>
- <a href="https://github.com/defnull/fediwall#readme" target="_blank" class="mx-1">Documentation</a> - <a href="https://github.com/defnull/fediwall#readme" target="_blank" class="mx-1">Documentation</a>
- <a :href="privacyLink" target="_blank" class="mx-1">Privacy policy</a>
</div> </div>
</footer> </footer>
</div> </div>

View File

@ -15,3 +15,5 @@ export const fallbackConfig: Config = {
// URL for a site-config file that overrides the default configuration above, if present. // URL for a site-config file that overrides the default configuration above, if present.
export const siteConfigUrl = "wall-config.json" export const siteConfigUrl = "wall-config.json"
export const gitVersion = __VERSION__ || undefined;

View File

@ -3,10 +3,23 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import viteCompression from 'vite-plugin-compression'; import viteCompression from 'vite-plugin-compression';
import { gitDescribeSync } from 'git-describe';
var version;
try {
var gitInfo = gitDescribeSync();
version = `${gitInfo.tag}`;
if (gitInfo.distance)
version += `-${gitInfo.distance}+${gitInfo.hash}`
} catch { }
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
base: "./", base: "./",
define: {
__VERSION__: JSON.stringify(version)
},
plugins: [ plugins: [
vue(), viteCompression() vue(), viteCompression()
], ],