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

This commit is contained in:
freeplay 2023-07-01 19:21:44 -04:00
commit ba6502a45b
7 changed files with 87 additions and 42 deletions

View file

@ -349,6 +349,7 @@ _2fa:
deixin de funcionar deixin de funcionar
whyTOTPOnlyRenew: Laplicació dautenticació no es pot eliminar sempre que es hi whyTOTPOnlyRenew: Laplicació dautenticació no es pot eliminar sempre que es hi
hagi una clau de seguretat registrada. hagi una clau de seguretat registrada.
token: Token 2FA
_widgets: _widgets:
notifications: "Notificacions" notifications: "Notificacions"
timeline: "Línia de temps" timeline: "Línia de temps"

View file

@ -11,19 +11,25 @@ export const meta = {
export const paramDef = { export const paramDef = {
type: "object", type: "object",
properties: {}, properties: {
forceUpdate: { type: "boolean", default: false },
},
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async () => { export default define(meta, paramDef, async (ps) => {
let patrons; let patrons;
const cachedPatrons = await redisClient.get("patrons"); const cachedPatrons = await redisClient.get("patrons");
if (cachedPatrons) { if (!ps.forceUpdate && cachedPatrons) {
patrons = JSON.parse(cachedPatrons); patrons = JSON.parse(cachedPatrons);
} else { } else {
patrons = await fetch( patrons = await fetch(
"https://codeberg.org/calckey/calckey/raw/branch/develop/patrons.json", "https://codeberg.org/calckey/calckey/raw/branch/develop/patrons.json",
).then((response) => response.json()); )
.then((response) => response.json())
.catch(() => {
patrons = cachedPatrons ? JSON.parse(cachedPatrons) : [];
});
await redisClient.set("patrons", JSON.stringify(patrons), "EX", 3600); await redisClient.set("patrons", JSON.stringify(patrons), "EX", 3600);
} }

View file

@ -382,12 +382,17 @@ async function expireOldFile(user: IRemoteUser, driveCapacity: number) {
} }
//This selete is hard coded, be careful if change database schema //This selete is hard coded, be careful if change database schema
q.addSelect('SUM("file"."size") OVER (ORDER BY "file"."id" DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)', 'acc_usage'); q.addSelect(
'SUM("file"."size") OVER (ORDER BY "file"."id" DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)',
"acc_usage",
);
q.orderBy("file.id", "ASC"); q.orderBy("file.id", "ASC");
const fileList = await q.getRawMany(); const fileList = await q.getRawMany();
const exceedFileIds = fileList.filter((x: any) => x.acc_usage > driveCapacity).map((x: any) => x.file_id); const exceedFileIds = fileList
.filter((x: any) => x.acc_usage > driveCapacity)
.map((x: any) => x.file_id);
for (const fileId of exceedFileIds) { for (const fileId of exceedFileIds) {
const file = await DriveFiles.findOneBy({ id: fileId }); const file = await DriveFiles.findOneBy({ id: fileId });
@ -536,7 +541,7 @@ export async function addFile({
// (アバターまたはバナーを含まず)最も古いファイルを削除する // (アバターまたはバナーを含まず)最も古いファイルを削除する
expireOldFile( expireOldFile(
(await Users.findOneByOrFail({ id: user.id })) as IRemoteUser, (await Users.findOneByOrFail({ id: user.id })) as IRemoteUser,
driveCapacity - info.size driveCapacity - info.size,
); );
} }
} }

View file

@ -224,7 +224,12 @@
</div> </div>
</article> </article>
</div> </div>
<button v-else class="muted _button" @click="muted.muted = false" @contextmenu.stop.prevent> <button
v-else
class="muted _button"
@click="muted.muted = false"
@contextmenu.stop.prevent
>
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small"> <I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
<template #name> <template #name>
<MkA <MkA
@ -332,7 +337,9 @@ let appearNote = $computed(() =>
const isMyRenote = $i && $i.id === note.userId; const isMyRenote = $i && $i.id === note.userId;
const showContent = ref(false); const showContent = ref(false);
const isDeleted = ref(false); const isDeleted = ref(false);
const muted = ref(getWordSoftMute(appearNote, $i, defaultStore.state.mutedWords)); const muted = ref(
getWordSoftMute(appearNote, $i, defaultStore.state.mutedWords)
);
const translation = ref(null); const translation = ref(null);
const translating = ref(false); const translating = ref(false);
const enableEmojiReactions = defaultStore.state.enableEmojiReactions; const enableEmojiReactions = defaultStore.state.enableEmojiReactions;

View file

@ -5,11 +5,7 @@
> >
<!-- v-if="!fetching" for now, I think there's something <!-- v-if="!fetching" for now, I think there's something
weird w/ some links stuck loading (?) --> weird w/ some links stuck loading (?) -->
<article <article v-if="!fetching" class="url-preview" @click.stop>
v-if="!fetching"
class="url-preview"
@click.stop
>
<component <component
:is="self ? 'MkA' : 'a'" :is="self ? 'MkA' : 'a'"
:[attr]="self ? url.substring(local.length) : url" :[attr]="self ? url.substring(local.length) : url"
@ -17,30 +13,37 @@
:target="target" :target="target"
:title="url" :title="url"
:class="{ :class="{
hasButton: tweetId || player.url hasButton: tweetId || player.url,
}" }"
> >
<div <div v-if="thumbnail" class="thumbnail">
v-if="thumbnail"
class="thumbnail"
>
<img :src="thumbnail" loading="lazy" /> <img :src="thumbnail" loading="lazy" />
<button <button
v-if="tweetId" v-if="tweetId"
class="_button" class="_button"
v-tooltip="tweetExpanded ? i18n.ts.close : i18n.ts.expandTweet" v-tooltip="
tweetExpanded ? i18n.ts.close : i18n.ts.expandTweet
"
@click.stop.prevent="tweetExpanded = !tweetExpanded" @click.stop.prevent="tweetExpanded = !tweetExpanded"
> >
<i v-if="!tweetExpanded" class="ph-twitter-logo ph-bold ph-lg"></i> <i
v-if="!tweetExpanded"
class="ph-twitter-logo ph-bold ph-lg"
></i>
<i v-else class="ph-x ph-bold ph-lg"></i> <i v-else class="ph-x ph-bold ph-lg"></i>
</button> </button>
<button <button
v-else-if="player.url" v-else-if="player.url"
class="_button" class="_button"
v-tooltip="playerEnabled ? i18n.ts.close : i18n.ts.enablePlayer" v-tooltip="
playerEnabled ? i18n.ts.close : i18n.ts.enablePlayer
"
@click.stop.prevent="playerEnabled = !playerEnabled" @click.stop.prevent="playerEnabled = !playerEnabled"
> >
<i v-if="!playerEnabled" class="ph-play ph-bold ph-lg"></i> <i
v-if="!playerEnabled"
class="ph-play ph-bold ph-lg"
></i>
<i v-else class="ph-x ph-bold ph-lg"></i> <i v-else class="ph-x ph-bold ph-lg"></i>
</button> </button>
</div> </div>
@ -68,7 +71,9 @@
? '&autoplay=1&auto_play=1' ? '&autoplay=1&auto_play=1'
: '?autoplay=1&auto_play=1') : '?autoplay=1&auto_play=1')
" "
:style="`aspect-ratio: ${((player.width || 1) / (player.height || 1))}`" :style="`aspect-ratio: ${
(player.width || 1) / (player.height || 1)
}`"
frameborder="0" frameborder="0"
allow="autoplay; encrypted-media" allow="autoplay; encrypted-media"
allowfullscreen allowfullscreen
@ -190,7 +195,7 @@ onUnmounted(() => {
overflow: hidden; overflow: hidden;
> a { > a {
display: flex; display: flex;
transition: background .2s; transition: background 0.2s;
> div:first-child:not(:last-child) { > div:first-child:not(:last-child) {
position: relative; position: relative;
width: 90px; width: 90px;
@ -204,22 +209,22 @@ onUnmounted(() => {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
transition: opacity .2s; transition: opacity 0.2s;
} }
button { button {
display: flex; display: flex;
width: 100%; width: 100%;
height: 100%; height: 100%;
i { i {
background: var(--bg); background: var(--bg);
padding: 14px; padding: 14px;
border-radius: var(--radius); border-radius: var(--radius);
transform: scale(.95); transform: scale(0.95);
opacity: 0; opacity: 0;
transition: transform .2s, opacity .2s, background .2s; transition: transform 0.2s, opacity 0.2s, background 0.2s;
} }
&:hover, &:focus { &:hover,
&:focus {
i { i {
background: var(--panelHighlight) !important; background: var(--panelHighlight) !important;
transform: scale(1.1) !important; transform: scale(1.1) !important;
@ -232,7 +237,8 @@ onUnmounted(() => {
width: 0; width: 0;
flex-grow: 1; flex-grow: 1;
} }
h1, p { h1,
p {
display: block; display: block;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
@ -242,19 +248,19 @@ onUnmounted(() => {
h1 { h1 {
font-size: 1em; font-size: 1em;
white-space: nowrap; white-space: nowrap;
margin-bottom: .2em; margin-bottom: 0.2em;
} }
p { p {
margin-bottom: -.5em; margin-bottom: -0.5em;
> span { > span {
display: -webkit-inline-box; display: -webkit-inline-box;
font-size: .8em; font-size: 0.8em;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
overflow: hidden; overflow: hidden;
> span { > span {
font-weight: 600; font-weight: 600;
margin-right: .4em; margin-right: 0.4em;
} }
} }
} }
@ -264,18 +270,21 @@ onUnmounted(() => {
vertical-align: middle; vertical-align: middle;
border-radius: 4px; border-radius: 4px;
} }
&:hover, &:focus, &:focus-within { &:hover,
&:focus,
&:focus-within {
background: var(--panelHighlight); background: var(--panelHighlight);
h1 { h1 {
text-decoration: underline; text-decoration: underline;
} }
} }
} }
&:hover, &:focus-within { &:hover,
&:focus-within {
> .hasButton { > .hasButton {
> div:first-child { > div:first-child {
img { img {
opacity: .2; opacity: 0.2;
} }
button i { button i {
transform: none; transform: none;
@ -289,7 +298,8 @@ onUnmounted(() => {
display: block; display: block;
width: 100%; width: 100%;
overflow-y: auto; overflow-y: auto;
&:not([src^="https://platform.twitter"]) { &:not([src^="https://platform.twitter"])
{
max-height: 70vh; max-height: 70vh;
} }
} }

View file

@ -164,7 +164,7 @@ import { defaultStore } from "@/store";
import * as os from "@/os"; import * as os from "@/os";
import { definePageMetadata } from "@/scripts/page-metadata"; import { definePageMetadata } from "@/scripts/page-metadata";
const patrons = await os.api("patrons"); const patrons = await os.api("patrons", { forceUpdate: true });
let easterEggReady = false; let easterEggReady = false;
let easterEggEmojis = $ref([]); let easterEggEmojis = $ref([]);

View file

@ -56,6 +56,22 @@
"@riversidebryan@calckey.lgbt", "@riversidebryan@calckey.lgbt",
"@aRubes@sloth.run", "@aRubes@sloth.run",
"@andreasdotorg@calckey.social", "@andreasdotorg@calckey.social",
"@ozzy@calckey.online",
"@leni@windycity.style",
"@mhzmodels@calckey.art",
"@ReflexVE@calckey.social",
"@mark@calckey.social",
"@skyizwhite@himagine.club",
"@Uwu@calckey.social",
"@jGoose@calckey.social",
"@kunev@blewsky.social",
"@Simoto@electricrequiem.com",
"@Evoterra@calckey.social",
"@LauraLangdon@procial.tchncs.de",
"@mho@social.heise.de",
"@richardazia@calckey.social",
"@blues653@calckey.social",
"@rafale_blue@calc.04.si",
"\nInterkosmos Link" "\nInterkosmos Link"
] ]
} }