Compare commits

...

4 Commits

135 changed files with 2902 additions and 150 deletions

49
.pnp.cjs generated
View File

@ -3239,6 +3239,30 @@ const RAW_RUNTIME_STATE =
"linkType": "HARD"\
}]\
]],\
["@rollup/plugin-replace", [\
["npm:5.0.5", {\
"packageLocation": "./.yarn/cache/@rollup-plugin-replace-npm-5.0.5-42f61be6e8-bcf106346f.zip/node_modules/@rollup/plugin-replace/",\
"packageDependencies": [\
["@rollup/plugin-replace", "npm:5.0.5"]\
],\
"linkType": "SOFT"\
}],\
["virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:5.0.5", {\
"packageLocation": "./.yarn/__virtual__/@rollup-plugin-replace-virtual-bb6943b0cc/0/cache/@rollup-plugin-replace-npm-5.0.5-42f61be6e8-bcf106346f.zip/node_modules/@rollup/plugin-replace/",\
"packageDependencies": [\
["@rollup/plugin-replace", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:5.0.5"],\
["@rollup/pluginutils", "virtual:bb6943b0cca2c422f7a7afd65919f64a13f4e8693f7906299796ebe01591897f1a7622cbd9bd4db684f8c6acc1f55e4a4d48e34b460bcd763b5121a2b479f420#npm:5.1.0"],\
["@types/rollup", null],\
["magic-string", "npm:0.30.5"],\
["rollup", "npm:3.26.2"]\
],\
"packagePeers": [\
"@types/rollup",\
"rollup"\
],\
"linkType": "HARD"\
}]\
]],\
["@rollup/pluginutils", [\
["npm:3.1.0", {\
"packageLocation": "./.yarn/cache/@rollup-pluginutils-npm-3.1.0-b44b222e7d-3b69f02893.zip/node_modules/@rollup/pluginutils/",\
@ -3256,6 +3280,29 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "HARD"\
}],\
["npm:5.1.0", {\
"packageLocation": "./.yarn/cache/@rollup-pluginutils-npm-5.1.0-6939820ef8-abb15eaec5.zip/node_modules/@rollup/pluginutils/",\
"packageDependencies": [\
["@rollup/pluginutils", "npm:5.1.0"]\
],\
"linkType": "SOFT"\
}],\
["virtual:bb6943b0cca2c422f7a7afd65919f64a13f4e8693f7906299796ebe01591897f1a7622cbd9bd4db684f8c6acc1f55e4a4d48e34b460bcd763b5121a2b479f420#npm:5.1.0", {\
"packageLocation": "./.yarn/__virtual__/@rollup-pluginutils-virtual-2c209a0117/0/cache/@rollup-pluginutils-npm-5.1.0-6939820ef8-abb15eaec5.zip/node_modules/@rollup/pluginutils/",\
"packageDependencies": [\
["@rollup/pluginutils", "virtual:bb6943b0cca2c422f7a7afd65919f64a13f4e8693f7906299796ebe01591897f1a7622cbd9bd4db684f8c6acc1f55e4a4d48e34b460bcd763b5121a2b479f420#npm:5.1.0"],\
["@types/estree", "npm:1.0.1"],\
["@types/rollup", null],\
["estree-walker", "npm:2.0.2"],\
["picomatch", "npm:2.3.1"],\
["rollup", "npm:3.26.2"]\
],\
"packagePeers": [\
"@types/rollup",\
"rollup"\
],\
"linkType": "HARD"\
}],\
["virtual:cf1428485ac6d7495e234c120f3000a61db869813c88397f285b8f9691f2488035a4fa06e3d208d181d90d55925c550cd96d3b139f098a04a0ef06802bcb7775#npm:3.1.0", {\
"packageLocation": "./.yarn/__virtual__/@rollup-pluginutils-virtual-228ea72560/0/cache/@rollup-pluginutils-npm-3.1.0-b44b222e7d-3b69f02893.zip/node_modules/@rollup/pluginutils/",\
"packageDependencies": [\
@ -8537,6 +8584,7 @@ const RAW_RUNTIME_STATE =
["@phosphor-icons/web", "npm:2.0.3"],\
["@rollup/plugin-alias", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:3.1.9"],\
["@rollup/plugin-json", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:4.1.0"],\
["@rollup/plugin-replace", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:5.0.5"],\
["@rollup/pluginutils", "npm:4.2.1"],\
["@syuilo/aiscript", "npm:0.11.1"],\
["@types/escape-regexp", "npm:0.0.1"],\
@ -8592,6 +8640,7 @@ const RAW_RUNTIME_STATE =
["prismjs", "npm:1.29.0"],\
["punycode", "npm:2.3.0"],\
["querystring", "npm:0.2.1"],\
["reconnecting-websocket", "npm:4.4.0"],\
["rndstr", "npm:1.0.0"],\
["rollup", "npm:3.26.2"],\
["s-age", "npm:1.1.2"],\

BIN
.yarn/cache/@rollup-plugin-replace-npm-5.0.5-42f61be6e8-bcf106346f.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
.yarn/cache/@rollup-pluginutils-npm-5.1.0-6939820ef8-abb15eaec5.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -8,7 +8,7 @@ const replace = require("gulp-replace");
const terser = require("gulp-terser");
const cssnano = require("gulp-cssnano");
const locales = require("./locales");
const locales = require("./locales/legacy.cjs");
const meta = require("./package.json");
const customDir = process.env.ICESHRIMP_CUSTOM_DIR ?? "./custom";

View File

@ -2,8 +2,8 @@
* Languages Loader
*/
const fs = require("fs");
const yaml = require("js-yaml");
import * as fs from 'node:fs';
import * as yaml from 'js-yaml';
const languages = [];
const languages_custom = [];
const customDir = process.env.ICESHRIMP_CUSTOM_DIR ?? __dirname + "/../custom";

88
locales/legacy.cjs Normal file
View File

@ -0,0 +1,88 @@
/**
* Languages Loader
*/
const fs = require("fs");
const yaml = require("js-yaml");
const languages = [];
const languages_custom = [];
const customDir = process.env.ICESHRIMP_CUSTOM_DIR ?? __dirname + "/../custom";
const merge = (...args) =>
args.reduce(
(a, c) => ({
...a,
...c,
...Object.entries(a)
.filter(([k]) => c && typeof c[k] === "object")
.reduce((a, [k, v]) => ((a[k] = merge(v, c[k])), a), {}),
}),
{},
);
fs.readdirSync(__dirname).forEach((file) => {
if (file.includes(".yml")) {
file = file.slice(0, file.indexOf("."));
languages.push(file);
}
});
fs.readdirSync(`${customDir}/locales`).forEach((file) => {
if (file.includes(".yml")) {
file = file.slice(0, file.indexOf("."));
languages_custom.push(file);
}
});
const primaries = {
en: "US",
ja: "JP",
zh: "CN",
};
// 何故か文字列にバックスペース文字が混入することがあり、YAMLが壊れるので取り除く
const clean = (text) =>
text.replace(new RegExp(String.fromCodePoint(0x08), "g"), "");
const locales = languages.reduce(
(a, c) => (
(a[c] =
yaml.load(clean(fs.readFileSync(`${__dirname}/${c}.yml`, "utf-8"))) ||
{}),
a
),
{},
);
const locales_custom = languages_custom.reduce(
(a, c) => (
(a[c] =
yaml.load(
clean(
fs.readFileSync(`${customDir}/locales/${c}.yml`, "utf-8"),
),
) || {}),
a
),
{},
);
Object.assign(locales, locales_custom);
module.exports = Object.entries(locales).reduce(
(a, [k, v]) => (
(a[k] = (() => {
const [lang] = k.split("-");
switch (k) {
case "en-US":
return v;
default:
return merge(
locales["en-US"],
locales[`${lang}-${primaries[lang]}`] || {},
v,
);
}
})()),
a
),
{},
);

View File

@ -9,6 +9,7 @@
"lint:vue": "paralint --ext .vue --fix '**/*.vue' --cache",
"format": "biome format * --write && prettier --write '**/*.{scss,vue}' --cache --cache-strategy metadata"
},
"type": "module",
"devDependencies": {
"@discordapp/twemoji": "14.1.2",
"@eslint-sets/eslint-config-vue3": "^5.6.1",
@ -16,6 +17,7 @@
"@phosphor-icons/web": "^2.0.3",
"@rollup/plugin-alias": "3.1.9",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/pluginutils": "^4.2.1",
"@syuilo/aiscript": "0.11.1",
"@types/escape-regexp": "0.0.1",
@ -56,7 +58,6 @@
"focus-trap": "^7.5.2",
"focus-trap-vue": "^4.0.2",
"gsap": "^3.12.2",
"iceshrimp-js": "workspace:*",
"idb-keyval": "6.2.1",
"insert-text-at-cursor": "0.3.0",
"json5": "2.2.3",
@ -102,6 +103,7 @@
},
"dependencies": {
"@babel/core": "^7.23.2",
"eslint": "^8.45.0"
"eslint": "^8.45.0",
"reconnecting-websocket": "^4.4.0"
}
}

View File

@ -1,5 +1,5 @@
import { defineAsyncComponent, reactive } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import { i18n } from "./i18n";
import { del, get, set } from "@/scripts/idb-proxy";
import { apiUrl } from "@/config";

View File

@ -41,7 +41,7 @@
<script setup lang="ts">
import { ref } from "vue";
import type * as Misskey from "iceshrimp-js";
import type * as Misskey from "@/iceshrimp-js";
import XWindow from "@/components/MkWindow.vue";
import MkTextarea from "@/components/form/textarea.vue";
import MkButton from "@/components/MkButton.vue";

View File

@ -102,7 +102,7 @@ import { defaultStore } from "@/store";
import { addSkinTone, emojilist } from "@/scripts/emojilist";
import { instance } from "@/instance";
import { i18n } from "@/i18n";
import * as Acct from "iceshrimp-js/built/acct";
import { Acct } from "@/iceshrimp-js";
interface EmojiDef {
emoji: string;

View File

@ -63,7 +63,7 @@
</template>
<script lang="ts" setup>
import * as Acct from "iceshrimp-js/built/acct";
import { Acct } from "@/iceshrimp-js";
import { i18n } from "@/i18n";
import { acct } from "@/filters/user";
import { $i } from "@/account";

View File

@ -37,7 +37,7 @@
<script lang="ts" setup>
import { nextTick, onMounted } from "vue";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import Cropper from "cropperjs";
import tinycolor from "tinycolor2";
import XModalWindow from "@/components/MkModalWindow.vue";

View File

@ -15,7 +15,7 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import { length } from "stringz";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import { concat } from "@/scripts/array";
import { i18n } from "@/i18n";
import {defaultStore} from "@/store";
@ -82,7 +82,7 @@ defineExpose({
transition:
background 0.2s,
color 0.2s;
> span {
font-weight: 500;
&::before {

View File

@ -39,7 +39,7 @@
<script lang="ts" setup>
import { computed, defineAsyncComponent, ref } from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import copyToClipboard from "@/scripts/copy-to-clipboard";
import MkDriveFileThumbnail from "@/components/MkDriveFileThumbnail.vue";
import bytes from "@/filters/bytes";

View File

@ -38,7 +38,7 @@
<script lang="ts" setup>
import { computed, defineAsyncComponent, ref } from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import * as os from "@/os";
import { i18n } from "@/i18n";
import { defaultStore } from "@/store";

View File

@ -15,7 +15,7 @@
<script lang="ts" setup>
import { ref } from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import * as os from "@/os";
import { i18n } from "@/i18n";

View File

@ -140,7 +140,7 @@ import {
ref,
watch,
} from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import MkButton from "./MkButton.vue";
import XNavFolder from "@/components/MkDrive.navFolder.vue";
import XFolder from "@/components/MkDrive.folder.vue";

View File

@ -41,7 +41,7 @@
<script lang="ts" setup>
import { computed } from "vue";
import type * as Misskey from "iceshrimp-js";
import type * as Misskey from "@/iceshrimp-js";
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
const props = defineProps<{

View File

@ -37,7 +37,7 @@
<script lang="ts" setup>
import { ref } from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import XDrive from "@/components/MkDrive.vue";
import XModalWindow from "@/components/MkModalWindow.vue";
import number from "@/filters/number";

View File

@ -15,7 +15,7 @@
<script lang="ts" setup>
import {} from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import XDrive from "@/components/MkDrive.vue";
import XWindow from "@/components/MkWindow.vue";
import { i18n } from "@/i18n";

View File

@ -164,7 +164,7 @@
<script lang="ts" setup>
import { ref, computed, watch, onMounted } from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import XSection from "@/components/MkEmojiPicker.section.vue";
import {
emojilist,

View File

@ -8,7 +8,7 @@
<script lang="ts" setup>
import { ref } from "vue";
import * as Misskey from "iceshrimp-js";
import * as Misskey from "@/iceshrimp-js";
import * as os from "@/os";
const meta = ref<Misskey.entities.DetailedInstanceMetadata>();

View File

@ -53,8 +53,7 @@
<script lang="ts" setup>
import { computed } from "vue";
import * as Acct from "iceshrimp-js/built/acct";
import MkSwitch from "@/components/ui/switch.vue";
import { Acct } from "@/iceshrimp-js";
import MkPagination from "@/components/MkPagination.vue";
import MkDriveFileThumbnail from "@/components/MkDriveFileThumbnail.vue";
import bytes from "@/filters/bytes";

View File

@ -62,7 +62,7 @@
<script lang="ts" setup>
import { computed, onBeforeUnmount, onMounted } from "vue";
import type * as Misskey from "iceshrimp-js";
import type * as Misskey from "@/iceshrimp-js";
import * as os from "@/os";
import { stream } from "@/stream";
import { i18n } from "@/i18n";

View File

@ -27,7 +27,7 @@
<script lang="ts" setup>
import {} from "vue";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import bytes from "@/filters/bytes";
import number from "@/filters/number";
import MkModal from "@/components/MkModal.vue";

View File

@ -24,7 +24,7 @@
</template>
<script lang="ts" setup>
import * as iceshrimp from "iceshrimp-js";
import * as iceshrimp from "@/iceshrimp-js";
import MkMiniChart from "@/components/MkMiniChart.vue";
import * as os from "@/os";
import { getProxiedImageUrlNullable } from "@/scripts/media-proxy";

View File

@ -60,7 +60,7 @@ import MkInput from "@/components/form/input.vue";
import XModalWindow from "@/components/MkModalWindow.vue";
import * as os from "@/os";
import { i18n } from "@/i18n";
import { Instance } from "iceshrimp-js/built/entities";
import { Instance } from "@/iceshrimp-js/entities";
const emit = defineEmits<{
(ev: "ok", selected: Instance): void;

View File

@ -90,7 +90,7 @@
import { watch, ref, computed } from "vue";
import VuePlyr from "vue-plyr";
import "vue-plyr/dist/vue-plyr.css";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
import { defaultStore } from "@/store";

View File

@ -58,7 +58,7 @@
<script lang="ts" setup>
import { onMounted } from "vue";
import VuePlyr from "vue-plyr";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import { ColdDeviceStorage } from "@/store";
import "vue-plyr/dist/vue-plyr.css";
import { i18n } from "@/i18n";

View File

@ -29,7 +29,7 @@
<script lang="ts" setup>
import { onMounted, ref } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import PhotoSwipeLightbox from "photoswipe/lightbox";
import PhotoSwipe from "photoswipe";
import "photoswipe/style.css";

View File

@ -260,7 +260,7 @@
import { computed, inject, onMounted, onUnmounted, reactive, ref } from "vue";
import * as mfm from "mfm-js";
import type { Ref } from "vue";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import MkNoteSub from "@/components/MkNoteSub.vue";
import MkSubNoteContent from "./MkSubNoteContent.vue";
import XNoteHeader from "@/components/MkNoteHeader.vue";

View File

@ -164,7 +164,7 @@ import {
reactive,
ref,
} from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkTab from "@/components/MkTab.vue";
import MkNote from "@/components/MkNote.vue";
import MkNoteSub from "@/components/MkNoteSub.vue";
@ -185,7 +185,7 @@ import { getNoteMenu } from "@/scripts/get-note-menu";
import { useNoteCapture } from "@/scripts/use-note-capture";
import { deepClone } from "@/scripts/clone";
import { stream } from "@/stream";
import { NoteUpdatedEvent } from "iceshrimp-js/src/streaming.types";
import { NoteUpdatedEvent } from "@/iceshrimp-js/streaming.types";
import appear from "@/directives/appear";
const props = defineProps<{

View File

@ -48,7 +48,7 @@
<script lang="ts" setup>
import {} from "vue";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import { defaultStore, noteViewInterruptors } from "@/store";
import MkVisibility from "@/components/MkVisibility.vue";
import MkInstanceTicker from "@/components/MkInstanceTicker.vue";

View File

@ -12,7 +12,7 @@
<script lang="ts" setup>
import {} from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import XNoteHeader from "@/components/MkNoteHeader.vue";
import MkSubNoteContent from "@/components/MkSubNoteContent.vue";

View File

@ -181,7 +181,7 @@
<script lang="ts" setup>
import { inject, ref } from "vue";
import type { Ref } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import XNoteHeader from "@/components/MkNoteHeader.vue";
import MkSubNoteContent from "@/components/MkSubNoteContent.vue";
import XReactionsViewer from "@/components/MkReactionsViewer.vue";

View File

@ -274,7 +274,7 @@
<script lang="ts" setup>
import { ref, onMounted, onUnmounted, watch } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import XReactionIcon from "@/components/MkReactionIcon.vue";
import MkFollowButton from "@/components/MkFollowButton.vue";
import XReactionTooltip from "@/components/MkReactionTooltip.vue";

View File

@ -41,7 +41,7 @@
<script lang="ts" setup>
import {} from "vue";
import { notificationTypes } from "iceshrimp-js";
import { notificationTypes } from "@/iceshrimp-js";
import MkSwitch from "./form/switch.vue";
import MkInfo from "./MkInfo.vue";
import MkButton from "./MkButton.vue";

View File

@ -54,7 +54,7 @@ import {
computed,
ref,
} from "vue";
import { notificationTypes } from "iceshrimp-js";
import { notificationTypes } from "@/iceshrimp-js";
import MkPagination, { Paging } from "@/components/MkPagination.vue";
import XNotification from "@/components/MkNotification.vue";
import XList from "@/components/MkDateSeparatedList.vue";

View File

@ -72,7 +72,7 @@ import {
ref,
watch,
} from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import * as os from "@/os";
import {
onScrollTop,

View File

@ -53,7 +53,7 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import { sum } from "@/scripts/array";
import { pleaseLogin } from "@/scripts/please-login";
import * as os from "@/os";

View File

@ -235,11 +235,11 @@
<script lang="ts" setup>
import { inject, watch, nextTick, onMounted, defineAsyncComponent } from "vue";
import * as mfm from "mfm-js";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import insertTextAtCursor from "insert-text-at-cursor";
import { length } from "stringz";
import { toASCII } from "punycode/";
import * as Acct from "iceshrimp-js/built/acct";
import { Acct } from "@/iceshrimp-js"
import { throttle } from "throttle-debounce";
import XNoteSimple from "@/components/MkNoteSimple.vue";
import XNotePreview from "@/components/MkNotePreview.vue";

View File

@ -20,7 +20,7 @@
<script lang="ts" setup>
import {} from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkModal from "@/components/MkModal.vue";
import MkPostForm from "@/components/MkPostForm.vue";

View File

@ -11,7 +11,7 @@
<script lang="ts" setup>
import { computed } from "vue";
import type { Note } from "iceshrimp-js/built/entities";
import type { Note } from "@/iceshrimp-js/entities";
import { pleaseLogin } from "@/scripts/please-login";
import * as os from "@/os";
import { $i } from "@/account";

View File

@ -36,7 +36,7 @@
<script lang="ts" setup>
import { onMounted, watch } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkReactionIcon from "@/components/MkReactionIcon.vue";
import MkUserCardMini from "@/components/MkUserCardMini.vue";
import { i18n } from "@/i18n";

View File

@ -22,7 +22,7 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import XDetails from "@/components/MkReactionsViewer.details.vue";
import XReactionIcon from "@/components/MkReactionIcon.vue";
import * as os from "@/os";

View File

@ -18,7 +18,7 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import { $i } from "@/account";
import XReaction from "@/components/MkReactionsViewer.reaction.vue";

View File

@ -22,7 +22,7 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import Ripple from "@/components/MkRipple.vue";
import XDetails from "@/components/MkUsersTooltip.vue";
import { pleaseLogin } from "@/scripts/please-login";

View File

@ -4,7 +4,7 @@ import MkInput from "@/components/form/input.vue";
import * as os from "@/os.js";
import XSearchFilterDialog from "@/components/MkSearchFilterDialog.vue";
import { onActivated, onMounted, onUnmounted, ref, toRefs } from "vue";
import * as Acct from "iceshrimp-js/built/acct";
import { Acct } from "@/iceshrimp-js"
const props = defineProps<{
query: string;

View File

@ -38,7 +38,7 @@
</template>
<script lang="ts" setup>
import type { Note } from "iceshrimp-js/built/entities";
import type { Note } from "@/iceshrimp-js/entities";
import Ripple from "@/components/MkRipple.vue";
import { pleaseLogin } from "@/scripts/please-login";
import * as os from "@/os";

View File

@ -42,7 +42,7 @@
<script lang="ts" setup>
import { ref } from "vue";
import type { Note } from "iceshrimp-js/built/entities";
import type { Note } from "@/iceshrimp-js/entities";
import Ripple from "@/components/MkRipple.vue";
import XDetails from "@/components/MkUsersTooltip.vue";
import { pleaseLogin } from "@/scripts/please-login";

View File

@ -202,7 +202,7 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import * as mfm from "mfm-js";
import * as os from "@/os";
import XNoteSimple from "@/components/MkNoteSimple.vue";

View File

@ -44,7 +44,7 @@
<script lang="ts" setup>
import {} from "vue";
import { permissions as kinds } from "iceshrimp-js";
import { permissions as kinds } from "@/iceshrimp-js";
import MkInput from "./form/input.vue";
import MkSwitch from "./form/switch.vue";
import MkButton from "./MkButton.vue";

View File

@ -24,7 +24,7 @@
</template>
<script lang="ts" setup>
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkMiniChart from "@/components/MkMiniChart.vue";
import * as os from "@/os";
import { acct, userPage } from "@/filters/user";

View File

@ -86,7 +86,7 @@
</template>
<script lang="ts" setup>
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkFollowButton from "@/components/MkFollowButton.vue";
import XShowMoreButton from "@/components/MkShowMoreButton.vue";
import MkNumber from "@/components/MkNumber.vue";

View File

@ -4,7 +4,7 @@
<script lang="ts" setup>
import {} from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import { i18n } from "@/i18n";
const props = defineProps<{

View File

@ -30,8 +30,8 @@
<script lang="ts" setup>
import { onMounted } from "vue";
import MkUserInfo from "@/components/MkUserInfo.vue";
import * as Acct from "iceshrimp-js/built/acct";
import type * as misskey from "iceshrimp-js";
import { Acct } from "@/iceshrimp-js"
import type * as misskey from "@/iceshrimp-js";
import * as os from "@/os";
const props = defineProps<{

View File

@ -89,7 +89,7 @@
<script lang="ts" setup>
import { nextTick, onMounted } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkInput from "@/components/form/input.vue";
import FormSplit from "@/components/form/split.vue";
import XModalWindow from "@/components/MkModalWindow.vue";

View File

@ -85,7 +85,7 @@
<script lang="ts" setup>
import { nextTick, onMounted } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkInput from "@/components/form/input.vue";
import FormSplit from "@/components/form/split.vue";
import XModalWindow from "@/components/MkModalWindow.vue";

View File

@ -7,8 +7,8 @@
@click="modal.close()"
@closed="emit('closed')"
>
<div
class="_popup"
<div
class="_popup"
:class="{ [$style.root]: true, [$style.asDrawer]: type === 'drawer' }">
<button
key="public"
@ -126,7 +126,7 @@
<script lang="ts" setup>
import { nextTick, watch } from "vue";
import * as misskey from "iceshrimp-js";
import * as misskey from "@/iceshrimp-js";
import MkModal from "@/components/MkModal.vue";
import { i18n } from "@/i18n";

View File

@ -10,7 +10,7 @@
</template>
<script lang="ts" setup>
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import { toUnicode } from "punycode/";
import { host as hostRaw } from "@/config";

View File

@ -37,7 +37,7 @@
<script lang="ts" setup>
import { onMounted, watch } from "vue";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import { extractAvgColorFromBlurhash } from "@/scripts/extract-avg-color-from-blurhash";
import { acct, userPage } from "@/filters/user";

View File

@ -24,7 +24,7 @@
<script lang="ts" setup>
import { computed, ref, watch } from "vue";
import type { CustomEmoji } from "iceshrimp-js/built/entities";
import type { CustomEmoji } from "@/iceshrimp-js/entities.js";
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import { char2filePath } from "@/scripts/twemoji-base";
import { defaultStore } from "@/store";

View File

@ -10,7 +10,7 @@
<script lang="ts" setup>
import {} from "vue";
import type * as misskey from "iceshrimp-js";
import type * as misskey from "@/iceshrimp-js";
const props = withDefaults(
defineProps<{

View File

@ -18,11 +18,15 @@ export const apiUrl = `${url}/api`;
export const wsUrl = `${url
.replace("http://", "ws://")
.replace("https://", "wss://")}/streaming`;
export const lang = localStorage.getItem("lang");
export const lang = localStorage.getItem("lang") ?? 'en-US';
export const langs = _LANGS_;
export const locale = JSON.parse(localStorage.getItem("locale"));
export let locale = JSON.parse(localStorage.getItem("locale"));
export const version = _VERSION_;
export const instanceName = siteName === "Iceshrimp" ? host : siteName;
export let searchEngine = 'https://duckduckgo.com/?q=';
export const ui = localStorage.getItem("ui");
export const debug = localStorage.getItem("debug") === "true";
export function updateLocale(newLocale: any): void {
locale = newLocale;
}

View File

@ -1,9 +1,10 @@
import * as misskey from "iceshrimp-js";
import * as Acct from "iceshrimp-js/built/acct";
import * as misskey from "@/iceshrimp-js";
import { Acct } from "@/iceshrimp-js"
import { url } from "@/config";
import { ParsedAcct } from "@/iceshrimp-js/acct.js";
export const acct = (user: misskey.Acct) => {
return Acct.toString(user);
export const acct = (user: ParsedAcct) => {
return new Acct(user.username, user.host).toString();
};
export const userName = (user: misskey.entities.User) => {

View File

@ -2,7 +2,7 @@ import { markRaw } from "vue";
import { locale } from "@/config";
import { I18n } from "@/scripts/i18n";
export const i18n = markRaw(new I18n(locale));
export let i18n = markRaw(new I18n(locale));
// このファイルに書きたくないけどここに書かないと何故かVeturが認識しない
declare module "@vue/runtime-core" {
@ -11,3 +11,7 @@ declare module "@vue/runtime-core" {
$ts: typeof i18n["locale"];
}
}
export function updateI18n(newLocale: any) {
i18n.ts = newLocale;
}

View File

@ -0,0 +1,32 @@
export type ParsedAcct = {
username: string;
host: string | null;
}
export class Acct {
public username: string;
public host: string | null;
constructor(username: string, host: string | null) {
this.username = username;
this.host = host;
}
public static parse(acct: string): ParsedAcct {
if (acct.startsWith("@")) acct = acct.slice(1);
const split = acct.split("@", 2);
return { username: split[0], host: split[1] ?? null };
}
public static fromParsed(parsed: ParsedAcct) {
return new this(parsed.username, parsed.host);
}
public static toString(parsed: ParsedAcct) {
return this.fromParsed(parsed).toString();
}
public toString(): string {
return this.host == null ? this.username : `${this.username}@${this.host}`;
}
}

View File

@ -0,0 +1,127 @@
import { Endpoints } from "./api.types.js";
const MK_API_ERROR = Symbol();
export type APIError = {
id: string;
code: string;
message: string;
kind: "client" | "server";
info: Record<string, any>;
};
export function isAPIError(reason: any): reason is APIError {
return reason[MK_API_ERROR] === true;
}
export type FetchLike = (
input: string,
init?: {
method?: string;
body?: string;
credentials?: RequestCredentials;
cache?: RequestCache;
},
) => Promise<{
status: number;
json(): Promise<any>;
}>;
type IsNeverType<T> = [T] extends [never] ? true : false;