@jant/core 0.2.12 → 0.2.13
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/bin/jant.js +3 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +112 -85
- package/dist/auth.d.ts +1 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +2 -1
- package/dist/client.js +1 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/i18n/context.d.ts.map +1 -1
- package/dist/i18n/context.js +0 -3
- package/dist/i18n/detect.d.ts +0 -11
- package/dist/i18n/detect.d.ts.map +1 -1
- package/dist/i18n/detect.js +1 -52
- package/dist/i18n/i18n.d.ts +4 -14
- package/dist/i18n/i18n.d.ts.map +1 -1
- package/dist/i18n/i18n.js +19 -25
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/middleware.d.ts +2 -5
- package/dist/i18n/middleware.d.ts.map +1 -1
- package/dist/i18n/middleware.js +12 -23
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/image.d.ts.map +1 -1
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/sse.d.ts +45 -17
- package/dist/lib/sse.d.ts.map +1 -1
- package/dist/lib/sse.js +77 -37
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/routes/api/posts.js +0 -1
- package/dist/routes/api/upload.js +3 -1
- package/dist/routes/dash/collections.d.ts.map +1 -1
- package/dist/routes/dash/collections.js +134 -142
- package/dist/routes/dash/index.js +25 -26
- package/dist/routes/dash/media.d.ts.map +1 -1
- package/dist/routes/dash/media.js +60 -56
- package/dist/routes/dash/pages.js +64 -66
- package/dist/routes/dash/posts.d.ts.map +1 -1
- package/dist/routes/dash/posts.js +50 -59
- package/dist/routes/dash/redirects.d.ts.map +1 -1
- package/dist/routes/dash/redirects.js +63 -60
- package/dist/routes/dash/settings.d.ts.map +1 -1
- package/dist/routes/dash/settings.js +249 -93
- package/dist/routes/feed/rss.js +6 -4
- package/dist/routes/pages/archive.js +60 -62
- package/dist/routes/pages/collection.js +8 -8
- package/dist/routes/pages/home.js +14 -14
- package/dist/routes/pages/page.js +7 -6
- package/dist/routes/pages/post.js +8 -8
- package/dist/routes/pages/search.js +25 -27
- package/dist/services/collection.d.ts.map +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/media.d.ts.map +1 -1
- package/dist/services/post.d.ts.map +1 -1
- package/dist/services/redirect.d.ts.map +1 -1
- package/dist/services/settings.d.ts.map +1 -1
- package/dist/theme/components/ActionButtons.d.ts +1 -1
- package/dist/theme/components/ActionButtons.d.ts.map +1 -1
- package/dist/theme/components/ActionButtons.js +17 -21
- package/dist/theme/components/CrudPageHeader.d.ts.map +1 -1
- package/dist/theme/components/DangerZone.d.ts.map +1 -1
- package/dist/theme/components/DangerZone.js +12 -15
- package/dist/theme/components/EmptyState.d.ts.map +1 -1
- package/dist/theme/components/PageForm.d.ts.map +1 -1
- package/dist/theme/components/PageForm.js +58 -56
- package/dist/theme/components/Pagination.d.ts.map +1 -1
- package/dist/theme/components/Pagination.js +22 -25
- package/dist/theme/components/PostForm.d.ts +0 -1
- package/dist/theme/components/PostForm.d.ts.map +1 -1
- package/dist/theme/components/PostForm.js +85 -77
- package/dist/theme/components/PostList.d.ts.map +1 -1
- package/dist/theme/components/PostList.js +17 -17
- package/dist/theme/components/ThreadView.d.ts.map +1 -1
- package/dist/theme/components/ThreadView.js +15 -18
- package/dist/theme/components/TypeBadge.d.ts.map +1 -1
- package/dist/theme/components/TypeBadge.js +20 -20
- package/dist/theme/components/VisibilityBadge.d.ts.map +1 -1
- package/dist/theme/components/VisibilityBadge.js +14 -14
- package/dist/theme/components/index.d.ts +1 -1
- package/dist/theme/components/index.d.ts.map +1 -1
- package/dist/theme/layouts/BaseLayout.d.ts.map +1 -1
- package/dist/theme/layouts/BaseLayout.js +4 -2
- package/dist/theme/layouts/DashLayout.d.ts.map +1 -1
- package/dist/theme/layouts/DashLayout.js +29 -29
- package/dist/types/lingui-react-macro.d.js +9 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vendor/datastar.js +1606 -0
- package/package.json +5 -2
- package/src/app.tsx +175 -56
- package/src/auth.ts +5 -1
- package/src/client.ts +1 -1
- package/src/db/schema.ts +22 -7
- package/src/i18n/EXAMPLES.md +34 -14
- package/src/i18n/README.md +19 -9
- package/src/i18n/context.tsx +1 -4
- package/src/i18n/detect.ts +1 -67
- package/src/i18n/i18n.ts +15 -19
- package/src/i18n/index.ts +0 -3
- package/src/i18n/middleware.ts +12 -24
- package/src/lib/constants.ts +2 -1
- package/src/lib/image-processor.ts +23 -7
- package/src/lib/image.ts +6 -2
- package/src/lib/schemas.ts +6 -2
- package/src/lib/sse.ts +138 -50
- package/src/middleware/auth.ts +6 -2
- package/src/routes/api/posts.ts +14 -5
- package/src/routes/api/upload.ts +25 -7
- package/src/routes/dash/collections.tsx +162 -70
- package/src/routes/dash/index.tsx +22 -7
- package/src/routes/dash/media.tsx +59 -16
- package/src/routes/dash/pages.tsx +102 -44
- package/src/routes/dash/posts.tsx +87 -54
- package/src/routes/dash/redirects.tsx +74 -26
- package/src/routes/dash/settings.tsx +250 -57
- package/src/routes/feed/rss.ts +6 -4
- package/src/routes/pages/archive.tsx +71 -21
- package/src/routes/pages/collection.tsx +21 -6
- package/src/routes/pages/home.tsx +30 -9
- package/src/routes/pages/page.tsx +14 -5
- package/src/routes/pages/post.tsx +21 -7
- package/src/routes/pages/search.tsx +42 -11
- package/src/services/collection.ts +34 -9
- package/src/services/index.ts +4 -1
- package/src/services/media.ts +15 -3
- package/src/services/post.ts +39 -10
- package/src/services/redirect.ts +4 -1
- package/src/services/settings.ts +14 -3
- package/src/theme/components/ActionButtons.tsx +26 -14
- package/src/theme/components/CrudPageHeader.tsx +6 -1
- package/src/theme/components/DangerZone.tsx +19 -13
- package/src/theme/components/EmptyState.tsx +6 -1
- package/src/theme/components/PageForm.tsx +71 -24
- package/src/theme/components/Pagination.tsx +26 -8
- package/src/theme/components/PostForm.tsx +72 -25
- package/src/theme/components/PostList.tsx +16 -5
- package/src/theme/components/ThreadView.tsx +25 -7
- package/src/theme/components/TypeBadge.tsx +13 -4
- package/src/theme/components/VisibilityBadge.tsx +17 -5
- package/src/theme/components/index.ts +4 -1
- package/src/theme/layouts/BaseLayout.tsx +5 -2
- package/src/theme/layouts/DashLayout.tsx +41 -12
- package/src/types/lingui-react-macro.d.ts +34 -0
- package/src/types.ts +16 -2
- package/src/vendor/datastar.js +9 -0
- package/src/vendor/datastar.js.map +7 -0
|
@@ -2,25 +2,24 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-
|
|
|
2
2
|
/**
|
|
3
3
|
* Dashboard Posts Routes
|
|
4
4
|
*/ import { Hono } from "hono";
|
|
5
|
-
import {
|
|
6
|
-
import { useLingui } from "../../i18n/index.js";
|
|
5
|
+
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
7
6
|
import { DashLayout } from "../../theme/layouts/index.js";
|
|
8
7
|
import { PostForm, PostList, CrudPageHeader, ActionButtons } from "../../theme/components/index.js";
|
|
9
8
|
import * as sqid from "../../lib/sqid.js";
|
|
10
|
-
import {
|
|
9
|
+
import { sse } from "../../lib/sse.js";
|
|
11
10
|
export const postsRoutes = new Hono();
|
|
12
11
|
function PostsListContent({ posts }) {
|
|
13
|
-
const {
|
|
12
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
14
13
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
15
14
|
children: [
|
|
16
15
|
/*#__PURE__*/ _jsx(CrudPageHeader, {
|
|
17
|
-
title:
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
title: $__i18n._({
|
|
17
|
+
id: "+owNNn",
|
|
18
|
+
message: "Posts"
|
|
20
19
|
}),
|
|
21
|
-
ctaLabel:
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
ctaLabel: $__i18n._({
|
|
21
|
+
id: "FGrimz",
|
|
22
|
+
message: "New Post"
|
|
24
23
|
}),
|
|
25
24
|
ctaHref: "/dash/posts/new"
|
|
26
25
|
}),
|
|
@@ -31,14 +30,14 @@ function PostsListContent({ posts }) {
|
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
function NewPostContent() {
|
|
34
|
-
const {
|
|
33
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
35
34
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
36
35
|
children: [
|
|
37
36
|
/*#__PURE__*/ _jsx("h1", {
|
|
38
37
|
class: "text-2xl font-semibold mb-6",
|
|
39
|
-
children:
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
children: $__i18n._({
|
|
39
|
+
id: "FGrimz",
|
|
40
|
+
message: "New Post"
|
|
42
41
|
})
|
|
43
42
|
}),
|
|
44
43
|
/*#__PURE__*/ _jsx(PostForm, {
|
|
@@ -81,29 +80,24 @@ postsRoutes.get("/new", async (c)=>{
|
|
|
81
80
|
});
|
|
82
81
|
// Create post
|
|
83
82
|
postsRoutes.post("/", async (c)=>{
|
|
84
|
-
const
|
|
85
|
-
// Validate and parse form data
|
|
86
|
-
const type = parseFormData(formData, "type", PostTypeSchema);
|
|
87
|
-
const visibility = parseFormData(formData, "visibility", VisibilitySchema);
|
|
88
|
-
const title = parseFormDataOptional(formData, "title", z.string());
|
|
89
|
-
const content = formData.get("content");
|
|
90
|
-
const sourceUrl = parseFormDataOptional(formData, "sourceUrl", z.string());
|
|
91
|
-
const path = parseFormDataOptional(formData, "path", z.string());
|
|
83
|
+
const body = await c.req.json();
|
|
92
84
|
const post = await c.var.services.posts.create({
|
|
93
|
-
type,
|
|
94
|
-
title,
|
|
95
|
-
content,
|
|
96
|
-
visibility,
|
|
97
|
-
sourceUrl,
|
|
98
|
-
path
|
|
85
|
+
type: body.type,
|
|
86
|
+
title: body.title || undefined,
|
|
87
|
+
content: body.content,
|
|
88
|
+
visibility: body.visibility,
|
|
89
|
+
sourceUrl: body.sourceUrl || undefined,
|
|
90
|
+
path: body.path || undefined
|
|
91
|
+
});
|
|
92
|
+
return sse(c, async (stream)=>{
|
|
93
|
+
await stream.redirect(`/dash/posts/${sqid.encode(post.id)}`);
|
|
99
94
|
});
|
|
100
|
-
return c.redirect(`/dash/posts/${sqid.encode(post.id)}`);
|
|
101
95
|
});
|
|
102
96
|
function ViewPostContent({ post }) {
|
|
103
|
-
const {
|
|
104
|
-
const defaultTitle =
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
98
|
+
const defaultTitle = $__i18n._({
|
|
99
|
+
id: "y28hnO",
|
|
100
|
+
message: "Post"
|
|
107
101
|
});
|
|
108
102
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
109
103
|
children: [
|
|
@@ -116,14 +110,14 @@ function ViewPostContent({ post }) {
|
|
|
116
110
|
}),
|
|
117
111
|
/*#__PURE__*/ _jsx(ActionButtons, {
|
|
118
112
|
editHref: `/dash/posts/${sqid.encode(post.id)}/edit`,
|
|
119
|
-
editLabel:
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
editLabel: $__i18n._({
|
|
114
|
+
id: "ePK91l",
|
|
115
|
+
message: "Edit"
|
|
122
116
|
}),
|
|
123
117
|
viewHref: `/p/${sqid.encode(post.id)}`,
|
|
124
|
-
viewLabel:
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
viewLabel: $__i18n._({
|
|
119
|
+
id: "jpctdh",
|
|
120
|
+
message: "View"
|
|
127
121
|
})
|
|
128
122
|
})
|
|
129
123
|
]
|
|
@@ -143,14 +137,14 @@ function ViewPostContent({ post }) {
|
|
|
143
137
|
});
|
|
144
138
|
}
|
|
145
139
|
function EditPostContent({ post }) {
|
|
146
|
-
const {
|
|
140
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
147
141
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
148
142
|
children: [
|
|
149
143
|
/*#__PURE__*/ _jsx("h1", {
|
|
150
144
|
class: "text-2xl font-semibold mb-6",
|
|
151
|
-
children:
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
children: $__i18n._({
|
|
146
|
+
id: "B373X+",
|
|
147
|
+
message: "Edit Post"
|
|
154
148
|
})
|
|
155
149
|
}),
|
|
156
150
|
/*#__PURE__*/ _jsx(PostForm, {
|
|
@@ -199,28 +193,25 @@ postsRoutes.get("/:id/edit", async (c)=>{
|
|
|
199
193
|
postsRoutes.post("/:id", async (c)=>{
|
|
200
194
|
const id = sqid.decode(c.req.param("id"));
|
|
201
195
|
if (!id) return c.notFound();
|
|
202
|
-
const
|
|
203
|
-
// Validate and parse form data
|
|
204
|
-
const type = parseFormData(formData, "type", PostTypeSchema);
|
|
205
|
-
const visibility = parseFormData(formData, "visibility", VisibilitySchema);
|
|
206
|
-
const title = parseFormDataOptional(formData, "title", z.string()) || null;
|
|
207
|
-
const content = parseFormDataOptional(formData, "content", z.string()) || null;
|
|
208
|
-
const sourceUrl = parseFormDataOptional(formData, "sourceUrl", z.string()) || null;
|
|
209
|
-
const path = parseFormDataOptional(formData, "path", z.string()) || null;
|
|
196
|
+
const body = await c.req.json();
|
|
210
197
|
await c.var.services.posts.update(id, {
|
|
211
|
-
type,
|
|
212
|
-
title,
|
|
213
|
-
content,
|
|
214
|
-
visibility,
|
|
215
|
-
sourceUrl,
|
|
216
|
-
path
|
|
198
|
+
type: body.type,
|
|
199
|
+
title: body.title || null,
|
|
200
|
+
content: body.content || null,
|
|
201
|
+
visibility: body.visibility,
|
|
202
|
+
sourceUrl: body.sourceUrl || null,
|
|
203
|
+
path: body.path || null
|
|
204
|
+
});
|
|
205
|
+
return sse(c, async (stream)=>{
|
|
206
|
+
await stream.redirect(`/dash/posts/${sqid.encode(id)}`);
|
|
217
207
|
});
|
|
218
|
-
return c.redirect(`/dash/posts/${sqid.encode(id)}`);
|
|
219
208
|
});
|
|
220
209
|
// Delete post
|
|
221
210
|
postsRoutes.post("/:id/delete", async (c)=>{
|
|
222
211
|
const id = sqid.decode(c.req.param("id"));
|
|
223
212
|
if (!id) return c.notFound();
|
|
224
213
|
await c.var.services.posts.delete(id);
|
|
225
|
-
return c
|
|
214
|
+
return sse(c, async (stream)=>{
|
|
215
|
+
await stream.redirect("/dash/posts");
|
|
216
|
+
});
|
|
226
217
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirects.d.ts","sourceRoot":"","sources":["../../../src/routes/dash/redirects.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"redirects.d.ts","sourceRoot":"","sources":["../../../src/routes/dash/redirects.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAUjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,eAAe,kDAAkB,CAAC"}
|
|
@@ -2,33 +2,34 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-
|
|
|
2
2
|
/**
|
|
3
3
|
* Dashboard Redirects Routes
|
|
4
4
|
*/ import { Hono } from "hono";
|
|
5
|
-
import { useLingui } from "
|
|
5
|
+
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
6
6
|
import { DashLayout } from "../../theme/layouts/index.js";
|
|
7
7
|
import { EmptyState, ListItemRow, ActionButtons, CrudPageHeader } from "../../theme/components/index.js";
|
|
8
|
+
import { sse } from "../../lib/sse.js";
|
|
8
9
|
export const redirectsRoutes = new Hono();
|
|
9
10
|
function RedirectsListContent({ redirects }) {
|
|
10
|
-
const {
|
|
11
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
11
12
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
12
13
|
children: [
|
|
13
14
|
/*#__PURE__*/ _jsx(CrudPageHeader, {
|
|
14
|
-
title:
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
title: $__i18n._({
|
|
16
|
+
id: "M9xgHy",
|
|
17
|
+
message: "Redirects"
|
|
17
18
|
}),
|
|
18
|
-
ctaLabel:
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
ctaLabel: $__i18n._({
|
|
20
|
+
id: "0a6MpL",
|
|
21
|
+
message: "New Redirect"
|
|
21
22
|
}),
|
|
22
23
|
ctaHref: "/dash/redirects/new"
|
|
23
24
|
}),
|
|
24
25
|
redirects.length === 0 ? /*#__PURE__*/ _jsx(EmptyState, {
|
|
25
|
-
message:
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
message: $__i18n._({
|
|
27
|
+
id: "tfrt7B",
|
|
28
|
+
message: "No redirects configured."
|
|
28
29
|
}),
|
|
29
|
-
ctaText:
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
ctaText: $__i18n._({
|
|
31
|
+
id: "0a6MpL",
|
|
32
|
+
message: "New Redirect"
|
|
32
33
|
}),
|
|
33
34
|
ctaHref: "/dash/redirects/new"
|
|
34
35
|
}) : /*#__PURE__*/ _jsx("div", {
|
|
@@ -36,9 +37,9 @@ function RedirectsListContent({ redirects }) {
|
|
|
36
37
|
children: redirects.map((r)=>/*#__PURE__*/ _jsx(ListItemRow, {
|
|
37
38
|
actions: /*#__PURE__*/ _jsx(ActionButtons, {
|
|
38
39
|
deleteAction: `/dash/redirects/${r.id}/delete`,
|
|
39
|
-
deleteLabel:
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
deleteLabel: $__i18n._({
|
|
41
|
+
id: "cnGeoo",
|
|
42
|
+
message: "Delete"
|
|
42
43
|
})
|
|
43
44
|
}),
|
|
44
45
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
@@ -68,19 +69,19 @@ function RedirectsListContent({ redirects }) {
|
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
function NewRedirectContent() {
|
|
71
|
-
const {
|
|
72
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
72
73
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
73
74
|
children: [
|
|
74
75
|
/*#__PURE__*/ _jsx("h1", {
|
|
75
76
|
class: "text-2xl font-semibold mb-6",
|
|
76
|
-
children:
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
children: $__i18n._({
|
|
78
|
+
id: "0a6MpL",
|
|
79
|
+
message: "New Redirect"
|
|
79
80
|
})
|
|
80
81
|
}),
|
|
81
82
|
/*#__PURE__*/ _jsxs("form", {
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
"data-signals": "{fromPath: '', toPath: '', type: '301'}",
|
|
84
|
+
"data-on:submit__prevent": "@post('/dash/redirects')",
|
|
84
85
|
class: "flex flex-col gap-4 max-w-lg",
|
|
85
86
|
children: [
|
|
86
87
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -88,23 +89,23 @@ function NewRedirectContent() {
|
|
|
88
89
|
children: [
|
|
89
90
|
/*#__PURE__*/ _jsx("label", {
|
|
90
91
|
class: "label",
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
children: $__i18n._({
|
|
93
|
+
id: "7Q1KKN",
|
|
94
|
+
message: "From Path"
|
|
94
95
|
})
|
|
95
96
|
}),
|
|
96
97
|
/*#__PURE__*/ _jsx("input", {
|
|
97
98
|
type: "text",
|
|
98
|
-
|
|
99
|
+
"data-bind": "fromPath",
|
|
99
100
|
class: "input",
|
|
100
101
|
placeholder: "/old-path",
|
|
101
102
|
required: true
|
|
102
103
|
}),
|
|
103
104
|
/*#__PURE__*/ _jsx("p", {
|
|
104
105
|
class: "text-xs text-muted-foreground mt-1",
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
children: $__i18n._({
|
|
107
|
+
id: "OCNZaU",
|
|
108
|
+
message: "The path to redirect from"
|
|
108
109
|
})
|
|
109
110
|
})
|
|
110
111
|
]
|
|
@@ -114,23 +115,23 @@ function NewRedirectContent() {
|
|
|
114
115
|
children: [
|
|
115
116
|
/*#__PURE__*/ _jsx("label", {
|
|
116
117
|
class: "label",
|
|
117
|
-
children:
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
children: $__i18n._({
|
|
119
|
+
id: "WmZ/rP",
|
|
120
|
+
message: "To Path"
|
|
120
121
|
})
|
|
121
122
|
}),
|
|
122
123
|
/*#__PURE__*/ _jsx("input", {
|
|
123
124
|
type: "text",
|
|
124
|
-
|
|
125
|
+
"data-bind": "toPath",
|
|
125
126
|
class: "input",
|
|
126
127
|
placeholder: "/new-path or https://...",
|
|
127
128
|
required: true
|
|
128
129
|
}),
|
|
129
130
|
/*#__PURE__*/ _jsx("p", {
|
|
130
131
|
class: "text-xs text-muted-foreground mt-1",
|
|
131
|
-
children:
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
children: $__i18n._({
|
|
133
|
+
id: "wEF6Ix",
|
|
134
|
+
message: "The destination path or URL"
|
|
134
135
|
})
|
|
135
136
|
})
|
|
136
137
|
]
|
|
@@ -140,27 +141,27 @@ function NewRedirectContent() {
|
|
|
140
141
|
children: [
|
|
141
142
|
/*#__PURE__*/ _jsx("label", {
|
|
142
143
|
class: "label",
|
|
143
|
-
children:
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
children: $__i18n._({
|
|
145
|
+
id: "+zy2Nq",
|
|
146
|
+
message: "Type"
|
|
146
147
|
})
|
|
147
148
|
}),
|
|
148
149
|
/*#__PURE__*/ _jsxs("select", {
|
|
149
|
-
|
|
150
|
+
"data-bind": "type",
|
|
150
151
|
class: "select",
|
|
151
152
|
children: [
|
|
152
153
|
/*#__PURE__*/ _jsx("option", {
|
|
153
154
|
value: "301",
|
|
154
|
-
children:
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
children: $__i18n._({
|
|
156
|
+
id: "b+/jO6",
|
|
157
|
+
message: "301 (Permanent)"
|
|
157
158
|
})
|
|
158
159
|
}),
|
|
159
160
|
/*#__PURE__*/ _jsx("option", {
|
|
160
161
|
value: "302",
|
|
161
|
-
children:
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
children: $__i18n._({
|
|
163
|
+
id: "3Yvsaz",
|
|
164
|
+
message: "302 (Temporary)"
|
|
164
165
|
})
|
|
165
166
|
})
|
|
166
167
|
]
|
|
@@ -173,17 +174,17 @@ function NewRedirectContent() {
|
|
|
173
174
|
/*#__PURE__*/ _jsx("button", {
|
|
174
175
|
type: "submit",
|
|
175
176
|
class: "btn",
|
|
176
|
-
children:
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
children: $__i18n._({
|
|
178
|
+
id: "Mhf/H/",
|
|
179
|
+
message: "Create Redirect"
|
|
179
180
|
})
|
|
180
181
|
}),
|
|
181
182
|
/*#__PURE__*/ _jsx("a", {
|
|
182
183
|
href: "/dash/redirects",
|
|
183
184
|
class: "btn-outline",
|
|
184
|
-
children:
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
children: $__i18n._({
|
|
186
|
+
id: "dEgA5A",
|
|
187
|
+
message: "Cancel"
|
|
187
188
|
})
|
|
188
189
|
})
|
|
189
190
|
]
|
|
@@ -220,12 +221,12 @@ redirectsRoutes.get("/new", async (c)=>{
|
|
|
220
221
|
});
|
|
221
222
|
// Create redirect
|
|
222
223
|
redirectsRoutes.post("/", async (c)=>{
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
const body = await c.req.json();
|
|
225
|
+
const type = parseInt(body.type, 10);
|
|
226
|
+
await c.var.services.redirects.create(body.fromPath, body.toPath, type);
|
|
227
|
+
return sse(c, async (stream)=>{
|
|
228
|
+
await stream.redirect("/dash/redirects");
|
|
229
|
+
});
|
|
229
230
|
});
|
|
230
231
|
// Delete redirect
|
|
231
232
|
redirectsRoutes.post("/:id/delete", async (c)=>{
|
|
@@ -233,5 +234,7 @@ redirectsRoutes.post("/:id/delete", async (c)=>{
|
|
|
233
234
|
if (!isNaN(id)) {
|
|
234
235
|
await c.var.services.redirects.delete(id);
|
|
235
236
|
}
|
|
236
|
-
return c
|
|
237
|
+
return sse(c, async (stream)=>{
|
|
238
|
+
await stream.redirect("/dash/redirects");
|
|
239
|
+
});
|
|
237
240
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/routes/dash/settings.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/routes/dash/settings.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,cAAc,kDAAkB,CAAC"}
|