2024-05-29 19:31:10 +00:00
|
|
|
import { c as config } from './config-BHx687w1.js';
|
2024-06-23 09:25:48 +00:00
|
|
|
import './stores-Cv0rQqhp.js';
|
|
|
|
import './index-CUXxL1oq.js';
|
2024-05-29 18:43:41 +00:00
|
|
|
import './index-Ddp2AB5f.js';
|
2024-06-23 09:25:48 +00:00
|
|
|
import { s as superValidate, z as zod, f as fail } from './zod-D1iX83g6.js';
|
2024-05-29 18:43:41 +00:00
|
|
|
import { z } from 'zod';
|
|
|
|
|
|
|
|
const schema = z.object({
|
|
|
|
id: z.string(),
|
2024-06-07 14:31:14 +00:00
|
|
|
name: z.string().min(4).max(32),
|
2024-06-23 09:25:48 +00:00
|
|
|
// primary_color_hex: z.string().length(7),
|
|
|
|
// secondary_color_hex: z.string().length(7),
|
|
|
|
// text_color_hex: z.string().length(7),
|
2024-06-07 18:36:33 +00:00
|
|
|
domain: z.string().refine((key) => key === null || /^[a-z0-9\.\-]*$/.test(key), {
|
2024-06-07 14:10:14 +00:00
|
|
|
message: "Invalid domain"
|
2024-06-07 15:17:27 +00:00
|
|
|
}).nullable(),
|
2024-05-30 10:31:54 +00:00
|
|
|
use_freebie: z.boolean().default(false),
|
2024-06-23 09:25:48 +00:00
|
|
|
freebie_title: z.string().nullable(),
|
2024-06-07 15:17:27 +00:00
|
|
|
freebie_url: z.string().nullable(),
|
|
|
|
freebie_image_url: z.string().nullable(),
|
|
|
|
freebie_text: z.string().nullable(),
|
2024-05-29 18:43:41 +00:00
|
|
|
title: z.string(),
|
2024-06-13 19:47:09 +00:00
|
|
|
subtitle: z.string(),
|
2024-06-23 09:25:48 +00:00
|
|
|
auto_publish: z.boolean(),
|
|
|
|
use_contact_page: z.boolean(),
|
|
|
|
contact_email: z.string().email().nullable(),
|
|
|
|
use_about_page: z.boolean(),
|
|
|
|
about_text: z.string().nullable()
|
2024-05-29 18:43:41 +00:00
|
|
|
}).superRefine((data, ctx) => {
|
|
|
|
if (data.use_freebie) {
|
|
|
|
if (!data.freebie_url) {
|
|
|
|
ctx.addIssue({
|
|
|
|
path: ["freebie_url"],
|
|
|
|
message: "A freebie file is required when 'Use freebie' is true.",
|
|
|
|
code: "custom"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2024-06-23 09:25:48 +00:00
|
|
|
if (data.use_contact_page && !data.contact_email) {
|
|
|
|
ctx.addIssue({
|
|
|
|
path: ["contact_email"],
|
|
|
|
message: "A contact email is required when the contact page is enabled",
|
|
|
|
code: "custom"
|
|
|
|
});
|
|
|
|
}
|
2024-05-29 18:43:41 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const load = async ({ fetch }) => {
|
|
|
|
const blogRes = await fetch(config.api_url + "/blog?mine=true", {
|
|
|
|
credentials: "include"
|
|
|
|
});
|
|
|
|
const { site } = await blogRes.json();
|
|
|
|
return {
|
|
|
|
blog_info: site,
|
|
|
|
form: await superValidate(site, zod(schema))
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const actions = {
|
|
|
|
default: async (event) => {
|
|
|
|
const form = await superValidate(event, zod(schema));
|
|
|
|
if (!form.valid) {
|
|
|
|
return fail(400, {
|
|
|
|
form
|
|
|
|
});
|
|
|
|
}
|
|
|
|
let data = structuredClone(form.data);
|
|
|
|
const res = await event.fetch(config.api_url + "/dashboard/website", {
|
|
|
|
method: "PUT",
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
headers: {
|
|
|
|
"content-type": "application/json"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const res_data = await res.json();
|
|
|
|
if (!res_data.success)
|
|
|
|
return fail(res.status, {
|
|
|
|
form
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
form
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var _page_server = /*#__PURE__*/Object.freeze({
|
|
|
|
__proto__: null,
|
|
|
|
actions: actions,
|
|
|
|
load: load
|
|
|
|
});
|
|
|
|
|
2024-05-29 19:16:25 +00:00
|
|
|
const index = 7;
|
2024-05-29 18:43:41 +00:00
|
|
|
let component_cache;
|
2024-07-22 20:12:35 +00:00
|
|
|
const component = async () => component_cache ??= (await import('./_page.svelte-DCDTmci_.js')).default;
|
2024-05-29 19:16:25 +00:00
|
|
|
const server_id = "src/routes/(app)/website/+page.server.js";
|
2024-07-22 20:12:35 +00:00
|
|
|
const imports = ["_app/immutable/nodes/7.DBBRfisc.js","_app/immutable/chunks/scheduler.Nb9dF4RD.js","_app/immutable/chunks/index.aIvb1r_w.js","_app/immutable/chunks/spread.CgU5AtxT.js","_app/immutable/chunks/textarea.CLgcjYKj.js","_app/immutable/chunks/button.Hx4R_eXH.js","_app/immutable/chunks/index.CnPkSA2E.js","_app/immutable/chunks/index.275uym8j.js","_app/immutable/chunks/Toaster.svelte_svelte_type_style_lang.BVlHgIyE.js","_app/immutable/chunks/each.DmwFL-7U.js","_app/immutable/chunks/stores.DYB36PoW.js","_app/immutable/chunks/entry.85eA2EWC.js","_app/immutable/chunks/forms.BfXiwkgi.js","_app/immutable/chunks/config.zd1Rqlxu.js"];
|
2024-05-29 19:16:25 +00:00
|
|
|
const stylesheets = ["_app/immutable/assets/7.BXHCoMPH.css","_app/immutable/assets/textarea.Crp_yK76.css","_app/immutable/assets/Toaster.CZzI-Nh6.css"];
|
2024-05-29 18:43:41 +00:00
|
|
|
const fonts = [];
|
|
|
|
|
2024-05-29 19:16:25 +00:00
|
|
|
var _7 = /*#__PURE__*/Object.freeze({
|
2024-05-29 18:43:41 +00:00
|
|
|
__proto__: null,
|
|
|
|
component: component,
|
|
|
|
fonts: fonts,
|
|
|
|
imports: imports,
|
|
|
|
index: index,
|
|
|
|
server: _page_server,
|
|
|
|
server_id: server_id,
|
|
|
|
stylesheets: stylesheets
|
|
|
|
});
|
|
|
|
|
2024-05-29 19:16:25 +00:00
|
|
|
export { _7 as _, schema as s };
|
2024-07-22 20:12:35 +00:00
|
|
|
//# sourceMappingURL=7-DS1o2kUY.js.map
|