misc: optimize admin configs
This commit is contained in:
1 parent
18151a0600
commit
4646a59ddf
3 files changed
+34
-88
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "0.7.1",
|
"version": "0.7.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
|
|
||||||
export let checked: boolean | undefined = false
|
export let defaultValue: boolean = false
|
||||||
|
export let checked: boolean | undefined = defaultValue
|
||||||
const dispatcher = createEventDispatcher<{ change: boolean }>()
|
const dispatcher = createEventDispatcher<{ change: boolean }>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -14,16 +14,12 @@
|
|||||||
|
|
||||||
export let data: PageData
|
export let data: PageData
|
||||||
|
|
||||||
const site = {
|
const formData: Omit<EditSite, 'auth'> | undefined = data.site
|
||||||
...data.site?.site_view.site,
|
? {
|
||||||
}
|
...data.site.site_view.local_site,
|
||||||
|
...data.site.site_view.site,
|
||||||
const local_site = {
|
}
|
||||||
...data.site?.site_view.local_site,
|
: undefined
|
||||||
}
|
|
||||||
const h = {
|
|
||||||
fart: 'hey',
|
|
||||||
}
|
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
if (!$profile?.jwt) return
|
if (!$profile?.jwt) return
|
||||||
@@ -34,21 +30,7 @@
|
|||||||
try {
|
try {
|
||||||
await getClient().editSite({
|
await getClient().editSite({
|
||||||
auth: jwt,
|
auth: jwt,
|
||||||
name: site.name,
|
...formData,
|
||||||
description: site.description,
|
|
||||||
sidebar: site.sidebar,
|
|
||||||
legal_information: local_site.legal_information,
|
|
||||||
enable_downvotes: local_site.enable_downvotes,
|
|
||||||
enable_nsfw: local_site.enable_nsfw,
|
|
||||||
registration_mode: local_site.registration_mode,
|
|
||||||
community_creation_admin_only: local_site.community_creation_admin_only,
|
|
||||||
require_email_verification: local_site.require_email_verification,
|
|
||||||
application_email_admins: local_site.application_email_admins,
|
|
||||||
reports_email_admins: local_site.reports_email_admins,
|
|
||||||
private_instance: local_site.private_instance,
|
|
||||||
hide_modlog_mod_names: local_site.hide_modlog_mod_names,
|
|
||||||
slur_filter_regex: local_site.slur_filter_regex,
|
|
||||||
federation_enabled: local_site.federation_enabled,
|
|
||||||
})
|
})
|
||||||
toast({
|
toast({
|
||||||
content: 'Updated your site.',
|
content: 'Updated your site.',
|
||||||
@@ -73,31 +55,23 @@
|
|||||||
|
|
||||||
<form class="flex flex-col gap-4" on:submit|preventDefault={save}>
|
<form class="flex flex-col gap-4" on:submit|preventDefault={save}>
|
||||||
<h1 class="font-bold text-2xl">Site configuration</h1>
|
<h1 class="font-bold text-2xl">Site configuration</h1>
|
||||||
{#if site}
|
{#if formData}
|
||||||
<TextInput bind:value={site.name} label="Name" />
|
<TextInput bind:value={formData.name} label="Name" />
|
||||||
<TextInput bind:value={site.description} label="Description" />
|
<TextInput bind:value={formData.description} label="Description" />
|
||||||
<MarkdownEditor previewButton bind:value={site.sidebar} label="Sidebar" />
|
|
||||||
{/if}
|
|
||||||
{#if local_site}
|
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
previewButton
|
previewButton
|
||||||
bind:value={local_site.legal_information}
|
bind:value={formData.sidebar}
|
||||||
|
label="Sidebar"
|
||||||
|
/>
|
||||||
|
<MarkdownEditor
|
||||||
|
previewButton
|
||||||
|
bind:value={formData.legal_information}
|
||||||
label="Legal"
|
label="Legal"
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Checkbox bind:checked={formData.enable_downvotes} defaultValue={true}>
|
||||||
checked={local_site.enable_downvotes ?? true}
|
|
||||||
on:change={(e) => {
|
|
||||||
local_site.enable_downvotes = !local_site.enable_downvotes
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Enable downvotes
|
Enable downvotes
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox
|
<Checkbox checked={formData.enable_nsfw} defaultValue={true}>
|
||||||
checked={local_site.enable_nsfw ?? true}
|
|
||||||
on:change={(e) => {
|
|
||||||
local_site.enable_nsfw = !local_site.enable_nsfw
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Enable NSFW
|
Enable NSFW
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<SelectMenu
|
<SelectMenu
|
||||||
@@ -105,74 +79,45 @@
|
|||||||
alignment="top-left"
|
alignment="top-left"
|
||||||
options={['Closed', 'RequireApplication', 'Open']}
|
options={['Closed', 'RequireApplication', 'Open']}
|
||||||
optionNames={['Closed', 'Require Application', 'Open Registration']}
|
optionNames={['Closed', 'Require Application', 'Open Registration']}
|
||||||
selected={local_site.registration_mode ?? 'Open'}
|
selected={formData.registration_mode ?? 'Open'}
|
||||||
on:select={(e) => {
|
on:select={(e) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
local_site.registration_mode = e.detail
|
formData.registration_mode = e.detail
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={local_site.community_creation_admin_only ?? true}
|
bind:checked={formData.community_creation_admin_only}
|
||||||
on:change={(e) => {
|
defaultValue={true}
|
||||||
local_site.community_creation_admin_only =
|
|
||||||
!local_site.community_creation_admin_only
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Only admins can create communities
|
Only admins can create communities
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={local_site.require_email_verification ?? true}
|
bind:checked={formData.require_email_verification}
|
||||||
on:change={(e) => {
|
defaultValue={true}
|
||||||
local_site.require_email_verification =
|
|
||||||
!local_site.require_email_verification
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Require email verification
|
Require email verification
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={local_site.application_email_admins ?? true}
|
bind:checked={formData.application_email_admins}
|
||||||
on:change={(e) => {
|
defaultValue={true}
|
||||||
local_site.application_email_admins =
|
|
||||||
!local_site.application_email_admins
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Email admins on receiving new applications
|
Email admins on receiving new applications
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox
|
<Checkbox bind:checked={formData.reports_email_admins} defaultValue={true}>
|
||||||
checked={local_site.reports_email_admins ?? true}
|
|
||||||
on:change={(e) => {
|
|
||||||
local_site.reports_email_admins = !local_site.reports_email_admins
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Email admins on receiving new reports
|
Email admins on receiving new reports
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox
|
<Checkbox bind:checked={formData.private_instance} defaultValue={true}>
|
||||||
checked={local_site.private_instance ?? true}
|
|
||||||
on:change={(e) => {
|
|
||||||
local_site.private_instance = !local_site.private_instance
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Private instance
|
Private instance
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Checkbox
|
<Checkbox bind:checked={formData.hide_modlog_mod_names} defaultValue={true}>
|
||||||
checked={local_site.hide_modlog_mod_names ?? true}
|
|
||||||
on:change={(e) => {
|
|
||||||
local_site.hide_modlog_mod_names = !local_site.hide_modlog_mod_names
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Hide modlog mod names
|
Hide modlog mod names
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<TextInput
|
<TextInput
|
||||||
bind:value={local_site.slur_filter_regex}
|
bind:value={formData.slur_filter_regex}
|
||||||
label="Slur filter regex"
|
label="Slur filter regex"
|
||||||
placeholder="(word1|word2)"
|
placeholder="(word1|word2)"
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Checkbox bind:checked={formData.federation_enabled} defaultValue={true}>
|
||||||
checked={local_site.federation_enabled ?? true}
|
|
||||||
on:change={(e) => {
|
|
||||||
local_site.federation_enabled = !local_site.federation_enabled
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Federation enabled
|
Federation enabled
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in new issue
Block a user