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
43 changes: 24 additions & 19 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
docs: ${{ steps.filter.outputs.docs }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: ⎔ Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v7
with:
node-version: 20
node-version: 24

- name: 💾 Cache Node Modules
id: node-cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: node_modules
key:
Expand All @@ -37,7 +37,7 @@ jobs:
run: npm install

- name: 🧭 Find Changes
uses: dorny/paths-filter@v3
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
Expand Down Expand Up @@ -69,16 +69,16 @@ jobs:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: ⎔ Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v7
with:
node-version: 20
node-version: 24

- name: 💾 Cache Node Modules
id: node-cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: node_modules
key:
Expand All @@ -98,24 +98,29 @@ jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ts
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
DATABASE_URL: file:./prisma/data/db.db
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: ⎔ Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v7
with:
node-version: 20
node-version: 24

- name: 💾 Cache Node Modules
id: node-cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: node_modules
key:
node-modules-${{ hashFiles('package-lock.json',
'prisma/schema.prisma') }}

- name: 📊 Generate Prisma
run: npx prisma generate

- name: 🔎 Type check
run: npm run typecheck

Expand All @@ -131,16 +136,16 @@ jobs:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: ⎔ Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v7
with:
node-version: 20
node-version: 24

- name: 💾 Cache Node Modules
id: node-cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: node_modules
key:
Expand All @@ -162,7 +167,7 @@ jobs:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: ☁️ Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -174,7 +179,7 @@ jobs:

# Setup cache
- name: ⚡️ Cache Docker layers
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ prisma/*.db
prisma/*.db-journal
prisma/**/*.db
prisma/**/*.db-journal
prisma/generated


public/sounds
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ RUN npm prune --production
FROM base AS build

ENV NODE_ENV=production
ENV DATABASE_URL=file:./prisma/data/db.db

RUN mkdir /app
WORKDIR /app

COPY --from=deps /app/node_modules /app/node_modules

ADD . .
RUN npx prisma generate
RUN npm run build

# Go back to the `base` image and copy in the production deps and build
Expand Down
2 changes: 1 addition & 1 deletion app/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const VERSION = '1.7.1'
export const VERSION = '2.0.0'

export const RequiredVersions = {
controller: VERSION,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/i18n.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
locales,
type SupportedLocale,
FALLBACK_LOCALE,
MessageKey
type MessageKey
} from '~/locales'
import {type Messages} from './i18n.shared'

Expand Down
9 changes: 7 additions & 2 deletions app/lib/prisma.server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import {PrismaClient} from '@prisma/client'
import {PrismaBetterSqlite3} from '@prisma/adapter-better-sqlite3'
import {PrismaClient} from '../../prisma/generated/prisma/client'

declare global {
// This prevents us from making multiple connections to the db when the
// require cache is cleared.
var __prisma: PrismaClient | undefined
}

const prisma = global.__prisma ?? (global.__prisma = new PrismaClient())
const connectionString = `${process.env.DATABASE_URL}`
const adapter = new PrismaBetterSqlite3({url: connectionString})

const prisma =
global.__prisma ?? (global.__prisma = new PrismaClient({adapter}))

export const getPrisma = () => prisma
8 changes: 4 additions & 4 deletions app/lib/sequence-builder.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useState, useEffect} from 'react'
import {type Audio} from '@prisma/client'
import {useState} from 'react'
import {type AudioModel} from '../../prisma/generated/prisma/models'

import CopyIcon from '@heroicons/react/24/outline/DocumentDuplicateIcon'
import PasteIcon from '@heroicons/react/24/outline/ClipboardDocumentIcon'
Expand All @@ -15,7 +15,7 @@ export const SequenceBuilder = ({
label,
helperText
}: {
sounds: Audio[]
sounds: AudioModel[]
initialQueue: string[]
name: string
label: string
Expand Down Expand Up @@ -137,7 +137,7 @@ export const SequenceViewer = ({
label
}: {
queue: string[]
sounds: Audio[]
sounds: AudioModel[]
label: string
}) => {
const {t} = useTranslation()
Expand Down
4 changes: 2 additions & 2 deletions app/lib/trigger-action.server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {type Action} from '@prisma/client'
import {type ActionModel} from '../../prisma/generated/prisma/models'

import {broadcast} from './broadcast.server'
import {toggleLockdown} from './lockdown.server'
import {log} from './log.server'

export const triggerAction = async (
action: Action,
action: ActionModel,
zone: string | null | undefined,
source: string,
callbacks: {onMissingZone: (suppliedZone: string | null | undefined) => void}
Expand Down
6 changes: 1 addition & 5 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import {
useLoaderData,
useRouteLoaderData
} from '@remix-run/react'
import {
json,
type LinksFunction,
type LoaderFunctionArgs
} from '@remix-run/node'
import {type LinksFunction, type LoaderFunctionArgs} from '@remix-run/node'
import BellIcon from '@heroicons/react/24/outline/BellIcon'
import BellAlertIcon from '@heroicons/react/24/outline/BellAlertIcon'
import Square3StackIcon from '@heroicons/react/24/outline/Square3Stack3DIcon'
Expand Down
2 changes: 1 addition & 1 deletion app/routes/actions.$action._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
type MetaFunction,
redirect
} from '@remix-run/node'
import {useLoaderData, Link, useNavigate} from '@remix-run/react'
import {useLoaderData, useNavigate} from '@remix-run/react'

import {getPrisma} from '~/lib/prisma.server'
import {checkSession} from '~/lib/session'
Expand Down
3 changes: 1 addition & 2 deletions app/routes/actions.add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
type LoaderFunctionArgs,
type MetaFunction
} from '@remix-run/node'
import {useLoaderData, useNavigate} from '@remix-run/react'
import {useNavigate} from '@remix-run/react'
import {invariant} from '@arcath/utils'

import {getPrisma} from '~/lib/prisma.server'
Expand Down Expand Up @@ -71,7 +71,6 @@ export const action = async ({request}: ActionFunctionArgs) => {
}

const AddAction = () => {
const {sounds} = useLoaderData<typeof loader>()
const navigate = useNavigate()
const {t} = useTranslation()

Expand Down
2 changes: 1 addition & 1 deletion app/routes/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {getPrisma} from '~/lib/prisma.server'
import {useTranslation} from '~/lib/i18n'
import {translate} from '~/lib/i18n.shared'
import {getRootI18n} from '~/lib/i18n.meta'
import {MessageKey} from '~/locales'
import {type MessageKey} from '~/locales'

export const meta: MetaFunction = ({matches}) => {
const {messages} = getRootI18n(matches)
Expand Down
2 changes: 1 addition & 1 deletion app/routes/control-point.trigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const action = async ({request}: ActionFunctionArgs) => {
}

await triggerAction(action, data.zone, 'Control Point', {
onMissingZone: zone => {
onMissingZone: () => {
response = {result: 'error', message: 'Zone does not exist'}
}
})
Expand Down
2 changes: 1 addition & 1 deletion app/routes/hook.$hook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const action = async ({request, params}: ActionFunctionArgs) => {
let response = {status: 'ok'}

await triggerAction(webhook.action, zone, `Webhook: ${params.hook}`, {
onMissingZone: zone => {
onMissingZone: () => {
response = {status: 'zone not found'}
}
})
Expand Down
6 changes: 2 additions & 4 deletions app/routes/lockdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ export const action = async ({request}: ActionFunctionArgs) => {

const lockdownRepeat = formData.get('lockdownRepeat') as string | undefined
const lockdownEntrySequence = formData.get('lockdownEntrySequence') as
| string
| undefined
string | undefined
const lockdownExitSequence = formData.get('lockdownExitSequence') as
| string
| undefined
string | undefined
const lockdownRepeatRingerWire = !!(formData.get(
'lockdownRepeatRingerWire'
) as string | undefined)
Expand Down
2 changes: 1 addition & 1 deletion app/routes/log.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {getPrisma} from '~/lib/prisma.server'
import {useTranslation} from '~/lib/i18n'
import {translate} from '~/lib/i18n.shared'
import {getRootI18n} from '~/lib/i18n.meta'
import {MessageKey} from '~/locales'
import {type MessageKey} from '~/locales'
import {useLivePageData} from '~/lib/hooks/use-live-data'

export const meta: MetaFunction = ({matches}) => {
Expand Down
2 changes: 0 additions & 2 deletions app/routes/schedule.add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ const AddSchedule = () => {
const navigate = useNavigate()
const [day, setDay] = useLocalStorage<string>('day', '_')
const [zone, setZone] = useLocalStorage<string>('zone', zones[0].id)
const [sound, setSound] = useLocalStorage<string>('sound', sounds[0].id)
const [count, setCount] = useLocalStorage<string>('count', '1')
const {t} = useTranslation()

return (
Expand Down
14 changes: 8 additions & 6 deletions app/routes/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
type MetaFunction,
redirect
} from '@remix-run/node'
import {Form, useLoaderData} from '@remix-run/react'
import {useLoaderData} from '@remix-run/react'
import {invariant} from '@arcath/utils'

import {getSettings, setSetting} from '~/lib/settings.server'
Expand Down Expand Up @@ -67,13 +67,11 @@ export const action = async ({request}: ActionFunctionArgs) => {
const password = formData.get('password') as string | undefined
const checkPassword = formData.get('confirmPassword') as string | undefined
const controlPointKey = (formData.get('controlPointKey') as
| string
| undefined)
string | undefined)
? (formData.get('controlPointKey') as string | undefined)
: ''
const controlPointDefaultZone = formData.get('controlPointDefaultZone') as
| string
| undefined
string | undefined
const siteName = formData.get('siteName') as string | undefined

invariant(enrollUrl)
Expand Down Expand Up @@ -163,7 +161,11 @@ const Settings = () => {
defaultValue={controlPointDefaultZone}
>
{zones.map(({id, name}) => {
return <option value={id}>{name}</option>
return (
<option value={id} key={id}>
{name}
</option>
)
})}
</select>
</FormElement>
Expand Down
1 change: 0 additions & 1 deletion app/routes/sounder-api.get-day.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {type ActionFunctionArgs} from '@remix-run/node'
import {invariant} from '@arcath/utils'

import {getPrisma} from '~/lib/prisma.server'

Expand Down
2 changes: 1 addition & 1 deletion app/routes/sounder-api.trigger-action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const action = async ({request}: ActionFunctionArgs) => {
let status = 200

await triggerAction(dbAction, zone, `Sounder: ${sounder.name}`, {
onMissingZone: zone => {
onMissingZone: () => {
response = {result: 'error', error: 'Zone not found.'}
status = 400
}
Expand Down
2 changes: 0 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ if [ "$1" = 'osb-remix' ]; then

npm run start
elif [ "$1" = 'osb-worker' ]; then
npx prisma generate

npm run start:worker
fi
5 changes: 3 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const config = [
'**/server-build/**',
'**/dist/**',
'**/coverage/**',
'.test.env'
'.test.env',
'**/generated/prisma/**'
]
},

Expand Down Expand Up @@ -277,4 +278,4 @@ export const config = [
].filter(Boolean)

// this is for backward compatibility
export default config
export default config
Loading
Loading