unoffical wafrn mirror wafrn.net
atproto social-network activitypub
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'Add commit hashes to UI and also cache bust translations' (#253) from FireIsGood/wafrn2:add-commit-hash into development

Reviewed-on: https://codeberg.org/wafrn/wafrn/pulls/253

gabboman 2c1d9af6 b8724ed5

+67 -10
+7 -6
package.json
··· 11 11 "backend:worker": "cd packages/backend && tsx utils/workers.ts", 12 12 "backend:serve": "cd packages/backend && tsx index.ts", 13 13 "backend:cohostImport": "cd packages/backend && tsx utils/maintenanceTasks/importcohost.ts", 14 - "frontend:serve": "cd packages/frontend && ng serve", 15 - "frontend:develop": "cd packages/frontend && ng serve --configuration development", 16 - "frontend:develop:prod": "cd packages/frontend && ng serve --configuration devprod", 17 - "frontend:develop:development": "cd packages/frontend && ng serve --configuration devdevelopment", 18 - "frontend:build": "cd packages/frontend && ng build", 19 - "frontend:deploy": "cd packages/frontend && ng build && rm -rf ../../frontend && mv dist/wafrn/browser ../../frontend", 14 + "frontend:serve": "npm run prebuild && cd packages/frontend && ng serve", 15 + "frontend:develop": "npm run prebuild && cd packages/frontend && ng serve --configuration development", 16 + "frontend:develop:prod": "npm run prebuild && cd packages/frontend && ng serve --configuration devprod", 17 + "frontend:develop:development": "npm run prebuild && cd packages/frontend && ng serve --configuration devdevelopment", 18 + "frontend:build": "npm run prebuild && cd packages/frontend && ng build", 19 + "frontend:deploy": "npm run prebuild && cd packages/frontend && ng build && rm -rf ../../frontend && mv dist/wafrn/browser ../../frontend", 20 20 "frontend:test": "cd packages/frontend && jest", 21 21 "frontend:translations:patch": "cd packages/frontend && tsx utils/patch-translations.ts", 22 22 "frontend:translations:format": "cd packages/frontend && prettier src/assets/i18n/*.json --write", 23 + "prebuild": "cd packages/frontend && tsx utils/prebuild.ts", 23 24 "vercel-build": "cd packages/frontend && ng build --configuration=vercel", 24 25 "lint": "cd packages/frontend && ng lint --fix" 25 26 },
+1
packages/frontend/.gitignore
··· 46 46 yarn-error.log 47 47 testem.log 48 48 /typings 49 + buildData.json 49 50 50 51 # System Files 51 52 .DS_Store
+2 -1
packages/frontend/src/app/app.module.ts
··· 16 16 import { HttpClient } from '@angular/common/http' 17 17 import { ThemeManagerComponent } from './theme-manager/theme-manager.component' 18 18 import { HotkeyManagerComponent } from './components/hotkey-manager/hotkey-manager.component' 19 + import buildData from '../buildData.json' 19 20 20 21 const globalRippleConfig: RippleGlobalOptions = { 21 22 disabled: true, ··· 63 64 export class AppModule {} 64 65 65 66 export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { 66 - return new TranslateHttpLoader(http, '/assets/i18n/', '.json') 67 + return new TranslateHttpLoader(http, '/assets/i18n/', `.json?v=${buildData.git.fullHash}`) 67 68 }
+18 -1
packages/frontend/src/app/components/navigation-menu/navigation-menu.component.html
··· 64 64 <hr /> 65 65 <div class="footer-stack"> 66 66 <app-color-scheme-switcher></app-color-scheme-switcher> 67 - <div class="text-sm version-text">v{{ frontendVersion }}</div> 67 + <div class="text-xs flex flex-column gap-1 align-items-end version-text"> 68 + @if (!buildData.version.endsWith('-DEV')) { 69 + <a 70 + class="subtle-link" 71 + [href]="'https://codeberg.org/wafrn/wafrn/releases/tag/' + buildData.version" 72 + target="_blank" 73 + >v{{ buildData.version }}</a 74 + > 75 + } @else { 76 + <span>v{{ buildData.version }}</span> 77 + } 78 + <a 79 + class="subtle-link" 80 + [href]="'https://codeberg.org/wafrn/wafrn/commit/' + buildData.git.fullHash" 81 + target="_blank" 82 + >{{ 'common.commit' | translate }} {{ buildData.git.hash }}</a 83 + > 84 + </div> 68 85 </div> 69 86 </div> 70 87 </mat-drawer>
+1
packages/frontend/src/app/components/navigation-menu/navigation-menu.component.scss
··· 66 66 67 67 .version-text { 68 68 color: var(--mat-sys-outline); 69 + line-height: 1.15; 69 70 text-align: center; 70 71 } 71 72
+2 -1
packages/frontend/src/app/components/navigation-menu/navigation-menu.component.ts
··· 62 62 import packageJson from '../../../../package.json' 63 63 import { BlogDetails } from 'src/app/interfaces/blogDetails' 64 64 import { GlobalData } from 'src/app/services/global-data.service' 65 + import buildData from '../../../buildData.json' 65 66 66 67 @Component({ 67 68 selector: 'app-navigation-menu', ··· 162 163 horizontalMenuMode: Signal<boolean> 163 164 offsetTopArea: Signal<boolean> 164 165 165 - frontendVersion = packageJson.version 166 + buildData = buildData 166 167 167 168 constructor( 168 169 globalData: GlobalData,
+2 -1
packages/frontend/src/assets/i18n/en.json
··· 2 2 "common": { 3 3 "commaSeparation": "Separated with commas", 4 4 "characters": "characters", 5 - "default": "Default" 5 + "default": "Default", 6 + "commit": "commit" 6 7 }, 7 8 "login": { 8 9 "title": "Log in",
+34
packages/frontend/utils/prebuild.ts
··· 1 + import fs from 'fs' 2 + import path from 'path' 3 + import child_process from 'child_process' 4 + import packageJson from '../../../package.json' 5 + 6 + function execSyncSafe(command: string) { 7 + let out = null 8 + try { 9 + out = child_process.execSync(command).toString().trim() 10 + } catch (error) { 11 + console.error(error) 12 + } 13 + return out 14 + } 15 + 16 + const isScript = require.main === module 17 + if (isScript) main() 18 + 19 + function main(): void { 20 + // Load build data (git and stuff) 21 + const buildData = { 22 + version: packageJson.version, 23 + git: { 24 + branch: execSyncSafe('git rev-parse --abbrev-ref HEAD'), 25 + hash: execSyncSafe('git rev-parse --short=7 HEAD'), 26 + fullHash: execSyncSafe('git rev-parse HEAD') 27 + } 28 + } 29 + 30 + const filePath = path.resolve('src', 'buildData.json') 31 + const fileContents = JSON.stringify(buildData) 32 + 33 + fs.writeFileSync(filePath, fileContents) 34 + }