Merge branch 'develop' of codeberg.org:calckey/calckey into develop

This commit is contained in:
ThatOneCalculator 2023-04-26 14:20:02 -07:00
commit 3dfb43be84
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
8 changed files with 88 additions and 44 deletions

View File

@ -79,8 +79,8 @@ redis:
# host: localhost # host: localhost
# port: 9200 # port: 9200
# ssl: false # ssl: false
# user: # user:
# pass: # pass:
# ┌───────────────┐ # ┌───────────────┐
#───┘ ID generation └─────────────────────────────────────────── #───┘ ID generation └───────────────────────────────────────────
@ -109,6 +109,19 @@ id: 'aid'
# Maximum lenght of an image caption or file comment (default 1500, max 8192) # Maximum lenght of an image caption or file comment (default 1500, max 8192)
#maxCaptionLength: 1500 #maxCaptionLength: 1500
# Reserved usernames that only the administrator can register with
reservedUsernames:
- root
- admin
- system
- test
- proxy
- relay
- mod
- moderator
- info
- information
# Whether disable HSTS # Whether disable HSTS
#disableHsts: true #disableHsts: true
@ -211,4 +224,4 @@ id: 'aid'
# !!!!!!!!!! # !!!!!!!!!!
# Seriously. Do NOT fill out the above settings if you're self-hosting. # Seriously. Do NOT fill out the above settings if you're self-hosting.
# They're much better off being set from the control panel. # They're much better off being set from the control panel.

View File

@ -77,6 +77,8 @@ export type Source = {
sha256CertFingerprints?: string[]; sha256CertFingerprints?: string[];
}; };
reservedUsernames?: string[];
// Managed hosting stuff // Managed hosting stuff
maxUserSignups?: number; maxUserSignups?: number;
isManagedHosting?: boolean; isManagedHosting?: boolean;

View File

@ -1,5 +1,6 @@
import { IsNull } from "typeorm"; import { IsNull } from "typeorm";
import { Users, UsedUsernames } from "@/models/index.js"; import { Users, UsedUsernames } from "@/models/index.js";
import config from "@/config/index.js";
import define from "../../define.js"; import define from "../../define.js";
export const meta = { export const meta = {
@ -40,7 +41,11 @@ export default define(meta, paramDef, async (ps) => {
username: ps.username.toLowerCase(), username: ps.username.toLowerCase(),
}); });
const reserved = config.reservedUsernames?.includes(
ps.username.toLowerCase(),
);
return { return {
available: exist === 0 && exist2 === 0, available: exist === 0 && exist2 === 0 && !reserved,
}; };
}); });

View File

@ -44,6 +44,11 @@ export default async (ctx: Koa.Context) => {
const invitationCode = body["invitationCode"]; const invitationCode = body["invitationCode"];
const emailAddress = body["emailAddress"]; const emailAddress = body["emailAddress"];
if (config.reservedUsernames?.includes(username.toLowerCase())) {
ctx.status = 400;
return;
}
if (instance.emailRequiredForSignup) { if (instance.emailRequiredForSignup) {
if (emailAddress == null || typeof emailAddress !== "string") { if (emailAddress == null || typeof emailAddress !== "string") {
ctx.status = 400; ctx.status = 400;

View File

@ -35,7 +35,7 @@ const instance = props.instance ?? {
'meta[name="theme-color-orig"]' 'meta[name="theme-color-orig"]'
) as HTMLMetaElement ) as HTMLMetaElement
)?.content, )?.content,
software: Instance.softwareName || "Calckey", softwareName: Instance.softwareName || "Calckey",
}; };
const capitalize = (s: string) => s && s[0].toUpperCase() + s.slice(1); const capitalize = (s: string) => s && s[0].toUpperCase() + s.slice(1);

View File

@ -251,14 +251,18 @@ let showContent = $ref(false);
min-height: 2em; min-height: 2em;
max-height: 5em; max-height: 5em;
filter: blur(4px); filter: blur(4px);
:deep(span) {
animation: none !important;
transform: none !important;
}
:deep(img) {
filter: blur(12px);
}
} }
:deep(.fade) { :deep(.fade) {
inset: 0; inset: 0;
top: 40px; top: 40px;
} }
:deep(span) {
animation: none !important;
}
} }
:deep(.fade) { :deep(.fade) {

View File

@ -12,6 +12,24 @@
--margin: var(--marginHalf); --margin: var(--marginHalf);
} }
// https://larsenwork.com/easing-gradients/
--gradient: hsl(0, 0%, 0%) 0%,
hsla(0, 0%, 0%, 0.987) 8.1%,
hsla(0, 0%, 0%, 0.951) 15.5%,
hsla(0, 0%, 0%, 0.896) 22.5%,
hsla(0, 0%, 0%, 0.825) 29%,
hsla(0, 0%, 0%, 0.741) 35.3%,
hsla(0, 0%, 0%, 0.648) 41.2%,
hsla(0, 0%, 0%, 0.55) 47.1%,
hsla(0, 0%, 0%, 0.45) 52.9%,
hsla(0, 0%, 0%, 0.352) 58.8%,
hsla(0, 0%, 0%, 0.259) 64.7%,
hsla(0, 0%, 0%, 0.175) 71%,
hsla(0, 0%, 0%, 0.104) 77.5%,
hsla(0, 0%, 0%, 0.049) 84.5%,
hsla(0, 0%, 0%, 0.013) 91.9%,
hsla(0, 0%, 0%, 0) 100%;
//--ad: rgb(255 169 0 / 10%); //--ad: rgb(255 169 0 / 10%);
} }
@ -36,32 +54,6 @@ html {
text-size-adjust: 100%; text-size-adjust: 100%;
tab-size: 2; tab-size: 2;
&, * {
scrollbar-color: var(--scrollbarHandle) inherit;
scrollbar-width: thin;
&::-webkit-scrollbar {
width: 6px;
height: 6px;
}
&::-webkit-scrollbar-track {
background: inherit;
}
&::-webkit-scrollbar-thumb {
background: var(--scrollbarHandle);
&:hover {
background: var(--scrollbarHandleHover);
}
&:active {
background: var(--accent);
}
}
}
&.f-1 { &.f-1 {
font-size: 15px; font-size: 15px;
} }
@ -78,6 +70,37 @@ html {
font-family: sans-serif; font-family: sans-serif;
} }
} }
body::-webkit-scrollbar {
width: 12px;
height: 12px;
}
body::-webkit-scrollbar-thumb {
border-radius: 100px;
background-clip: content-box;
border: 3px solid transparent;
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: inherit;
}
::-webkit-scrollbar-thumb {
background: var(--scrollbarHandle);
min-height: 80px;
&:hover {
background: var(--scrollbarHandleHover);
background-clip: content-box;
}
&:active {
background: var(--accent);
background-clip: content-box;
}
}
html._themeChanging_ { html._themeChanging_ {
&, * { &, * {

View File

@ -278,16 +278,8 @@ function more(ev: MouseEvent) {
height: 100%; height: 100%;
background-size: cover; background-size: cover;
background-position: center center; background-position: center center;
-webkit-mask-image: linear-gradient( -webkit-mask-image: linear-gradient(var(--gradient));
0deg, mask-image: linear-gradient(var(--gradient));
rgba(0, 0, 0, 0) 15%,
rgba(0, 0, 0, 0.75) 100%
);
mask-image: linear-gradient(
0deg,
rgba(0, 0, 0, 0) 15%,
rgba(0, 0, 0, 0.75) 100%
);
} }
> .account { > .account {