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

This commit is contained in:
Freeplay 2023-06-08 14:16:06 -04:00
commit 63255b5641
11 changed files with 84 additions and 66 deletions

View File

@ -68,5 +68,5 @@ body:
options: options:
- label: I agree to follow this project's Contribution Guidelines - label: I agree to follow this project's Contribution Guidelines
required: true required: true
- label: I have searched the issue tracker for similar issues, and this is not a duplicate. - label: I have searched the issue tracker for similar issues, and this is not a duplicate.
required: true required: true

View File

@ -68,5 +68,5 @@ body:
options: options:
- label: I agree to follow this project's Contribution Guidelines - label: I agree to follow this project's Contribution Guidelines
required: true required: true
- label: I have searched the issue tracker for similar requests, and this is not a duplicate. - label: I have searched the issue tracker for similar requests, and this is not a duplicate.
required: true required: true

View File

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "14.0.0-dev44", "version": "14.0.0-dev46",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -15,10 +15,10 @@
"check:connect": "node ./check_connect.js", "check:connect": "node ./check_connect.js",
"build": "pnpm swc src -d built -D", "build": "pnpm swc src -d built -D",
"watch": "pnpm swc src -d built -D -w", "watch": "pnpm swc src -d built -D -w",
"lint": "pnpm rome check \"src/**/*.ts\"", "lint": "pnpm rome check --apply *",
"mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", "mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha",
"test": "pnpm run mocha", "test": "pnpm run mocha",
"format": "pnpm rome format * --write && pnpm rome check --apply *" "format": "pnpm rome format * --write"
}, },
"resolutions": { "resolutions": {
"chokidar": "^3.3.1" "chokidar": "^3.3.1"

View File

@ -3,7 +3,7 @@ import { Meta } from "@/models/entities/meta.js";
let cache: Meta; let cache: Meta;
export function metaToPugArgs(meta: Meta) : object { export function metaToPugArgs(meta: Meta): object {
let motd = ["Loading..."]; let motd = ["Loading..."];
if (meta.customMOTD.length > 0) { if (meta.customMOTD.length > 0) {
motd = meta.customMOTD; motd = meta.customMOTD;
@ -26,7 +26,7 @@ export function metaToPugArgs(meta: Meta) : object {
themeColor: meta.themeColor, themeColor: meta.themeColor,
randomMOTD: motd[Math.floor(Math.random() * motd.length)], randomMOTD: motd[Math.floor(Math.random() * motd.length)],
privateMode: meta.privateMode, privateMode: meta.privateMode,
} };
} }
export async function fetchMeta(noCache = false): Promise<Meta> { export async function fetchMeta(noCache = false): Promise<Meta> {

View File

@ -367,7 +367,7 @@ const userPage: Router.Middleware = async (ctx, next) => {
profile, profile,
me, me,
avatarUrl: await Users.getAvatarUrl(user), avatarUrl: await Users.getAvatarUrl(user),
sub: subParam sub: subParam,
}; };
await ctx.render("user", userDetail); await ctx.render("user", userDetail);
@ -446,7 +446,7 @@ router.get("/posts/:note", async (ctx, next) => {
await Users.findOneByOrFail({ id: note.userId }), await Users.findOneByOrFail({ id: note.userId }),
), ),
// TODO: Let locale changeable by instance setting // TODO: Let locale changeable by instance setting
summary: getNoteSummary(_note) summary: getNoteSummary(_note),
}); });
ctx.set("Cache-Control", "public, max-age=15"); ctx.set("Cache-Control", "public, max-age=15");
@ -482,7 +482,7 @@ router.get("/@:user/pages/:page", async (ctx, next) => {
profile, profile,
avatarUrl: await Users.getAvatarUrl( avatarUrl: await Users.getAvatarUrl(
await Users.findOneByOrFail({ id: page.userId }), await Users.findOneByOrFail({ id: page.userId }),
) ),
}); });
if (["public"].includes(page.visibility)) { if (["public"].includes(page.visibility)) {
@ -514,7 +514,7 @@ router.get("/clips/:clip", async (ctx, next) => {
profile, profile,
avatarUrl: await Users.getAvatarUrl( avatarUrl: await Users.getAvatarUrl(
await Users.findOneByOrFail({ id: clip.userId }), await Users.findOneByOrFail({ id: clip.userId }),
) ),
}); });
ctx.set("Cache-Control", "public, max-age=15"); ctx.set("Cache-Control", "public, max-age=15");
@ -539,7 +539,7 @@ router.get("/gallery/:post", async (ctx, next) => {
profile, profile,
avatarUrl: await Users.getAvatarUrl( avatarUrl: await Users.getAvatarUrl(
await Users.findOneByOrFail({ id: post.userId }), await Users.findOneByOrFail({ id: post.userId }),
) ),
}); });
ctx.set("Cache-Control", "public, max-age=15"); ctx.set("Cache-Control", "public, max-age=15");
@ -561,7 +561,7 @@ router.get("/channels/:channel", async (ctx, next) => {
const meta = await fetchMeta(); const meta = await fetchMeta();
await ctx.render("channel", { await ctx.render("channel", {
...metaToPugArgs(meta), ...metaToPugArgs(meta),
channel: _channel channel: _channel,
}); });
ctx.set("Cache-Control", "public, max-age=15"); ctx.set("Cache-Control", "public, max-age=15");
@ -612,9 +612,9 @@ router.get("/api/v1/streaming", async (ctx) => {
// Render base html for all requests // Render base html for all requests
router.get("(.*)", async (ctx) => { router.get("(.*)", async (ctx) => {
const meta = await fetchMeta(); const meta = await fetchMeta();
await ctx.render("base", { await ctx.render("base", {
...metaToPugArgs(meta) ...metaToPugArgs(meta),
}); });
ctx.set("Cache-Control", "public, max-age=3"); ctx.set("Cache-Control", "public, max-age=3");
}); });

View File

@ -102,7 +102,7 @@ function isMe(message): boolean {
opacity: 0.8; opacity: 0.8;
} }
&:not(.isMe):not(.isRead) { &:not(.isRead) {
background-color: var(--accentedBg); background-color: var(--accentedBg);
} }
@ -175,13 +175,6 @@ function isMe(message): boolean {
&.max-width_400px { &.max-width_400px {
> .message { > .message {
&:not(.isMe):not(.isRead) {
> div {
background-image: none;
border-left: solid 4px #3aa2dc;
}
}
> div { > div {
padding: 16px; padding: 16px;
font-size: 0.9em; font-size: 0.9em;

View File

@ -128,7 +128,11 @@
<button <button
v-else-if="!item.hidden" v-else-if="!item.hidden"
class="_button item" class="_button item"
:class="{ danger: item.danger, active: item.active }" :class="{
danger: item.danger,
accent: item.accent,
active: item.active,
}"
:disabled="item.active" :disabled="item.active"
@click="clicked(item.action, $event)" @click="clicked(item.action, $event)"
@mouseenter.passive="onItemMouseEnter(item)" @mouseenter.passive="onItemMouseEnter(item)"
@ -398,6 +402,26 @@ onBeforeUnmount(() => {
} }
} }
&.accent {
color: var(--accent);
&:hover {
color: var(--accent);
&:before {
background: var(--accentedBg);
}
}
&:active {
color: var(--fgOnAccent);
&:before {
background: var(--accent);
}
}
}
&.active { &.active {
color: var(--fgOnAccent); color: var(--fgOnAccent);
opacity: 1; opacity: 1;

View File

@ -14,7 +14,10 @@
:title="i18n.ts.delete" :title="i18n.ts.delete"
@click="del" @click="del"
> >
<i style="color: var(--accentLighten)" class="ph-x-circle ph-fill ph-lg"></i> <i
style="color: var(--accentLighten)"
class="ph-x-circle ph-fill ph-lg"
></i>
</button> </button>
<div v-if="!message.isDeleted" class="content"> <div v-if="!message.isDeleted" class="content">
<Mfm <Mfm

View File

@ -262,13 +262,6 @@ export function getNoteMenu(props: {
null, null,
] ]
: []), : []),
instance.features.postEditing && isAppearAuthor
? {
icon: "ph-pencil-line ph-bold ph-lg",
text: i18n.ts.edit,
action: edit,
}
: undefined,
{ {
icon: "ph-clipboard-text ph-bold ph-lg", icon: "ph-clipboard-text ph-bold ph-lg",
text: i18n.ts.copyContent, text: i18n.ts.copyContent,
@ -372,33 +365,45 @@ export function getNoteMenu(props: {
}] }]
: [] : []
),*/ ),*/
...(!isAppearAuthor null,
? [ !isAppearAuthor
null, ? {
{ icon: "ph-warning-circle ph-bold ph-lg",
icon: "ph-warning-circle ph-bold ph-lg", text: i18n.ts.reportAbuse,
text: i18n.ts.reportAbuse, action: () => {
action: () => { const u =
const u = appearNote.url ||
appearNote.url || appearNote.uri ||
appearNote.uri || `${url}/notes/${appearNote.id}`;
`${url}/notes/${appearNote.id}`; os.popup(
os.popup( defineAsyncComponent(
defineAsyncComponent( () => import("@/components/MkAbuseReportWindow.vue"),
() => import("@/components/MkAbuseReportWindow.vue"), ),
), {
{ user: appearNote.user,
user: appearNote.user, initialComment: `Note: ${u}\n-----\n`,
initialComment: `Note: ${u}\n-----\n`, },
}, {},
{}, "closed",
"closed", );
);
},
}, },
] }
: []), : undefined,
instance.features.postEditing && isAppearAuthor
? {
icon: "ph-pencil-line ph-bold ph-lg",
text: i18n.ts.edit,
accent: true,
action: edit,
}
: undefined,
isAppearAuthor
? {
icon: "ph-eraser ph-bold ph-lg",
text: i18n.ts.deleteAndEdit,
action: delEdit,
}
: undefined,
isAppearAuthor || isModerator isAppearAuthor || isModerator
? { ? {
icon: "ph-trash ph-bold ph-lg", icon: "ph-trash ph-bold ph-lg",
@ -407,14 +412,6 @@ export function getNoteMenu(props: {
action: del, action: del,
} }
: undefined, : undefined,
isAppearAuthor
? {
icon: "ph-eraser ph-bold ph-lg",
text: i18n.ts.deleteAndEdit,
action: delEdit,
}
: undefined,
].filter((x) => x !== undefined); ].filter((x) => x !== undefined);
} else { } else {
menu = [ menu = [

View File

@ -51,6 +51,7 @@ export type MenuButton = {
icon?: string; icon?: string;
indicate?: boolean; indicate?: boolean;
danger?: boolean; danger?: boolean;
accent?: boolean;
active?: boolean; active?: boolean;
hidden?: boolean; hidden?: boolean;
avatar?: Misskey.entities.User; avatar?: Misskey.entities.User;