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
whyTOTPOnlyRenew: Laplicació dautenticació no es pot eliminar sempre que es hi
hagi una clau de seguretat registrada.
token: Token 2FA
_widgets:
notifications: "Notificacions"
timeline: "Línia de temps"

View File

@ -11,19 +11,25 @@ export const meta = {
export const paramDef = {
type: "object",
properties: {},
properties: {
forceUpdate: { type: "boolean", default: false },
},
required: [],
} as const;
export default define(meta, paramDef, async () => {
export default define(meta, paramDef, async (ps) => {
let patrons;
const cachedPatrons = await redisClient.get("patrons");
if (cachedPatrons) {
if (!ps.forceUpdate && cachedPatrons) {
patrons = JSON.parse(cachedPatrons);
} else {
patrons = await fetch(
"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);
}

View File

@ -382,12 +382,17 @@ async function expireOldFile(user: IRemoteUser, driveCapacity: number) {
}
//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");
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) {
const file = await DriveFiles.findOneBy({ id: fileId });
@ -536,7 +541,7 @@ export async function addFile({
// (アバターまたはバナーを含まず)最も古いファイルを削除する
expireOldFile(
(await Users.findOneByOrFail({ id: user.id })) as IRemoteUser,
driveCapacity - info.size
driveCapacity - info.size,
);
}
}

View File

@ -224,7 +224,12 @@
</div>
</article>
</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">
<template #name>
<MkA
@ -332,7 +337,9 @@ let appearNote = $computed(() =>
const isMyRenote = $i && $i.id === note.userId;
const showContent = 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 translating = ref(false);
const enableEmojiReactions = defaultStore.state.enableEmojiReactions;

View File

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

View File

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

View File

@ -56,6 +56,22 @@
"@riversidebryan@calckey.lgbt",
"@aRubes@sloth.run",
"@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"
]
}