Skip to content

Commit 52d828a

Browse files
committed
feat: add license to about page
1 parent 2a7a70e commit 52d828a

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

app/routes/about.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import {
66
import {useLoaderData} from '@remix-run/react'
77
import {asyncForEach} from '@arcath/utils'
88
import semver from 'semver'
9+
import fs from 'fs'
10+
import path from 'path'
11+
import {nl2br} from '@arcath/utils'
912

1013
import {pageTitle} from '~/lib/utils'
1114
import {Page} from '~/lib/ui'
@@ -14,6 +17,8 @@ import {getRedis} from '~/lib/redis.server.mjs'
1417
import {getPrisma} from '~/lib/prisma.server'
1518
import {checkSession} from '~/lib/session'
1619

20+
const {readFile} = fs.promises
21+
1722
export const loader = async ({request}: LoaderFunctionArgs) => {
1823
const result = await checkSession(request)
1924

@@ -108,13 +113,18 @@ export const loader = async ({request}: LoaderFunctionArgs) => {
108113
sounderVersions[id] = version ? version : '0.0.0'
109114
})
110115

116+
const license = (
117+
await readFile(path.join(process.cwd(), 'LICENSE'))
118+
).toString()
119+
111120
return {
112121
piperData,
113122
sounders,
114123
sounderVersions,
115124
sounderLatest,
116125
ttsLatest,
117-
controllerLatest
126+
controllerLatest,
127+
license
118128
}
119129
}
120130

@@ -129,7 +139,8 @@ const About = () => {
129139
sounderVersions,
130140
sounderLatest,
131141
ttsLatest,
132-
controllerLatest
142+
controllerLatest,
143+
license
133144
} = useLoaderData<typeof loader>()
134145

135146
return (
@@ -202,6 +213,11 @@ const About = () => {
202213
})}
203214
</tbody>
204215
</table>
216+
217+
<div
218+
className="box text-gray-600"
219+
dangerouslySetInnerHTML={{__html: nl2br(license)}}
220+
/>
205221
</Page>
206222
)
207223
}

0 commit comments

Comments
 (0)