mirror of
https://github.com/CompassConnections/Compass.git
synced 2025-12-23 22:18:43 -05:00
Show build info
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { APIHandler } from './helpers/endpoint'
|
||||
import {git} from './../metadata.json'
|
||||
import {version as pkgVersion} from './../package.json'
|
||||
|
||||
export const health: APIHandler<'health'> = async (_, auth) => {
|
||||
return {
|
||||
message: 'Server is working.',
|
||||
uid: auth?.uid,
|
||||
git: git,
|
||||
version: pkgVersion,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,12 @@ export const API = (_apiTypeCheck = {
|
||||
authed: false,
|
||||
rateLimited: false,
|
||||
props: z.object({}),
|
||||
returns: {} as { message: 'Server is working.'; uid?: string },
|
||||
returns: {} as {
|
||||
message: 'Server is working.'
|
||||
uid?: string
|
||||
version?: string
|
||||
git?: { revision?: string; commitDate?: string; author?: string }
|
||||
},
|
||||
summary: 'Check whether the API server is running',
|
||||
tag: 'General',
|
||||
},
|
||||
|
||||
39
web/components/about-settings.tsx
Normal file
39
web/components/about-settings.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import {WithPrivateUser} from "web/components/user/with-user";
|
||||
import {PrivateUser} from "common/user";
|
||||
import {Col} from "web/components/layout/col";
|
||||
import {IS_VERCEL} from "common/hosting/constants";
|
||||
import Link from "next/link";
|
||||
|
||||
export const AboutSettings = () => (
|
||||
<WithPrivateUser>
|
||||
{user => <LoadedAboutSettings privateUser={user}/>}
|
||||
</WithPrivateUser>
|
||||
)
|
||||
|
||||
const LoadedAboutSettings = (props: {
|
||||
privateUser: PrivateUser,
|
||||
}) => {
|
||||
const {privateUser} = props
|
||||
|
||||
return <Col>
|
||||
<WebBuildInfo/>
|
||||
</Col>
|
||||
}
|
||||
|
||||
const WebBuildInfo = () => {
|
||||
if (!IS_VERCEL) return
|
||||
const env = process.env.NEXT_PUBLIC_VERCEL_ENV
|
||||
const msg = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE
|
||||
const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER
|
||||
const repo = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG
|
||||
const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA
|
||||
const deploymentId = process.env.NEXT_PUBLIC_VERCEL_DEPLOYMENT_ID
|
||||
const url = `https://github.com/${owner}/${repo}/commit/${sha}`
|
||||
return <Col>
|
||||
<h3>Web build (Vercel)</h3>
|
||||
<p>Commit SHA: <Link href={url}>{sha}</Link></p>
|
||||
<p>Commit message: {msg}</p>
|
||||
<p>Vercel deployment ID: {deploymentId}</p>
|
||||
<p>Environment: {env}</p>
|
||||
</Col>
|
||||
}
|
||||
@@ -23,6 +23,9 @@ module.exports = {
|
||||
experimental: {
|
||||
scrollRestoration: true,
|
||||
},
|
||||
env: {
|
||||
NEXT_PUBLIC_VERCEL_DEPLOYMENT_ID: process.env.VERCEL_DEPLOYMENT_ID,
|
||||
},
|
||||
// Remove once confirmed that posthog.init works without it
|
||||
// rewrites: async () => {
|
||||
// if (isAppBuild) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import {App} from '@capacitor/app'
|
||||
import {useRouter} from "next/navigation"
|
||||
import {Keyboard} from "@capacitor/keyboard"
|
||||
import {LiveUpdate} from "@capawesome/capacitor-live-update"
|
||||
import {IS_VERCEL} from "common/hosting/constants"
|
||||
|
||||
if (Capacitor.isNativePlatform()) {
|
||||
// Only runs on iOS/Android native
|
||||
@@ -70,8 +71,7 @@ const logoFont = Major_Mono_Display({
|
||||
// })
|
||||
|
||||
function printBuildInfo() {
|
||||
// These are undefined if e.g. dev server
|
||||
if (process.env.NEXT_PUBLIC_VERCEL_ENV) {
|
||||
if (IS_VERCEL) {
|
||||
const env = process.env.NEXT_PUBLIC_VERCEL_ENV
|
||||
const msg = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE
|
||||
const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER
|
||||
|
||||
@@ -18,6 +18,7 @@ import {NotificationSettings} from "web/components/notifications";
|
||||
import ThemeIcon from "web/components/theme-icon";
|
||||
import {WithPrivateUser} from "web/components/user/with-user";
|
||||
import {sendPasswordReset} from "web/lib/firebase/password";
|
||||
import {AboutSettings} from "web/components/about-settings";
|
||||
|
||||
export default function NotificationsPage() {
|
||||
useRedirectIfSignedOut()
|
||||
@@ -30,6 +31,7 @@ export default function NotificationsPage() {
|
||||
tabs={[
|
||||
{title: 'General', content: <GeneralSettings/>},
|
||||
{title: 'Notifications', content: <NotificationSettings/>},
|
||||
{title: 'About', content: <AboutSettings/>},
|
||||
]}
|
||||
trackingName={'settings page'}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user