Migrate deploy-lftp script to tsx
Also change assets directory to `assets` and add default `.htaccess` file
This commit is contained in:
parent
405ad38f5d
commit
d01594f456
19 changed files with 172 additions and 97 deletions
|
|
@ -10,24 +10,50 @@ export const WEBSITE_LIST = [
|
|||
"weasyl",
|
||||
"inkbunny",
|
||||
"sofurry",
|
||||
"twitter",
|
||||
"mastodon",
|
||||
"twitter",
|
||||
"bluesky",
|
||||
"itaku",
|
||||
] as const;
|
||||
|
||||
const localUrlRegex = /^((\/?\.\.(?=\/))+|(\.(?=\/)))?\/?[a-z0-9_-]+(\/[a-z0-9_-]+)*\/?$/;
|
||||
const ekaPostUrlRegex = /^(?:https:\/\/)(?:www\.)?aryion\.com\/g4\/view\/([1-9]\d*)\/?$/;
|
||||
const furaffinityPostUrlRegex = /^(?:https:\/\/)(?:www\.)?furaffinity\.net\/view\/([1-9]\d*)\/?$/;
|
||||
const weasylPostUrlRegex =
|
||||
/^(?:https:\/\/)(?:www\.)?weasyl\.com\/~([a-zA-Z][a-zA-Z0-9_-]+)\/submissions\/([1-9]\d*(?:\/[a-zA-Z0-9_-]+)?)\/?$/;
|
||||
const inkbunnyPostUrlRegex = /^(?:https:\/\/)(?:www\.)?inkbunny\.net\/s\/([1-9]\d*)\/?$/;
|
||||
const sofurryPostUrlRegex = /^(?:https:\/\/)www\.sofurry\.com\/view\/([1-9]\d*)\/?$/;
|
||||
const mastodonPostUrlRegex = /^(?:https:\/\/)((?:[a-zA-Z0-9_-]+\.)+[a-z]+)\/@([a-zA-Z][a-zA-Z0-9_-]+)\/([1-9]\d*)\/?$/;
|
||||
|
||||
const refineAuthors = (value: { id: any } | any[]) => "id" in value || value.length > 0;
|
||||
const refineCopyrightedCharacters = (value: Record<string, any>) => !("" in value) || Object.keys(value).length == 1;
|
||||
|
||||
const lang = z.enum(["eng", "tok"]).default("eng");
|
||||
const website = z.enum(WEBSITE_LIST);
|
||||
const platform = z.enum(["web", "windows", "linux", "macos", "android", "ios"]);
|
||||
const mastodonPost = z.object({
|
||||
instance: z.string(),
|
||||
user: z.string(),
|
||||
postId: z.string(),
|
||||
});
|
||||
const mastodonPost = z
|
||||
.object({
|
||||
instance: z.string(),
|
||||
user: z.string(),
|
||||
postId: z.string(),
|
||||
})
|
||||
.or(
|
||||
z.string().transform((mastodonPost, ctx) => {
|
||||
const match = mastodonPostUrlRegex.exec(mastodonPost);
|
||||
if (!match) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: `"mastodonPost" contains an invalid URL`,
|
||||
});
|
||||
return z.NEVER;
|
||||
}
|
||||
return {
|
||||
instance: match[1],
|
||||
user: match[2],
|
||||
postId: match[3],
|
||||
};
|
||||
}),
|
||||
);
|
||||
const copyrightedCharacters = z
|
||||
.record(z.string(), reference("users"))
|
||||
.default({})
|
||||
|
|
@ -71,6 +97,11 @@ const storiesCollection = defineCollection({
|
|||
relatedGames: z.array(reference("games")).default([]),
|
||||
posts: z
|
||||
.object({
|
||||
eka: z.string().regex(ekaPostUrlRegex).optional(),
|
||||
furaffinity: z.string().regex(furaffinityPostUrlRegex).optional(),
|
||||
weasyl: z.string().regex(weasylPostUrlRegex).optional(),
|
||||
inkbunny: z.string().regex(inkbunnyPostUrlRegex).optional(),
|
||||
sofurry: z.string().regex(sofurryPostUrlRegex).optional(),
|
||||
mastodon: mastodonPost.optional(),
|
||||
})
|
||||
.default({}),
|
||||
|
|
@ -105,6 +136,11 @@ const gamesCollection = defineCollection({
|
|||
relatedGames: z.array(reference("games")).default([]),
|
||||
posts: z
|
||||
.object({
|
||||
eka: z.string().regex(ekaPostUrlRegex).optional(),
|
||||
furaffinity: z.string().regex(furaffinityPostUrlRegex).optional(),
|
||||
weasyl: z.string().regex(weasylPostUrlRegex).optional(),
|
||||
inkbunny: z.string().regex(inkbunnyPostUrlRegex).optional(),
|
||||
sofurry: z.string().regex(sofurryPostUrlRegex).optional(),
|
||||
mastodon: mastodonPost.optional(),
|
||||
})
|
||||
.default({}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue