@alstar/studio 0.0.0-beta.12 → 0.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/auth.ts +11 -14
- package/components/settings/Backup.ts +7 -3
- package/package.json +2 -2
- package/pages/register.ts +3 -2
package/api/auth.ts
CHANGED
|
@@ -9,24 +9,21 @@ import { setCookie } from 'hono/cookie'
|
|
|
9
9
|
const app = new Hono<{ Bindings: HttpBindings }>()
|
|
10
10
|
|
|
11
11
|
app.post('/register', async (c) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const data = Object.fromEntries(formData.entries())
|
|
15
|
-
|
|
16
|
-
if (!data || !data.email || !data.password) return
|
|
12
|
+
const formData = await c.req.formData()
|
|
13
|
+
const data = Object.fromEntries(formData.entries())
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
if (!data || !data.email || !data.password) return
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
email: data.email?.toString(),
|
|
22
|
-
hash: hash,
|
|
23
|
-
})
|
|
17
|
+
const hash = createHash(data.password.toString())
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
19
|
+
db.insertInto('users', {
|
|
20
|
+
email: data.email?.toString(),
|
|
21
|
+
hash: hash,
|
|
29
22
|
})
|
|
23
|
+
|
|
24
|
+
setCookie(c, 'login', 'yes')
|
|
25
|
+
|
|
26
|
+
return c.redirect('/studio')
|
|
30
27
|
})
|
|
31
28
|
|
|
32
29
|
app.post('/login', async (c) => {
|
|
@@ -3,8 +3,12 @@ import { html } from 'hono/html'
|
|
|
3
3
|
import * as icons from '../icons.ts'
|
|
4
4
|
|
|
5
5
|
export default async () => {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let backups: string[] = []
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
const backupDir = './backups'
|
|
10
|
+
backups = await fsp.readdir(backupDir)
|
|
11
|
+
} catch (error) {}
|
|
8
12
|
|
|
9
13
|
return html`
|
|
10
14
|
<article data-signals="{ status: null, message: '' }">
|
|
@@ -65,7 +69,7 @@ export default async () => {
|
|
|
65
69
|
<button type="submit">Backup database</button>
|
|
66
70
|
</form>
|
|
67
71
|
|
|
68
|
-
<hr
|
|
72
|
+
<hr />
|
|
69
73
|
|
|
70
74
|
<form
|
|
71
75
|
data-on-submit="@post('/studio/api/backup', { contentType: 'form' })"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alstar/studio",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"engines": {
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@hono/node-server": "^1.18.1",
|
|
11
11
|
"@starfederation/datastar-sdk": "1.0.0-RC.1",
|
|
12
12
|
"hono": "^4.8.12",
|
|
13
|
-
"@alstar/db": "0.0.0-beta.1",
|
|
14
13
|
"@alstar/refresher": "0.0.0-beta.3",
|
|
14
|
+
"@alstar/db": "0.0.0-beta.1",
|
|
15
15
|
"@alstar/ui": "0.0.0-beta.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
package/pages/register.ts
CHANGED
|
@@ -5,7 +5,7 @@ import SiteLayout from '../components/SiteLayout.ts'
|
|
|
5
5
|
export default defineEntry((c) => {
|
|
6
6
|
return SiteLayout(
|
|
7
7
|
html`
|
|
8
|
-
<div class="register-form" style="width: 300px">
|
|
8
|
+
<div class="register-form" style="width: 300px; margin: auto;">
|
|
9
9
|
<article>
|
|
10
10
|
<header>Register user</header>
|
|
11
11
|
<form
|
|
@@ -14,13 +14,14 @@ export default defineEntry((c) => {
|
|
|
14
14
|
data-on-signal-patch="patch.status === 200 && window.location.reload()"
|
|
15
15
|
>
|
|
16
16
|
<label for="email">Email</label>
|
|
17
|
-
<input id="email" name="email" type="text" placeholder="Email" />
|
|
17
|
+
<input id="email" name="email" type="text" placeholder="Email" style="width: 100%" />
|
|
18
18
|
<label for="password">Password</label>
|
|
19
19
|
<input
|
|
20
20
|
id="password"
|
|
21
21
|
name="password"
|
|
22
22
|
type="password"
|
|
23
23
|
placeholder="Password"
|
|
24
|
+
style="width: 100%"
|
|
24
25
|
/>
|
|
25
26
|
<br />
|
|
26
27
|
<button style="width: 100%;">Register</button>
|