chore: 🎨 format

This commit is contained in:
ThatOneCalculator 2023-06-23 21:22:44 -07:00
parent 1fddd319c4
commit 2eea153ba1
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
20 changed files with 381 additions and 321 deletions

View File

@ -1,12 +1,12 @@
import { defineConfig } from 'cypress'
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:61812',
},
})
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require("./cypress/plugins/index.js")(on, config);
},
baseUrl: "http://localhost:61812",
},
});

View File

@ -1,4 +1,4 @@
describe('Before setup instance', () => {
describe("Before setup instance", () => {
beforeEach(() => {
cy.resetState();
});
@ -9,31 +9,31 @@ describe('Before setup instance', () => {
cy.wait(1000);
});
it('successfully loads', () => {
cy.visit('/');
});
it("successfully loads", () => {
cy.visit("/");
});
it('setup instance', () => {
cy.visit('/');
it("setup instance", () => {
cy.visit("/");
cy.intercept('POST', '/api/admin/accounts/create').as('signup');
cy.get('[data-cy-admin-username] input').type('admin');
cy.get('[data-cy-admin-password] input').type('admin1234');
cy.get('[data-cy-admin-ok]').click();
cy.intercept("POST", "/api/admin/accounts/create").as("signup");
cy.get("[data-cy-admin-username] input").type("admin");
cy.get("[data-cy-admin-password] input").type("admin1234");
cy.get("[data-cy-admin-ok]").click();
// なぜか動かない
//cy.wait('@signup').should('have.property', 'response.statusCode');
cy.wait('@signup');
});
cy.wait("@signup");
});
});
describe('After setup instance', () => {
describe("After setup instance", () => {
beforeEach(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser('admin', 'pass', true);
cy.registerUser("admin", "pass", true);
});
afterEach(() => {
@ -42,34 +42,34 @@ describe('After setup instance', () => {
cy.wait(1000);
});
it('successfully loads', () => {
cy.visit('/');
});
it("successfully loads", () => {
cy.visit("/");
});
it('signup', () => {
cy.visit('/');
it("signup", () => {
cy.visit("/");
cy.intercept('POST', '/api/signup').as('signup');
cy.intercept("POST", "/api/signup").as("signup");
cy.get('[data-cy-signup]').click();
cy.get('[data-cy-signup-username] input').type('alice');
cy.get('[data-cy-signup-password] input').type('alice1234');
cy.get('[data-cy-signup-password-retype] input').type('alice1234');
cy.get('[data-cy-signup-submit]').click();
cy.get("[data-cy-signup]").click();
cy.get("[data-cy-signup-username] input").type("alice");
cy.get("[data-cy-signup-password] input").type("alice1234");
cy.get("[data-cy-signup-password-retype] input").type("alice1234");
cy.get("[data-cy-signup-submit]").click();
cy.wait('@signup');
});
cy.wait("@signup");
});
});
describe('After user signup', () => {
describe("After user signup", () => {
beforeEach(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser('admin', 'pass', true);
cy.registerUser("admin", "pass", true);
// ユーザー作成
cy.registerUser('alice', 'alice1234');
cy.registerUser("alice", "alice1234");
});
afterEach(() => {
@ -78,51 +78,53 @@ describe('After user signup', () => {
cy.wait(1000);
});
it('successfully loads', () => {
cy.visit('/');
});
it("successfully loads", () => {
cy.visit("/");
});
it('signin', () => {
cy.visit('/');
it("signin", () => {
cy.visit("/");
cy.intercept('POST', '/api/signin').as('signin');
cy.intercept("POST", "/api/signin").as("signin");
cy.get('[data-cy-signin]').click();
cy.get('[data-cy-signin-username] input').type('alice');
cy.get("[data-cy-signin]").click();
cy.get("[data-cy-signin-username] input").type("alice");
// Enterキーでサインインできるかの確認も兼ねる
cy.get('[data-cy-signin-password] input').type('alice1234{enter}');
cy.get("[data-cy-signin-password] input").type("alice1234{enter}");
cy.wait('@signin');
});
cy.wait("@signin");
});
it('suspend', function() {
cy.request('POST', '/api/admin/suspend-user', {
it("suspend", function () {
cy.request("POST", "/api/admin/suspend-user", {
i: this.admin.token,
userId: this.alice.id,
});
cy.visit('/');
cy.visit("/");
cy.get('[data-cy-signin]').click();
cy.get('[data-cy-signin-username] input').type('alice');
cy.get('[data-cy-signin-password] input').type('alice1234{enter}');
cy.get("[data-cy-signin]").click();
cy.get("[data-cy-signin-username] input").type("alice");
cy.get("[data-cy-signin-password] input").type("alice1234{enter}");
// TODO: cypressにブラウザの言語指定できる機能が実装され次第英語のみテストするようにする
cy.contains(/アカウントが凍結されています|This account has been suspended due to/gi);
cy.contains(
/アカウントが凍結されています|This account has been suspended due to/gi,
);
});
});
describe('After user singed in', () => {
describe("After user singed in", () => {
beforeEach(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser('admin', 'pass', true);
cy.registerUser("admin", "pass", true);
// ユーザー作成
cy.registerUser('alice', 'alice1234');
cy.registerUser("alice", "alice1234");
cy.login('alice', 'alice1234');
cy.login("alice", "alice1234");
});
afterEach(() => {
@ -131,17 +133,17 @@ describe('After user singed in', () => {
cy.wait(1000);
});
it('successfully loads', () => {
cy.get('[data-cy-open-post-form]').should('be.visible');
});
it("successfully loads", () => {
cy.get("[data-cy-open-post-form]").should("be.visible");
});
it('note', () => {
cy.get('[data-cy-open-post-form]').click();
cy.get('[data-cy-post-form-text]').type('Hello, Misskey!');
cy.get('[data-cy-open-post-form-submit]').click();
it("note", () => {
cy.get("[data-cy-open-post-form]").click();
cy.get("[data-cy-post-form-text]").type("Hello, Misskey!");
cy.get("[data-cy-open-post-form-submit]").click();
cy.contains('Hello, Misskey!');
});
cy.contains("Hello, Misskey!");
});
});
// TODO: 投稿フォームの公開範囲指定のテスト

View File

@ -1,14 +1,14 @@
describe('After user signed in', () => {
describe("After user signed in", () => {
beforeEach(() => {
cy.resetState();
cy.viewport('macbook-16');
cy.viewport("macbook-16");
// インスタンス初期セットアップ
cy.registerUser('admin', 'pass', true);
cy.registerUser("admin", "pass", true);
// ユーザー作成
cy.registerUser('alice', 'alice1234');
cy.registerUser("alice", "alice1234");
cy.login('alice', 'alice1234');
cy.login("alice", "alice1234");
});
afterEach(() => {
@ -17,47 +17,47 @@ describe('After user signed in', () => {
cy.wait(1000);
});
it('widget edit toggle is visible', () => {
cy.get('.mk-widget-edit').should('be.visible');
});
it("widget edit toggle is visible", () => {
cy.get(".mk-widget-edit").should("be.visible");
});
it('widget select should be visible in edit mode', () => {
cy.get('.mk-widget-edit').click();
cy.get('.mk-widget-select').should('be.visible');
});
it("widget select should be visible in edit mode", () => {
cy.get(".mk-widget-edit").click();
cy.get(".mk-widget-select").should("be.visible");
});
it('first widget should be removed', () => {
cy.get('.mk-widget-edit').click();
cy.get('.customize-container:first-child .remove._button').click();
cy.get('.customize-container').should('have.length', 2);
it("first widget should be removed", () => {
cy.get(".mk-widget-edit").click();
cy.get(".customize-container:first-child .remove._button").click();
cy.get(".customize-container").should("have.length", 2);
});
function buildWidgetTest(widgetName) {
it(`${widgetName} widget should get added`, () => {
cy.get('.mk-widget-edit').click();
cy.get('.mk-widget-select select').select(widgetName, { force: true });
cy.get('.bg._modalBg.transparent').click({ multiple: true, force: true });
cy.get('.mk-widget-add').click({ force: true });
cy.get(`.mkw-${widgetName}`).should('exist');
cy.get(".mk-widget-edit").click();
cy.get(".mk-widget-select select").select(widgetName, { force: true });
cy.get(".bg._modalBg.transparent").click({ multiple: true, force: true });
cy.get(".mk-widget-add").click({ force: true });
cy.get(`.mkw-${widgetName}`).should("exist");
});
}
buildWidgetTest('memo');
buildWidgetTest('notifications');
buildWidgetTest('timeline');
buildWidgetTest('calendar');
buildWidgetTest('rss');
buildWidgetTest('trends');
buildWidgetTest('clock');
buildWidgetTest('activity');
buildWidgetTest('photos');
buildWidgetTest('digitalClock');
buildWidgetTest('federation');
buildWidgetTest('postForm');
buildWidgetTest('slideshow');
buildWidgetTest('serverMetric');
buildWidgetTest('onlineUsers');
buildWidgetTest('jobQueue');
buildWidgetTest('button');
buildWidgetTest('aiscript');
buildWidgetTest("memo");
buildWidgetTest("notifications");
buildWidgetTest("timeline");
buildWidgetTest("calendar");
buildWidgetTest("rss");
buildWidgetTest("trends");
buildWidgetTest("clock");
buildWidgetTest("activity");
buildWidgetTest("photos");
buildWidgetTest("digitalClock");
buildWidgetTest("federation");
buildWidgetTest("postForm");
buildWidgetTest("slideshow");
buildWidgetTest("serverMetric");
buildWidgetTest("onlineUsers");
buildWidgetTest("jobQueue");
buildWidgetTest("button");
buildWidgetTest("aiscript");
});

View File

@ -16,6 +16,6 @@
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};

View File

@ -24,32 +24,34 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Cypress.Commands.add('resetState', () => {
cy.window(win => {
win.indexedDB.deleteDatabase('keyval-store');
Cypress.Commands.add("resetState", () => {
cy.window((win) => {
win.indexedDB.deleteDatabase("keyval-store");
});
cy.request('POST', '/api/reset-db').as('reset');
cy.get('@reset').its('status').should('equal', 204);
cy.request("POST", "/api/reset-db").as("reset");
cy.get("@reset").its("status").should("equal", 204);
cy.reload(true);
});
Cypress.Commands.add('registerUser', (username, password, isAdmin = false) => {
const route = isAdmin ? '/api/admin/accounts/create' : '/api/signup';
Cypress.Commands.add("registerUser", (username, password, isAdmin = false) => {
const route = isAdmin ? "/api/admin/accounts/create" : "/api/signup";
cy.request('POST', route, {
cy.request("POST", route, {
username: username,
password: password,
}).its('body').as(username);
})
.its("body")
.as(username);
});
Cypress.Commands.add('login', (username, password) => {
cy.visit('/');
Cypress.Commands.add("login", (username, password) => {
cy.visit("/");
cy.intercept('POST', '/api/signin').as('signin');
cy.intercept("POST", "/api/signin").as("signin");
cy.get('[data-cy-signin]').click();
cy.get('[data-cy-signin-username] input').type(username);
cy.get('[data-cy-signin-password] input').type(`${password}{enter}`);
cy.get("[data-cy-signin]").click();
cy.get("[data-cy-signin-username] input").type(username);
cy.get("[data-cy-signin-password] input").type(`${password}{enter}`);
cy.wait('@signin').as('signedIn');
cy.wait("@signin").as("signedIn");
});

View File

@ -14,19 +14,21 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
import "./commands";
// Alternatively you can use CommonJS syntax:
// require('./commands')
Cypress.on('uncaught:exception', (err, runnable) => {
if ([
// Chrome
'ResizeObserver loop limit exceeded',
Cypress.on("uncaught:exception", (err, runnable) => {
if (
[
// Chrome
"ResizeObserver loop limit exceeded",
// Firefox
'ResizeObserver loop completed with undelivered notifications',
].some(msg => err.message.includes(msg))) {
// Firefox
"ResizeObserver loop completed with undelivered notifications",
].some((msg) => err.message.includes(msg))
) {
return false;
}
});

View File

@ -530,7 +530,7 @@ export default define(meta, paramDef, async (ps, user) => {
if (ps.cw !== note.cw || (ps.cw && !note.cw)) {
update.cw = ps.cw;
}
else if (!ps.cw && note.cw) {
if (!ps.cw && note.cw) {
update.cw = null;
}
if (ps.visibility !== note.visibility) {

View File

@ -468,7 +468,9 @@ export default async (
} else if (boostedByRelay && data.renote?.uri) {
// Use Redis transaction for atomicity
await redisClient.watch(`publishedNote:${data.renote.uri}`);
const exists = await redisClient.exists(`publishedNote:${data.renote.uri}`);
const exists = await redisClient.exists(
`publishedNote:${data.renote.uri}`,
);
if (exists === 0) {
// Start the transaction
const transaction = redisClient.multi();
@ -669,15 +671,15 @@ async function renderNoteOrRenoteActivity(data: Option, note: Note) {
const content =
data.renote &&
data.text == null &&
data.poll == null &&
(data.files == null || data.files.length === 0)
data.text == null &&
data.poll == null &&
(data.files == null || data.files.length === 0)
? renderAnnounce(
data.renote.uri
? data.renote.uri
: `${config.url}/notes/${data.renote.id}`,
note,
)
data.renote.uri
? data.renote.uri
: `${config.url}/notes/${data.renote.id}`,
note,
)
: renderCreate(await renderNote(note, false), note);
return renderActivity(content);

View File

@ -11,7 +11,7 @@
"api": "pnpm api-extractor run --local --verbose",
"api-prod": "pnpm api-extractor run --verbose",
"api-doc": "pnpm api-documenter markdown -i ./etc/",
"lint": "pnpm rome check --apply * && pnpm rome check --apply 'src/*.ts'",
"lint": "pnpm rome check --apply *.ts",
"format": "pnpm rome format --write '*' ; pnpm rome format --write '**/*.ts'",
"jest": "jest --coverage --detectOpenHandles",
"test": "pnpm jest && pnpm tsd"

View File

@ -65,7 +65,7 @@ export default defineComponent({
};
// const validEase = (e: string | null | undefined) => {
// if (e == null) return null;
// return e.match(/(steps)?\(-?[0-9.]+,-?[0-9.]+,-?[0-9.]+,-?[0-9.]+\)/)
// return e.match(/(steps)?\(-?[0-9.]+,-?[0-9.]+,-?[0-9.]+,-?[0-9.]+\)/)
// ? (e.startsWith("steps") ? e : "cubic-bezier" + e)
// : null
// }

View File

@ -6,7 +6,6 @@ import { isTouchUsing } from "@/scripts/touch";
import { popup, alert } from "@/os";
import { mainRouter } from "@/router";
const start = isTouchUsing ? "touchstart" : "mouseover";
const end = isTouchUsing ? "touchend" : "mouseleave";

View File

@ -22,7 +22,7 @@ const apiClient = new Misskey.api.APIClient({
export const api = ((
endpoint: string,
data: Record<string, any> = {},
token?: string | null | undefined
token?: string | null | undefined,
) => {
pendingApiRequestsCount.value++;
@ -36,16 +36,13 @@ export const api = ((
: undefined;
const promise = new Promise((resolve, reject) => {
fetch(
endpoint.indexOf("://") > -1 ? endpoint : `${apiUrl}/${endpoint}`,
{
method: "POST",
body: JSON.stringify(data),
credentials: "omit",
cache: "no-cache",
headers: authorization ? { authorization } : {},
}
)
fetch(endpoint.indexOf("://") > -1 ? endpoint : `${apiUrl}/${endpoint}`, {
method: "POST",
body: JSON.stringify(data),
credentials: "omit",
cache: "no-cache",
headers: authorization ? { authorization } : {},
})
.then(async (res) => {
const body = res.status === 204 ? null : await res.json();
@ -68,7 +65,7 @@ export const api = ((
export const apiGet = ((
endpoint: string,
data: Record<string, any> = {},
token?: string | null | undefined
token?: string | null | undefined,
) => {
pendingApiRequestsCount.value++;
@ -113,7 +110,7 @@ export const apiGet = ((
export const apiWithDialog = ((
endpoint: string,
data: Record<string, any> = {},
token?: string | null | undefined
token?: string | null | undefined,
) => {
const promise = api(endpoint, data, token);
promiseDialog(promise, null, (err) => {
@ -130,7 +127,7 @@ export function promiseDialog<T extends Promise<any>>(
promise: T,
onSuccess?: ((res: any) => void) | null,
onFailure?: ((err: Error) => void) | null,
text?: string
text?: string,
): T {
const showing = ref(true);
const success = ref(false);
@ -168,7 +165,7 @@ export function promiseDialog<T extends Promise<any>>(
text: text,
},
{},
"closed"
"closed",
);
return promise;
@ -189,7 +186,7 @@ const zIndexes = {
high: 3000000,
};
export function claimZIndex(
priority: "low" | "middle" | "high" = "low"
priority: "low" | "middle" | "high" = "low",
): number {
zIndexes[priority] += 100;
return zIndexes[priority];
@ -204,7 +201,7 @@ export async function popup(
component: Component,
props: Record<string, any>,
events = {},
disposeEvent?: string
disposeEvent?: string,
) {
markRaw(component);
@ -245,7 +242,7 @@ export function pageWindow(path: string) {
initialPath: path,
},
{},
"closed"
"closed",
);
}
@ -260,7 +257,7 @@ export function modalPageWindow(path: string) {
initialPath: path,
},
{},
"closed"
"closed",
);
}
@ -271,7 +268,7 @@ export function toast(message: string) {
message,
},
{},
"closed"
"closed",
);
}
@ -292,7 +289,7 @@ export function alert(props: {
resolve();
},
},
"closed"
"closed",
);
});
}
@ -316,7 +313,7 @@ export function confirm(props: {
resolve(result ? result : { canceled: true });
},
},
"closed"
"closed",
);
});
}
@ -343,7 +340,7 @@ export function yesno(props: {
resolve(result ? result : { canceled: true });
},
},
"closed"
"closed",
);
});
}
@ -384,7 +381,7 @@ export function inputText(props: {
resolve(result ? result : { canceled: true });
},
},
"closed"
"closed",
);
});
}
@ -422,7 +419,7 @@ export function inputParagraph(props: {
resolve(result ? result : { canceled: true });
},
},
"closed"
"closed",
);
});
}
@ -462,7 +459,7 @@ export function inputNumber(props: {
resolve(result ? result : { canceled: true });
},
},
"closed"
"closed",
);
});
}
@ -499,11 +496,11 @@ export function inputDate(props: {
result: new Date(result.result),
canceled: false,
}
: { canceled: true }
: { canceled: true },
);
},
},
"closed"
"closed",
);
});
}
@ -529,7 +526,7 @@ export function select<C = any>(
}[];
}[];
}
)
),
): Promise<
| { canceled: true; result: undefined }
| {
@ -554,7 +551,7 @@ export function select<C = any>(
resolve(result ? result : { canceled: true });
},
},
"closed"
"closed",
);
});
}
@ -574,7 +571,7 @@ export function success(): Promise<void> {
{
done: () => resolve(),
},
"closed"
"closed",
);
});
}
@ -591,7 +588,7 @@ export function waiting(): Promise<void> {
{
done: () => resolve(),
},
"closed"
"closed",
);
});
}
@ -610,7 +607,7 @@ export function form(title, form) {
resolve(result);
},
},
"closed"
"closed",
);
});
}
@ -629,7 +626,7 @@ export async function selectUser() {
resolve(user);
},
},
"closed"
"closed",
);
});
}
@ -648,7 +645,7 @@ export async function selectInstance(): Promise<Misskey.entities.Instance> {
resolve(instance);
},
},
"closed"
"closed",
);
});
}
@ -672,7 +669,7 @@ export async function selectDriveFile(multiple: boolean) {
}
},
},
"closed"
"closed",
);
});
}
@ -696,7 +693,7 @@ export async function selectDriveFolder(multiple: boolean) {
}
},
},
"closed"
"closed",
);
});
}
@ -718,7 +715,7 @@ export async function pickEmoji(src: HTMLElement | null, opts) {
resolve(emoji);
},
},
"closed"
"closed",
);
});
}
@ -727,7 +724,7 @@ export async function cropImage(
image: Misskey.entities.DriveFile,
options: {
aspectRatio: number;
}
},
): Promise<Misskey.entities.DriveFile> {
return new Promise((resolve, reject) => {
popup(
@ -745,7 +742,7 @@ export async function cropImage(
resolve(x);
},
},
"closed"
"closed",
);
});
}
@ -760,7 +757,7 @@ let activeTextarea: HTMLTextAreaElement | HTMLInputElement | null = null;
export async function openEmojiPicker(
src?: HTMLElement,
opts,
initialTextarea: typeof activeTextarea
initialTextarea: typeof activeTextarea,
) {
if (openingEmojiPicker) return;
@ -776,14 +773,13 @@ export async function openEmojiPicker(
const observer = new MutationObserver((records) => {
for (const record of records) {
for (const node of Array.from(record.addedNodes).filter(
(node) => node instanceof HTMLElement
(node) => node instanceof HTMLElement,
) as HTMLElement[]) {
const textareas = node.querySelectorAll("textarea, input");
for (const textarea of Array.from(textareas).filter(
(textarea) => textarea.dataset.preventEmojiInsert == null
(textarea) => textarea.dataset.preventEmojiInsert == null,
)) {
if (document.activeElement === textarea)
activeTextarea = textarea;
if (document.activeElement === textarea) activeTextarea = textarea;
textarea.addEventListener("focus", () => {
activeTextarea = textarea;
});
@ -821,7 +817,7 @@ export async function openEmojiPicker(
openingEmojiPicker = null;
observer.disconnect();
},
}
},
);
}
@ -833,7 +829,7 @@ export function popupMenu(
width?: number;
viaKeyboard?: boolean;
noReturnFocus?: boolean;
}
},
) {
return new Promise((resolve, reject) => {
let dispose;
@ -856,7 +852,7 @@ export function popupMenu(
resolve();
dispose();
},
}
},
).then((res) => {
dispose = res.dispose;
});
@ -865,7 +861,7 @@ export function popupMenu(
export function contextMenu(
items: MenuItem[] | Ref<MenuItem[]>,
ev: MouseEvent
ev: MouseEvent,
) {
ev.preventDefault();
return new Promise((resolve, reject) => {
@ -885,7 +881,7 @@ export function contextMenu(
resolve();
dispose();
},
}
},
).then((res) => {
dispose = res.dispose;
});

View File

@ -28,11 +28,11 @@ export const categoryMapping = {
"People & Body": "people",
"Animals & Nature": "animals_and_nature",
"Food & Drink": "food_and_drink",
"Activities": "activity",
Activities: "activity",
"Travel & Places": "travel_and_places",
"Objects": "objects",
"Symbols": "symbols",
"Flags": "flags",
Objects: "objects",
Symbols: "symbols",
Flags: "flags",
} as const;
export const unicodeEmojiSkinTones = [
@ -47,24 +47,39 @@ export const unicodeEmojiSkinTones = [
export function addSkinTone(emoji: string, skinTone?: number) {
const chosenSkinTone = skinTone || defaultStore.state.reactionPickerSkinTone;
const skinToneModifiers = [
"",
emojiComponents.light_skin_tone,
emojiComponents.medium_light_skin_tone,
emojiComponents.medium_skin_tone,
emojiComponents.medium_dark_skin_tone,
emojiComponents.dark_skin_tone
"",
emojiComponents.light_skin_tone,
emojiComponents.medium_light_skin_tone,
emojiComponents.medium_skin_tone,
emojiComponents.medium_dark_skin_tone,
emojiComponents.dark_skin_tone,
];
return emoji + (skinToneModifiers[chosenSkinTone - 1] || "");
}
const unicodeFifteenEmojis = [
'🫨', '🩷', '🩵', '🩶',
'🫷', '🫸', '🫎', '🫏',
'🪽', '🐦‍⬛', '🪿', '🪼',
'🪻', '🫚', '🫛', '🪭',
'🪮', '🪇', '🪈', '🪯',
'🛜'
]
"🫨",
"🩷",
"🩵",
"🩶",
"🫷",
"🫸",
"🫎",
"🫏",
"🪽",
"🐦‍⬛",
"🪿",
"🪼",
"🪻",
"🫚",
"🫛",
"🪭",
"🪮",
"🪇",
"🪈",
"🪯",
"🛜",
];
const newData = {};
@ -84,22 +99,26 @@ Object.keys(data).forEach((originalCategory) => {
}
});
export const emojilist: UnicodeEmojiDef[] = Object.keys(newData).reduce((acc, category) => {
const categoryItems = newData[category].map((item) => {
return {
emoji: item.emoji,
slug: item.slug,
category: item.category,
skin_tone_support: item.skin_tone_support || false,
keywords: item.keywords || [],
};
});
return acc.concat(categoryItems);
}, []);
export const emojilist: UnicodeEmojiDef[] = Object.keys(newData).reduce(
(acc, category) => {
const categoryItems = newData[category].map((item) => {
return {
emoji: item.emoji,
slug: item.slug,
category: item.category,
skin_tone_support: item.skin_tone_support || false,
keywords: item.keywords || [],
};
});
return acc.concat(categoryItems);
},
[],
);
export function getNicelyLabeledCategory(internalName) {
return Object.keys(categoryMapping).find(
(key) => categoryMapping[key] === internalName
) || internalName;
return (
Object.keys(categoryMapping).find(
(key) => categoryMapping[key] === internalName,
) || internalName
);
}

View File

@ -341,7 +341,7 @@ export function getNoteMenu(props: {
action: () => {
window.open(appearNote.url || appearNote.uri, "_blank");
},
}
}
: undefined,
{
type: "parent",
@ -358,19 +358,21 @@ export function getNoteMenu(props: {
text: i18n.ts.copyLink,
action: copyLink,
},
appearNote.url || appearNote.uri ? {
icon: "ph-link-simple ph-bold ph-lg",
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
action: copyOriginal,
} : undefined,
appearNote.url || appearNote.uri
? {
icon: "ph-link-simple ph-bold ph-lg",
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
action: copyOriginal,
}
: undefined,
shareAvailable()
? {
icon: "ph-share-network ph-bold ph-lg",
text: i18n.ts.share,
action: share,
}
: undefined,
]
? {
icon: "ph-share-network ph-bold ph-lg",
text: i18n.ts.share,
action: share,
}
: undefined,
],
},
/*
...($i.isModerator || $i.isAdmin ? [
@ -404,7 +406,7 @@ export function getNoteMenu(props: {
"closed",
);
},
}
}
: undefined,
instance.features.postEditing && isAppearAuthor
? {
@ -432,11 +434,12 @@ export function getNoteMenu(props: {
!isAppearAuthor ? null : undefined,
!isAppearAuthor
? {
type: "parent",
icon: "ph-user ph-bold ph-lg",
text: i18n.ts.user,
children: getUserMenu(appearNote.user)
} : undefined,
type: "parent",
icon: "ph-user ph-bold ph-lg",
text: i18n.ts.user,
children: getUserMenu(appearNote.user),
}
: undefined,
].filter((x) => x !== undefined);
} else {
menu = [
@ -459,18 +462,20 @@ export function getNoteMenu(props: {
text: i18n.ts.copyLink,
action: copyLink,
},
appearNote.url || appearNote.uri ? {
icon: "ph-link-simple ph-bold ph-lg",
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
action: copyOriginal,
} : undefined,
appearNote.url || appearNote.uri
? {
icon: "ph-link-simple ph-bold ph-lg",
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
action: copyOriginal,
}
: undefined,
shareAvailable()
? {
icon: "ph-share-network ph-bold ph-lg",
text: i18n.ts.share,
action: share,
}
: undefined,
? {
icon: "ph-share-network ph-bold ph-lg",
text: i18n.ts.share,
action: share,
}
: undefined,
].filter((x) => x !== undefined);
}

View File

@ -227,7 +227,9 @@ export function getUserMenu(user, router: Router = mainRouter) {
let menu = [
{
type: "label",
text: user.host ? `@${user.username}@${user.host || host}` : `@${user.username}`
text: user.host
? `@${user.username}@${user.host || host}`
: `@${user.username}`,
},
{
icon: "ph-at ph-bold ph-lg",

View File

@ -337,7 +337,7 @@ export const defaultStore = markRaw(
showTimelineReplies: {
where: "device",
default: true,
}
},
}),
);

View File

@ -8,16 +8,8 @@ console.log(themeColor("/ /__| (_| | | (__| < __/ |_| |"));
console.log(themeColor("\\____/\\__,_|_|\\___|_|\\_\\___|\\__, |"));
console.log(themeColor(" (___/ "));
console.log(" Currently building Calckey!");
console.log(
" Currently building Calckey!",
);
console.log(
chalk.rgb(
255,
136,
0,
)(
" Hang on for a moment, as this may take a while.",
),
chalk.rgb(255, 136, 0)(" Hang on for a moment, as this may take a while."),
);
console.log("");

View File

@ -1,30 +1,57 @@
const fs = require('node:fs');
const execa = require('execa');
const { join } = require('node:path');
const fs = require("node:fs");
const execa = require("execa");
const { join } = require("node:path");
(async () => {
fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/backend/node_modules'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/node_modules'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/client/node_modules'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/sw/node_modules'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../node_modules'), { recursive: true, force: true });
execa('pnpm', ['store', 'prune'], {
cwd: join(__dirname, '/../'),
stdio: 'inherit'
fs.rmSync(join(__dirname, "/../packages/backend/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/backend/node_modules"), {
recursive: true,
force: true,
});
execa('cargo', ['clean'], {
cwd: join(__dirname, '/../packages/backend/native-utils'),
stdio: 'inherit'
fs.rmSync(join(__dirname, "/../packages/backend/native-utils/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/backend/native-utils/node_modules"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/client/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/client/node_modules"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/sw/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/sw/node_modules"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../built"), { recursive: true, force: true });
fs.rmSync(join(__dirname, "/../node_modules"), {
recursive: true,
force: true,
});
execa("pnpm", ["store", "prune"], {
cwd: join(__dirname, "/../"),
stdio: "inherit",
});
execa("cargo", ["clean"], {
cwd: join(__dirname, "/../packages/backend/native-utils"),
stdio: "inherit",
});
})();

View File

@ -1,10 +1,22 @@
const fs = require('node:fs');
const { join } = require('node:path');
const fs = require("node:fs");
const { join } = require("node:path");
(async () => {
fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, "/../packages/backend/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/backend/native-utils/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/client/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../packages/sw/built"), {
recursive: true,
force: true,
});
fs.rmSync(join(__dirname, "/../built"), { recursive: true, force: true });
})();

View File

@ -1,45 +1,45 @@
const execa = require('execa');
const execa = require("execa");
(async () => {
await execa('pnpm', ['clean'], {
cwd: __dirname + '/../',
await execa("pnpm", ["clean"], {
cwd: __dirname + "/../",
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['dlx', 'gulp', 'watch'], {
cwd: __dirname + '/../',
execa("pnpm", ["dlx", "gulp", "watch"], {
cwd: __dirname + "/../",
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['--filter', 'backend', 'watch'], {
cwd: __dirname + '/../',
execa("pnpm", ["--filter", "backend", "watch"], {
cwd: __dirname + "/../",
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['--filter', 'client', 'watch'], {
cwd: __dirname + '/../',
execa("pnpm", ["--filter", "client", "watch"], {
cwd: __dirname + "/../",
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['--filter', 'sw', 'watch'], {
cwd: __dirname + '/../',
execa("pnpm", ["--filter", "sw", "watch"], {
cwd: __dirname + "/../",
stdout: process.stdout,
stderr: process.stderr,
});
const start = async () => {
try {
await execa('pnpm', ['start'], {
cwd: __dirname + '/../',
await execa("pnpm", ["start"], {
cwd: __dirname + "/../",
stdout: process.stdout,
stderr: process.stderr,
});
} catch (e) {
await new Promise(resolve => setTimeout(resolve, 3000));
await new Promise((resolve) => setTimeout(resolve, 3000));
start();
}
};