File tree Expand file tree Collapse file tree 6 files changed +54
-3
lines changed
Expand file tree Collapse file tree 6 files changed +54
-3
lines changed Original file line number Diff line number Diff line change 11import { APIHandler } from './helpers/endpoint'
22import { git } from './../metadata.json'
3+ import { version as pkgVersion } from './../package.json'
34
45export const health : APIHandler < 'health' > = async ( _ , auth ) => {
56 return {
67 message : 'Server is working.' ,
78 uid : auth ?. uid ,
89 git : git ,
10+ version : pkgVersion ,
911 }
1012}
Original file line number Diff line number Diff line change @@ -45,7 +45,12 @@ export const API = (_apiTypeCheck = {
4545 authed : false ,
4646 rateLimited : false ,
4747 props : z . object ( { } ) ,
48- returns : { } as { message : 'Server is working.' ; uid ?: string } ,
48+ returns : { } as {
49+ message : 'Server is working.'
50+ uid ?: string
51+ version ?: string
52+ git ?: { revision ?: string ; commitDate ?: string ; author ?: string }
53+ } ,
4954 summary : 'Check whether the API server is running' ,
5055 tag : 'General' ,
5156 } ,
Original file line number Diff line number Diff line change 1+ import { WithPrivateUser } from "web/components/user/with-user" ;
2+ import { PrivateUser } from "common/user" ;
3+ import { Col } from "web/components/layout/col" ;
4+ import { IS_VERCEL } from "common/hosting/constants" ;
5+ import Link from "next/link" ;
6+
7+ export const AboutSettings = ( ) => (
8+ < WithPrivateUser >
9+ { user => < LoadedAboutSettings privateUser = { user } /> }
10+ </ WithPrivateUser >
11+ )
12+
13+ const LoadedAboutSettings = ( props : {
14+ privateUser : PrivateUser ,
15+ } ) => {
16+ const { privateUser} = props
17+
18+ return < Col >
19+ < WebBuildInfo />
20+ </ Col >
21+ }
22+
23+ const WebBuildInfo = ( ) => {
24+ if ( ! IS_VERCEL ) return
25+ const env = process . env . NEXT_PUBLIC_VERCEL_ENV
26+ const msg = process . env . NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE
27+ const owner = process . env . NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER
28+ const repo = process . env . NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG
29+ const sha = process . env . NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA
30+ const deploymentId = process . env . NEXT_PUBLIC_VERCEL_DEPLOYMENT_ID
31+ const url = `https://github.com/${ owner } /${ repo } /commit/${ sha } `
32+ return < Col >
33+ < h3 > Web build (Vercel)</ h3 >
34+ < p > Commit SHA: < Link href = { url } > { sha } </ Link > </ p >
35+ < p > Commit message: { msg } </ p >
36+ < p > Vercel deployment ID: { deploymentId } </ p >
37+ < p > Environment: { env } </ p >
38+ </ Col >
39+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ module.exports = {
2323 experimental : {
2424 scrollRestoration : true ,
2525 } ,
26+ env : {
27+ NEXT_PUBLIC_VERCEL_DEPLOYMENT_ID : process . env . VERCEL_DEPLOYMENT_ID ,
28+ } ,
2629 // Remove once confirmed that posthog.init works without it
2730 // rewrites: async () => {
2831 // if (isAppBuild) {
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {App} from '@capacitor/app'
1919import { useRouter } from "next/navigation"
2020import { Keyboard } from "@capacitor/keyboard"
2121import { LiveUpdate } from "@capawesome/capacitor-live-update"
22+ import { IS_VERCEL } from "common/hosting/constants"
2223
2324if ( Capacitor . isNativePlatform ( ) ) {
2425 // Only runs on iOS/Android native
@@ -70,8 +71,7 @@ const logoFont = Major_Mono_Display({
7071// })
7172
7273function printBuildInfo ( ) {
73- // These are undefined if e.g. dev server
74- if ( process . env . NEXT_PUBLIC_VERCEL_ENV ) {
74+ if ( IS_VERCEL ) {
7575 const env = process . env . NEXT_PUBLIC_VERCEL_ENV
7676 const msg = process . env . NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE
7777 const owner = process . env . NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {NotificationSettings} from "web/components/notifications";
1818import ThemeIcon from "web/components/theme-icon" ;
1919import { WithPrivateUser } from "web/components/user/with-user" ;
2020import { sendPasswordReset } from "web/lib/firebase/password" ;
21+ import { AboutSettings } from "web/components/about-settings" ;
2122
2223export default function NotificationsPage ( ) {
2324 useRedirectIfSignedOut ( )
@@ -30,6 +31,7 @@ export default function NotificationsPage() {
3031 tabs = { [
3132 { title : 'General' , content : < GeneralSettings /> } ,
3233 { title : 'Notifications' , content : < NotificationSettings /> } ,
34+ { title : 'About' , content : < AboutSettings /> } ,
3335 ] }
3436 trackingName = { 'settings page' }
3537 />
You can’t perform that action at this time.
0 commit comments