Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_CI=$CI
VITE_COMMIT_REF=${COMMIT_REF:-dev}
VITE_BRANCH=${BRANCH:-beta}
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
browser: true
es2021: true
globals:
process: readonly
VITE_ENV: readonly
parserOptions:
ecmaFeatures:
jsx: true
Expand Down
2 changes: 1 addition & 1 deletion app/SwUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function unregister(){
}

export function register(config){
if (process.env.NODE_ENV === 'production' && process.env.BRANCH !== 'beta' && 'serviceWorker' in navigator){
if (import.meta.env.PROD && import.meta.env.VITE_BRANCH !== 'beta' && 'serviceWorker' in navigator){
const swUrl = '/service-worker.js';
return window.location.hostname === 'localhost' ? checkValidServiceWorker(swUrl, config) : registerValidSW(swUrl, config);
}
Expand Down
2 changes: 1 addition & 1 deletion app/components/AppDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function AppDrawer({ isDesktop, setOpen, open, subNav }){
)}
<div style={{ flexGrow: 1 }}/>
<Typography variant="caption" color="text.secondary" textAlign="center" mb={1}>
KittenLocks v{process.env.VERSION} (<Link href={`https://github.com/KittenApps/KittenLocks/commit/${process.env.COMMIT_REF}`} target="_blank" rel="noreferrer">{process.env.COMMIT_REF.slice(0, 7)}</Link>)
KittenLocks v{VITE_ENV.VERSION} (<Link href={`https://github.com/KittenApps/KittenLocks/commit/${import.meta.env.VITE_COMMIT_REF}`} target="_blank" rel="noreferrer">{import.meta.env.VITE_COMMIT_REF.slice(0, 7)}</Link>)
</Typography>
</ResponsiveDrawer>
);
Expand Down
4 changes: 2 additions & 2 deletions app/components/AppHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function AppHeader({ isDesktop, setOpen, showLogin, open }){
useEffect(() => {
if ('serviceWorker' in navigator){
const onMessage = event => event.data && event.data.type === 'CLIENT_RELOAD' && window.location.reload();
if (noOffline || process.env.BRANCH === 'beta' || process.env.NODE_ENV !== 'production'){
if (noOffline || import.meta.env.VITE_BRANCH === 'beta' || import.meta.env.DEV){
unregister();
if (navigator.serviceWorker) navigator.serviceWorker.removeEventListener('message', onMessage);
} else register({
Expand Down Expand Up @@ -148,7 +148,7 @@ function AppHeader({ isDesktop, setOpen, showLogin, open }){
{ app.currentUser && <MenuItem onClick={handleProfileMenuLogout}><ListItemIcon><Logout/></ListItemIcon>Log out</MenuItem> }
<Divider style={{ marginBottom: 0 }}/>
<ListSubheader sx={{ textAlign: 'center', lineHeight: '32px' }}>Advanced Settings:</ListSubheader>
{ process.env.BRANCH !== 'beta' && process.env.NODE_ENV === 'production' && (
{ import.meta.env.VITE_BRANCH !== 'beta' && import.meta.env.PROD && (
<MenuItem dense onClick={handleToggleOffline}>
<ListItemIcon><Checkbox sx={{ p: 0 }} disabled={!('serviceWorker' in navigator)} checked={!noOffline} icon={<BookmarkBorder/>} checkedIcon={<Bookmark/>}/></ListItemIcon>
{noOffline ? 'enable offline PWA' : 'remove PWA cache'}
Expand Down
13 changes: 4 additions & 9 deletions app/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ if (!Array.prototype.at) Object.defineProperty(Array.prototype, 'at', {
}
});

if (process.env.CI) initSentry({
dsn: process.env.SENTRY,
release: `kittenlocks@${process.env.VERSION}+${process.env.COMMIT_REF}`,
if (import.meta.env.VITE_CI) initSentry({
dsn: import.meta.env.VITE_ENV.SENTRY,
release: `kittenlocks@${VITE_ENV.VERSION}+${import.meta.env.VITE_COMMIT_REF}`,
integrations: [
new BrowserTracing({
routingInstrumentation: reactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes)
Expand All @@ -42,12 +42,7 @@ if (process.env.CI) initSentry({
ignoreErrors: ['AbortError', 'ResizeObserver loop limit exceeded', 'ResizeObserver loop completed with undelivered notifications.']
});

const div = document.createElement('div');
div.id = 'container';
document.body.style.backgroundColor = '#272533';
document.body.append(div);

createRoot(div).render(
createRoot(document.querySelector('#root')).render(
<StrictMode>
<SentryErrorBoundary fallback={errorFallback} showDialog>
<RealmAppProvider>
Expand Down
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>KittenLocks</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/app/index.jsx"></script>
</body>
</html>
Loading