refactor(frontend): os.tsに引き込んだscripts/api.tsの再exportをやめる (#12694)

* refactor(frontend): os.tsに引き込んだscripts/api.tsの再exportをやめる

* fix

* fix

* renate to "misskeyApi"

* rename file
This commit is contained in:
おさむのひと 2024-01-04 18:32:46 +09:00 committed by GitHub
parent ea41cc6ec0
commit fa9c4a19b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
191 changed files with 581 additions and 468 deletions

View file

@ -11,7 +11,8 @@ import { miLocalStorage } from '@/local-storage.js';
import { MenuButton } from '@/types/menu.js';
import { del, get, set } from '@/scripts/idb-proxy.js';
import { apiUrl } from '@/config.js';
import { waiting, api, popup, popupMenu, success, alert } from '@/os.js';
import { waiting, popup, popupMenu, success, alert } from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { unisonReload, reloadChannel } from '@/scripts/unison-reload.js';
// TODO: 他のタブと永続化されたstateを同期
@ -251,7 +252,7 @@ export async function openAccountMenu(opts: {
}
const storedAccounts = await getAccounts().then(accounts => accounts.filter(x => x.id !== $i.id));
const accountsPromise = api('users/show', { userIds: storedAccounts.map(x => x.id) });
const accountsPromise = misskeyApi('users/show', { userIds: storedAccounts.map(x => x.id) });
function createItem(account: Misskey.entities.UserDetailed) {
return {

View file

@ -5,9 +5,9 @@
import * as Misskey from 'misskey-js';
import { Cache } from '@/scripts/cache.js';
import { api } from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
export const clipsCache = new Cache<Misskey.entities.Clip[]>(1000 * 60 * 30, () => api('clips/list'));
export const rolesCache = new Cache(1000 * 60 * 30, () => api('admin/roles/list'));
export const userListsCache = new Cache<Misskey.entities.UserList[]>(1000 * 60 * 30, () => api('users/lists/list'));
export const antennasCache = new Cache<Misskey.entities.Antenna[]>(1000 * 60 * 30, () => api('antennas/list'));
export const clipsCache = new Cache<Misskey.entities.Clip[]>(1000 * 60 * 30, () => misskeyApi('clips/list'));
export const rolesCache = new Cache(1000 * 60 * 30, () => misskeyApi('admin/roles/list'));
export const userListsCache = new Cache<Misskey.entities.UserList[]>(1000 * 60 * 30, () => misskeyApi('users/lists/list'));
export const antennasCache = new Cache<Misskey.entities.Antenna[]>(1000 * 60 * 30, () => misskeyApi('antennas/list'));

View file

@ -17,7 +17,7 @@ import * as Misskey from 'misskey-js';
import MkMention from './MkMention.vue';
import { i18n } from '@/i18n.js';
import { host as localHost } from '@/config.js';
import { api } from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const user = ref<Misskey.entities.UserLite>();
@ -25,7 +25,7 @@ const props = defineProps<{
movedTo: string; // user id
}>();
api('users/show', { userId: props.movedTo }).then(u => user.value = u);
misskeyApi('users/show', { userId: props.movedTo }).then(u => user.value = u);
</script>
<style lang="scss" module>

View file

@ -55,6 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import * as Misskey from 'misskey-js';
import { onMounted, ref, computed } from 'vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { ACHIEVEMENT_TYPES, ACHIEVEMENT_BADGES, claimAchievement } from '@/scripts/achievements.js';
@ -71,7 +72,7 @@ const achievements = ref<Misskey.entities.UsersAchievementsResponse | null>(null
const lockedAchievements = computed(() => ACHIEVEMENT_TYPES.filter(x => !(achievements.value ?? []).some(a => a.name === x)));
function fetch() {
os.api('users/achievements', { userId: props.user.id }).then(res => {
misskeyApi('users/achievements', { userId: props.user.id }).then(res => {
achievements.value = [];
for (const t of ACHIEVEMENT_TYPES) {
const a = res.find(x => x.name === t);

View file

@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { onMounted, shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import MkModal from '@/components/MkModal.vue';
import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js';
@ -49,7 +50,7 @@ async function ok() {
}
modal.value.close();
os.api('i/read-announcement', { announcementId: props.announcement.id });
misskeyApi('i/read-announcement', { announcementId: props.announcement.id });
updateAccount({
unreadAnnouncements: $i!.unreadAnnouncements.filter(a => a.id !== props.announcement.id),
});

View file

@ -45,6 +45,7 @@ import contains from '@/scripts/contains.js';
import { char2twemojiFilePath, char2fluentEmojiFilePath } from '@/scripts/emoji-base.js';
import { acct } from '@/filters/user.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { emojilist, getEmojiName } from '@/scripts/emojilist.js';
import { i18n } from '@/i18n.js';
@ -201,7 +202,7 @@ function exec() {
users.value = JSON.parse(cache);
fetching.value = false;
} else {
os.api('users/search-by-username-and-host', {
misskeyApi('users/search-by-username-and-host', {
username: props.q,
limit: 10,
detail: false,
@ -224,7 +225,7 @@ function exec() {
hashtags.value = hashtags;
fetching.value = false;
} else {
os.api('hashtags/search', {
misskeyApi('hashtags/search', {
query: props.q,
limit: 30,
}).then(searchedHashtags => {

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const props = withDefaults(defineProps<{
userIds: string[];
@ -27,7 +27,7 @@ const props = withDefaults(defineProps<{
const users = ref<Misskey.entities.UserLite[]>([]);
onMounted(async () => {
users.value = await os.api('users/show', {
users.value = await misskeyApi('users/show', {
userIds: props.userIds,
}) as unknown as Misskey.entities.UserLite[];
});

View file

@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = withDefaults(defineProps<{
@ -44,12 +44,12 @@ async function onClick() {
try {
if (isFollowing.value) {
await os.api('channels/unfollow', {
await misskeyApi('channels/unfollow', {
channelId: props.channel.id,
});
isFollowing.value = false;
} else {
await os.api('channels/follow', {
await misskeyApi('channels/follow', {
channelId: props.channel.id,
});
isFollowing.value = true;

View file

@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { onMounted, ref, shallowRef, watch, PropType } from 'vue';
import { Chart } from 'chart.js';
import gradient from 'chartjs-plugin-gradient';
import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { chartVLine } from '@/scripts/chart-vline.js';
@ -277,7 +277,7 @@ const exportData = () => {
};
const fetchFederationChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/federation', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/federation', { limit: props.limit, span: props.span });
return {
series: [{
name: 'Received',
@ -327,7 +327,7 @@ const fetchFederationChart = async (): Promise<typeof chartData> => {
};
const fetchApRequestChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/ap-request', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/ap-request', { limit: props.limit, span: props.span });
return {
series: [{
name: 'In',
@ -349,7 +349,7 @@ const fetchApRequestChart = async (): Promise<typeof chartData> => {
};
const fetchNotesChart = async (type: string): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/notes', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/notes', { limit: props.limit, span: props.span });
return {
series: [{
name: 'All',
@ -396,7 +396,7 @@ const fetchNotesChart = async (type: string): Promise<typeof chartData> => {
};
const fetchNotesTotalChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/notes', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/notes', { limit: props.limit, span: props.span });
return {
series: [{
name: 'Combined',
@ -415,7 +415,7 @@ const fetchNotesTotalChart = async (): Promise<typeof chartData> => {
};
const fetchUsersChart = async (total: boolean): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/users', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/users', { limit: props.limit, span: props.span });
return {
series: [{
name: 'Combined',
@ -443,7 +443,7 @@ const fetchUsersChart = async (total: boolean): Promise<typeof chartData> => {
};
const fetchActiveUsersChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/active-users', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/active-users', { limit: props.limit, span: props.span });
return {
series: [{
name: 'Read & Write',
@ -495,7 +495,7 @@ const fetchActiveUsersChart = async (): Promise<typeof chartData> => {
};
const fetchDriveChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/drive', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/drive', { limit: props.limit, span: props.span });
return {
bytes: true,
series: [{
@ -531,7 +531,7 @@ const fetchDriveChart = async (): Promise<typeof chartData> => {
};
const fetchDriveFilesChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/drive', { limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/drive', { limit: props.limit, span: props.span });
return {
series: [{
name: 'All',
@ -566,7 +566,7 @@ const fetchDriveFilesChart = async (): Promise<typeof chartData> => {
};
const fetchInstanceRequestsChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
return {
series: [{
name: 'In',
@ -588,7 +588,7 @@ const fetchInstanceRequestsChart = async (): Promise<typeof chartData> => {
};
const fetchInstanceUsersChart = async (total: boolean): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
return {
series: [{
name: 'Users',
@ -603,7 +603,7 @@ const fetchInstanceUsersChart = async (total: boolean): Promise<typeof chartData
};
const fetchInstanceNotesChart = async (total: boolean): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
return {
series: [{
name: 'Notes',
@ -618,7 +618,7 @@ const fetchInstanceNotesChart = async (total: boolean): Promise<typeof chartData
};
const fetchInstanceFfChart = async (total: boolean): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
return {
series: [{
name: 'Following',
@ -641,7 +641,7 @@ const fetchInstanceFfChart = async (total: boolean): Promise<typeof chartData> =
};
const fetchInstanceDriveUsageChart = async (total: boolean): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
return {
bytes: true,
series: [{
@ -657,7 +657,7 @@ const fetchInstanceDriveUsageChart = async (total: boolean): Promise<typeof char
};
const fetchInstanceDriveFilesChart = async (total: boolean): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/instance', { host: props.args.host, limit: props.limit, span: props.span });
return {
series: [{
name: 'Drive files',
@ -672,7 +672,7 @@ const fetchInstanceDriveFilesChart = async (total: boolean): Promise<typeof char
};
const fetchPerUserNotesChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/user/notes', { userId: props.args.user.id, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/user/notes', { userId: props.args.user.id, limit: props.limit, span: props.span });
return {
series: [...(props.args.withoutAll ? [] : [{
name: 'All',
@ -704,7 +704,7 @@ const fetchPerUserNotesChart = async (): Promise<typeof chartData> => {
};
const fetchPerUserPvChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/user/pv', { userId: props.args.user.id, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/user/pv', { userId: props.args.user.id, limit: props.limit, span: props.span });
return {
series: [{
name: 'Unique PV (user)',
@ -731,7 +731,7 @@ const fetchPerUserPvChart = async (): Promise<typeof chartData> => {
};
const fetchPerUserFollowingChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/user/following', { userId: props.args.user.id, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/user/following', { userId: props.args.user.id, limit: props.limit, span: props.span });
return {
series: [{
name: 'Local',
@ -746,7 +746,7 @@ const fetchPerUserFollowingChart = async (): Promise<typeof chartData> => {
};
const fetchPerUserFollowersChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/user/following', { userId: props.args.user.id, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/user/following', { userId: props.args.user.id, limit: props.limit, span: props.span });
return {
series: [{
name: 'Local',
@ -761,7 +761,7 @@ const fetchPerUserFollowersChart = async (): Promise<typeof chartData> => {
};
const fetchPerUserDriveChart = async (): Promise<typeof chartData> => {
const raw = await os.apiGet('charts/user/drive', { userId: props.args.user.id, limit: props.limit, span: props.span });
const raw = await misskeyApiGet('charts/user/drive', { userId: props.args.user.id, limit: props.limit, span: props.span });
return {
series: [{
name: 'Inc',

View file

@ -35,6 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, defineAsyncComponent, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { defaultStore } from '@/store.js';
import { claimAchievement } from '@/scripts/achievements.js';
@ -144,7 +145,7 @@ function onDrop(ev: DragEvent) {
if (driveFile != null && driveFile !== '') {
const file = JSON.parse(driveFile);
emit('removeFile', file.id);
os.api('drive/files/update', {
misskeyApi('drive/files/update', {
fileId: file.id,
folderId: props.folder.id,
});
@ -160,7 +161,7 @@ function onDrop(ev: DragEvent) {
if (folder.id === props.folder.id) return;
emit('removeFolder', folder.id);
os.api('drive/folders/update', {
misskeyApi('drive/folders/update', {
folderId: folder.id,
parentId: props.folder.id,
}).then(() => {
@ -214,7 +215,7 @@ function rename() {
default: props.folder.name,
}).then(({ canceled, result: name }) => {
if (canceled) return;
os.api('drive/folders/update', {
misskeyApi('drive/folders/update', {
folderId: props.folder.id,
name: name,
});
@ -222,7 +223,7 @@ function rename() {
}
function deleteFolder() {
os.api('drive/folders/delete', {
misskeyApi('drive/folders/delete', {
folderId: props.folder.id,
}).then(() => {
if (defaultStore.state.uploadFolder === props.folder.id) {

View file

@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
@ -112,7 +112,7 @@ function onDrop(ev: DragEvent) {
if (driveFile != null && driveFile !== '') {
const file = JSON.parse(driveFile);
emit('removeFile', file.id);
os.api('drive/files/update', {
misskeyApi('drive/files/update', {
fileId: file.id,
folderId: props.folder ? props.folder.id : null,
});
@ -126,7 +126,7 @@ function onDrop(ev: DragEvent) {
// reject
if (props.folder && folder.id === props.folder.id) return;
emit('removeFolder', folder.id);
os.api('drive/folders/update', {
misskeyApi('drive/folders/update', {
folderId: folder.id,
parentId: props.folder ? props.folder.id : null,
});

View file

@ -102,6 +102,7 @@ import XNavFolder from '@/components/MkDrive.navFolder.vue';
import XFolder from '@/components/MkDrive.folder.vue';
import XFile from '@/components/MkDrive.file.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useStream } from '@/stream.js';
import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
@ -254,7 +255,7 @@ function onDrop(ev: DragEvent): any {
const file = JSON.parse(driveFile);
if (files.value.some(f => f.id === file.id)) return;
removeFile(file.id);
os.api('drive/files/update', {
misskeyApi('drive/files/update', {
fileId: file.id,
folderId: folder.value ? folder.value.id : null,
});
@ -270,7 +271,7 @@ function onDrop(ev: DragEvent): any {
if (folder.value && droppedFolder.id === folder.value.id) return false;
if (folders.value.some(f => f.id === droppedFolder.id)) return false;
removeFolder(droppedFolder.id);
os.api('drive/folders/update', {
misskeyApi('drive/folders/update', {
folderId: droppedFolder.id,
parentId: folder.value ? folder.value.id : null,
}).then(() => {
@ -307,7 +308,7 @@ function urlUpload() {
placeholder: i18n.ts.uploadFromUrlDescription,
}).then(({ canceled, result: url }) => {
if (canceled || !url) return;
os.api('drive/files/upload-from-url', {
misskeyApi('drive/files/upload-from-url', {
url: url,
folderId: folder.value ? folder.value.id : undefined,
});
@ -325,7 +326,7 @@ function createFolder() {
placeholder: i18n.ts.folderName,
}).then(({ canceled, result: name }) => {
if (canceled) return;
os.api('drive/folders/create', {
misskeyApi('drive/folders/create', {
name: name,
parentId: folder.value ? folder.value.id : undefined,
}).then(createdFolder => {
@ -341,7 +342,7 @@ function renameFolder(folderToRename: Misskey.entities.DriveFolder) {
default: folderToRename.name,
}).then(({ canceled, result: name }) => {
if (canceled) return;
os.api('drive/folders/update', {
misskeyApi('drive/folders/update', {
folderId: folderToRename.id,
name: name,
}).then(updatedFolder => {
@ -352,7 +353,7 @@ function renameFolder(folderToRename: Misskey.entities.DriveFolder) {
}
function deleteFolder(folderToDelete: Misskey.entities.DriveFolder) {
os.api('drive/folders/delete', {
misskeyApi('drive/folders/delete', {
folderId: folderToDelete.id,
}).then(() => {
//
@ -436,7 +437,7 @@ function move(target?: Misskey.entities.DriveFolder) {
fetching.value = true;
os.api('drive/folders/show', {
misskeyApi('drive/folders/show', {
folderId: target,
}).then(folderToMove => {
folder.value = folderToMove;
@ -535,7 +536,7 @@ async function fetch() {
const foldersMax = 30;
const filesMax = 30;
const foldersPromise = os.api('drive/folders', {
const foldersPromise = misskeyApi('drive/folders', {
folderId: folder.value ? folder.value.id : null,
limit: foldersMax + 1,
}).then(fetchedFolders => {
@ -546,7 +547,7 @@ async function fetch() {
return fetchedFolders;
});
const filesPromise = os.api('drive/files', {
const filesPromise = misskeyApi('drive/files', {
folderId: folder.value ? folder.value.id : null,
type: props.type,
limit: filesMax + 1,
@ -571,7 +572,7 @@ function fetchMoreFolders() {
const max = 30;
os.api('drive/folders', {
misskeyApi('drive/folders', {
folderId: folder.value ? folder.value.id : null,
type: props.type,
untilId: folders.value.at(-1)?.id,
@ -594,7 +595,7 @@ function fetchMoreFiles() {
const max = 30;
//
os.api('drive/files', {
misskeyApi('drive/files', {
folderId: folder.value ? folder.value.id : null,
type: props.type,
untilId: files.value.at(-1)?.id,

View file

@ -10,11 +10,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const meta = ref<Misskey.entities.MetaResponse>();
os.api('meta', { detail: true }).then(gotMeta => {
misskeyApi('meta', { detail: true }).then(gotMeta => {
meta.value = gotMeta;
});
</script>

View file

@ -38,11 +38,12 @@ SPDX-License-Identifier: AGPL-3.0-only
import { onBeforeUnmount, onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { $i } from '@/account.js';
import { defaultStore } from "@/store.js";
import { defaultStore } from '@/store.js';
const props = withDefaults(defineProps<{
user: Misskey.entities.UserDetailed,
@ -63,7 +64,7 @@ const wait = ref(false);
const connection = useStream().useChannel('main');
if (props.user.isFollowing == null) {
os.api('users/show', {
misskeyApi('users/show', {
userId: props.user.id,
})
.then(onFollowChange);
@ -88,17 +89,17 @@ async function onClick() {
if (canceled) return;
await os.api('following/delete', {
await misskeyApi('following/delete', {
userId: props.user.id,
});
} else {
if (hasPendingFollowRequestFromYou.value) {
await os.api('following/requests/cancel', {
await misskeyApi('following/requests/cancel', {
userId: props.user.id,
});
hasPendingFollowRequestFromYou.value = false;
} else {
await os.api('following/create', {
await misskeyApi('following/create', {
userId: props.user.id,
withReplies: defaultStore.state.defaultWithReplies,
});

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, nextTick, watch, shallowRef, ref } from 'vue';
import { Chart } from 'chart.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { alpha } from '@/scripts/color.js';
@ -72,19 +72,19 @@ async function renderChart() {
let values;
if (props.src === 'active-users') {
const raw = await os.api('charts/active-users', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/active-users', { limit: chartLimit, span: 'day' });
values = raw.readWrite;
} else if (props.src === 'notes') {
const raw = await os.api('charts/notes', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/notes', { limit: chartLimit, span: 'day' });
values = raw.local.inc;
} else if (props.src === 'ap-requests-inbox-received') {
const raw = await os.api('charts/ap-request', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/ap-request', { limit: chartLimit, span: 'day' });
values = raw.inboxReceived;
} else if (props.src === 'ap-requests-deliver-succeeded') {
const raw = await os.api('charts/ap-request', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/ap-request', { limit: chartLimit, span: 'day' });
values = raw.deliverSucceeded;
} else if (props.src === 'ap-requests-deliver-failed') {
const raw = await os.api('charts/ap-request', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/ap-request', { limit: chartLimit, span: 'day' });
values = raw.deliverFailed;
}

View file

@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkMiniChart from '@/components/MkMiniChart.vue';
import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
const props = defineProps<{
@ -27,7 +27,7 @@ const props = defineProps<{
const chartValues = ref<number[] | null>(null);
os.apiGet('charts/instance', { host: props.instance.host, limit: 16 + 1, span: 'day' }).then(res => {
misskeyApiGet('charts/instance', { host: props.instance.host, limit: 16 + 1, span: 'day' }).then(res => {
//
res['requests.received'].splice(0, 1);
chartValues.value = res['requests.received'];

View file

@ -90,6 +90,7 @@ import MkSelect from '@/components/MkSelect.vue';
import MkChart from '@/components/MkChart.vue';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import MkHeatmap from '@/components/MkHeatmap.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
@ -162,7 +163,7 @@ function createDoughnut(chartEl, tooltip, data) {
}
onMounted(() => {
os.apiGet('federation/stats', { limit: 30 }).then(fedStats => {
misskeyApiGet('federation/stats', { limit: 30 }).then(fedStats => {
createDoughnut(subDoughnutEl.value, externalTooltipHandler1, fedStats.topSubInstances.map(x => ({
name: x.host,
color: x.themeColor,

View file

@ -170,6 +170,7 @@ import { checkWordMute } from '@/scripts/check-word-mute.js';
import { userPage } from '@/filters/user.js';
import * as os from '@/os.js';
import * as sound from '@/scripts/sound.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore, noteViewInterruptors } from '@/store.js';
import { reactionPicker } from '@/scripts/reaction-picker.js';
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
@ -277,7 +278,7 @@ const keymap = {
};
provide('react', (reaction: string) => {
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: appearNote.value.id,
reaction: reaction,
});
@ -298,7 +299,7 @@ if (props.mock) {
if (!props.mock) {
useTooltip(renoteButton, async (showing) => {
const renotes = await os.api('notes/renotes', {
const renotes = await misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
limit: 11,
});
@ -350,7 +351,7 @@ function react(viaKeyboard = false): void {
return;
}
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: appearNote.value.id,
reaction: '❤️',
});
@ -371,7 +372,7 @@ function react(viaKeyboard = false): void {
return;
}
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: appearNote.value.id,
reaction: reaction,
});
@ -393,7 +394,7 @@ function undoReact(note): void {
return;
}
os.api('notes/reactions/delete', {
misskeyApi('notes/reactions/delete', {
noteId: note.id,
});
}
@ -453,7 +454,7 @@ function showRenoteMenu(viaKeyboard = false): void {
icon: 'ti ti-trash',
danger: true,
action: () => {
os.api('notes/delete', {
misskeyApi('notes/delete', {
noteId: note.value.id,
});
isDeleted.value = true;
@ -499,7 +500,7 @@ function focusAfter() {
}
function readPromo() {
os.api('promo/read', {
misskeyApi('promo/read', {
noteId: appearNote.value.id,
});
isDeleted.value = true;

View file

@ -210,6 +210,7 @@ import { checkWordMute } from '@/scripts/check-word-mute.js';
import { userPage } from '@/filters/user.js';
import { notePage } from '@/filters/note.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import * as sound from '@/scripts/sound.js';
import { defaultStore, noteViewInterruptors } from '@/store.js';
import { reactionPicker } from '@/scripts/reaction-picker.js';
@ -292,7 +293,7 @@ const keymap = {
};
provide('react', (reaction: string) => {
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: appearNote.value.id,
reaction: reaction,
});
@ -326,7 +327,7 @@ useNoteCapture({
});
useTooltip(renoteButton, async (showing) => {
const renotes = await os.api('notes/renotes', {
const renotes = await misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
limit: 11,
});
@ -371,7 +372,7 @@ function react(viaKeyboard = false): void {
if (appearNote.value.reactionAcceptance === 'likeOnly') {
sound.play('reaction');
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: appearNote.value.id,
reaction: '❤️',
});
@ -387,7 +388,7 @@ function react(viaKeyboard = false): void {
reactionPicker.show(reactButton.value, reaction => {
sound.play('reaction');
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: appearNote.value.id,
reaction: reaction,
});
@ -403,7 +404,7 @@ function react(viaKeyboard = false): void {
function undoReact(note): void {
const oldReaction = note.myReaction;
if (!oldReaction) return;
os.api('notes/reactions/delete', {
misskeyApi('notes/reactions/delete', {
noteId: note.id,
});
}
@ -446,7 +447,7 @@ function showRenoteMenu(viaKeyboard = false): void {
icon: 'ti ti-trash',
danger: true,
action: () => {
os.api('notes/delete', {
misskeyApi('notes/delete', {
noteId: note.value.id,
});
isDeleted.value = true;
@ -468,7 +469,7 @@ const repliesLoaded = ref(false);
function loadReplies() {
repliesLoaded.value = true;
os.api('notes/children', {
misskeyApi('notes/children', {
noteId: appearNote.value.id,
limit: 30,
}).then(res => {
@ -480,7 +481,7 @@ const conversationLoaded = ref(false);
function loadConversation() {
conversationLoaded.value = true;
os.api('notes/conversation', {
misskeyApi('notes/conversation', {
noteId: appearNote.value.replyId,
}).then(res => {
conversation.value = res.reverse();

View file

@ -46,7 +46,7 @@ import MkNoteHeader from '@/components/MkNoteHeader.vue';
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
import MkCwButton from '@/components/MkCwButton.vue';
import { notePage } from '@/filters/note.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { $i } from '@/account.js';
import { userPage } from '@/filters/user.js';
@ -68,7 +68,7 @@ const showContent = ref(false);
const replies = ref<Misskey.entities.Note[]>([]);
if (props.detail) {
os.api('notes/children', {
misskeyApi('notes/children', {
noteId: props.note.id,
limit: 5,
}).then(res => {

View file

@ -145,7 +145,7 @@ import { getNoteSummary } from '@/scripts/get-note-summary.js';
import { notePage } from '@/filters/note.js';
import { userPage } from '@/filters/user.js';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { $i } from '@/account.js';
import { infoImageUrl } from '@/instance.js';
@ -162,12 +162,12 @@ const followRequestDone = ref(false);
const acceptFollowRequest = () => {
followRequestDone.value = true;
os.api('following/requests/accept', { userId: props.notification.user.id });
misskeyApi('following/requests/accept', { userId: props.notification.user.id });
};
const rejectFollowRequest = () => {
followRequestDone.value = true;
os.api('following/requests/reject', { userId: props.notification.user.id });
misskeyApi('following/requests/reject', { userId: props.notification.user.id });
};
</script>

View file

@ -46,6 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, ComputedRef, isRef, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onDeactivated, ref, shallowRef, watch } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { onScrollTop, isTopVisible, getBodyScrollHeight, getScrollContainer, onScrollBottom, scrollToBottom, scroll, isBottomVisible } from '@/scripts/scroll.js';
import { useDocumentVisibility } from '@/scripts/use-document-visibility.js';
import { defaultStore } from '@/store.js';
@ -203,7 +204,7 @@ async function init(): Promise<void> {
queue.value = new Map();
fetching.value = true;
const params = props.pagination.params ? isRef(props.pagination.params) ? props.pagination.params.value : props.pagination.params : {};
await os.api(props.pagination.endpoint, {
await misskeyApi(props.pagination.endpoint, {
...params,
limit: props.pagination.limit ?? 10,
allowPartial: true,
@ -239,7 +240,7 @@ const fetchMore = async (): Promise<void> => {
if (!more.value || fetching.value || moreFetching.value || items.value.size === 0) return;
moreFetching.value = true;
const params = props.pagination.params ? isRef(props.pagination.params) ? props.pagination.params.value : props.pagination.params : {};
await os.api(props.pagination.endpoint, {
await misskeyApi(props.pagination.endpoint, {
...params,
limit: SECOND_FETCH_LIMIT,
...(props.pagination.offsetMode ? {
@ -303,7 +304,7 @@ const fetchMoreAhead = async (): Promise<void> => {
if (!more.value || fetching.value || moreFetching.value || items.value.size === 0) return;
moreFetching.value = true;
const params = props.pagination.params ? isRef(props.pagination.params) ? props.pagination.params.value : props.pagination.params : {};
await os.api(props.pagination.endpoint, {
await misskeyApi(props.pagination.endpoint, {
...params,
limit: SECOND_FETCH_LIMIT,
...(props.pagination.offsetMode ? {

View file

@ -32,6 +32,7 @@ import * as Misskey from 'misskey-js';
import { sum } from '@/scripts/array.js';
import { pleaseLogin } from '@/scripts/please-login.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { useInterval } from '@/scripts/use-interval.js';
@ -83,7 +84,7 @@ const vote = async (id) => {
});
if (canceled) return;
await os.api('notes/polls/vote', {
await misskeyApi('notes/polls/vote', {
noteId: props.note.id,
choice: id,
});

View file

@ -115,6 +115,7 @@ import { extractMentions } from '@/scripts/extract-mentions.js';
import { formatTimeString } from '@/scripts/format-time-string.js';
import { Autocomplete } from '@/scripts/autocomplete.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { selectFiles } from '@/scripts/select-file.js';
import { defaultStore, notePostInterruptors, postFormActions } from '@/store.js';
import MkInfo from '@/components/MkInfo.vue';
@ -328,7 +329,7 @@ if (props.reply && ['home', 'followers', 'specified'].includes(props.reply.visib
if (visibility.value === 'specified') {
if (props.reply.visibleUserIds) {
os.api('users/show', {
misskeyApi('users/show', {
userIds: props.reply.visibleUserIds.filter(uid => uid !== $i.id && uid !== props.reply.userId),
}).then(users => {
users.forEach(pushVisibleUser);
@ -336,7 +337,7 @@ if (props.reply && ['home', 'followers', 'specified'].includes(props.reply.visib
}
if (props.reply.userId !== $i.id) {
os.api('users/show', { userId: props.reply.userId }).then(user => {
misskeyApi('users/show', { userId: props.reply.userId }).then(user => {
pushVisibleUser(user);
});
}
@ -383,7 +384,7 @@ function addMissingMention() {
for (const x of extractMentions(ast)) {
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
os.api('users/show', { username: x.username, host: x.host }).then(user => {
misskeyApi('users/show', { username: x.username, host: x.host }).then(user => {
visibleUsers.value.push(user);
});
}
@ -784,7 +785,7 @@ async function post(ev?: MouseEvent) {
}
posting.value = true;
os.api('notes/create', postData, token).then(() => {
misskeyApi('notes/create', postData, token).then(() => {
if (props.freezeAfterPosted) {
posted.value = true;
} else {

View file

@ -24,6 +24,7 @@ import { defineAsyncComponent, inject } from 'vue';
import * as Misskey from 'misskey-js';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
@ -61,7 +62,7 @@ function toggleSensitive(file) {
return;
}
os.api('drive/files/update', {
misskeyApi('drive/files/update', {
fileId: file.id,
isSensitive: !file.isSensitive,
}).then(() => {
@ -78,7 +79,7 @@ async function rename(file) {
allowEmpty: false,
});
if (canceled) return;
os.api('drive/files/update', {
misskeyApi('drive/files/update', {
fileId: file.id,
name: result,
}).then(() => {
@ -96,7 +97,7 @@ async function describe(file) {
}, {
done: caption => {
let comment = caption.length === 0 ? null : caption;
os.api('drive/files/update', {
misskeyApi('drive/files/update', {
fileId: file.id,
comment: comment,
}).then(() => {

View file

@ -45,7 +45,8 @@ import { ref } from 'vue';
import { $i, getAccounts } from '@/account.js';
import MkButton from '@/components/MkButton.vue';
import { instance } from '@/instance.js';
import { api, apiWithDialog, promiseDialog } from '@/os.js';
import { apiWithDialog, promiseDialog } from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
defineProps<{
@ -82,7 +83,7 @@ function subscribe() {
pushSubscription.value = subscription;
// Register
pushRegistrationInServer.value = await api('sw/register', {
pushRegistrationInServer.value = await misskeyApi('sw/register', {
endpoint: subscription.endpoint,
auth: encode(subscription.getKey('auth')),
publickey: encode(subscription.getKey('p256dh')),
@ -159,7 +160,7 @@ if (navigator.serviceWorker == null) {
supported.value = true;
if (pushSubscription.value) {
const res = await api('sw/show-registration', {
const res = await misskeyApi('sw/show-registration', {
endpoint: pushSubscription.value.endpoint,
});

View file

@ -22,6 +22,7 @@ import * as Misskey from 'misskey-js';
import XDetails from '@/components/MkReactionsViewer.details.vue';
import MkReactionIcon from '@/components/MkReactionIcon.vue';
import * as os from '@/os.js';
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
import { useTooltip } from '@/scripts/use-tooltip.js';
import { $i } from '@/account.js';
import MkReactionEffect from '@/components/MkReactionEffect.vue';
@ -69,11 +70,11 @@ async function toggleReaction() {
return;
}
os.api('notes/reactions/delete', {
misskeyApi('notes/reactions/delete', {
noteId: props.note.id,
}).then(() => {
if (oldReaction !== props.reaction) {
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: props.note.id,
reaction: props.reaction,
});
@ -87,7 +88,7 @@ async function toggleReaction() {
return;
}
os.api('notes/reactions/create', {
misskeyApi('notes/reactions/create', {
noteId: props.note.id,
reaction: props.reaction,
});
@ -117,7 +118,7 @@ onMounted(() => {
if (!mock) {
useTooltip(buttonEl, async (showing) => {
const reactions = await os.apiGet('notes/reactions', {
const reactions = await misskeyApiGet('notes/reactions', {
noteId: props.note.id,
type: props.reaction,
limit: 10,

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, nextTick, shallowRef, ref } from 'vue';
import { Chart } from 'chart.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { alpha } from '@/scripts/color.js';
@ -43,7 +43,7 @@ async function renderChart() {
const maxDays = wide ? 10 : narrow ? 5 : 7;
let raw = await os.api('retention', { });
let raw = await misskeyApi('retention', { });
raw = raw.slice(0, maxDays + 1);

View file

@ -16,7 +16,7 @@ import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { chartVLine } from '@/scripts/chart-vline.js';
import { alpha } from '@/scripts/color.js';
import { initChart } from '@/scripts/init-chart.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
initChart();
@ -40,7 +40,7 @@ const getDate = (ymd: string) => {
};
onMounted(async () => {
let raw = await os.api('retention', { });
let raw = await misskeyApi('retention', { });
const vLineColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)';

View file

@ -59,6 +59,7 @@ import MkInput from '@/components/MkInput.vue';
import MkInfo from '@/components/MkInfo.vue';
import { host as configHost } from '@/config.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { login } from '@/account.js';
import { i18n } from '@/i18n.js';
@ -95,7 +96,7 @@ const props = defineProps({
});
function onUsernameChange(): void {
os.api('users/show', {
misskeyApi('users/show', {
username: username.value,
}).then(userResponse => {
user.value = userResponse;
@ -120,7 +121,7 @@ async function queryKey(): Promise<void> {
credentialRequest.value = null;
queryingKey.value = false;
signing.value = true;
return os.api('signin', {
return misskeyApi('signin', {
username: username.value,
password: password.value,
credential: credential.toJSON(),
@ -142,7 +143,7 @@ function onSubmit(): void {
signing.value = true;
if (!totpLogin.value && user.value && user.value.twoFactorEnabled) {
if (webAuthnSupported() && user.value.securityKeys) {
os.api('signin', {
misskeyApi('signin', {
username: username.value,
password: password.value,
}).then(res => {
@ -159,7 +160,7 @@ function onSubmit(): void {
signing.value = false;
}
} else {
os.api('signin', {
misskeyApi('signin', {
username: username.value,
password: password.value,
token: user.value?.twoFactorEnabled ? token.value : undefined,

View file

@ -84,6 +84,7 @@ import MkInput from './MkInput.vue';
import MkCaptcha, { type Captcha } from '@/components/MkCaptcha.vue';
import * as config from '@/config.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { login } from '@/account.js';
import { instance } from '@/instance.js';
import { i18n } from '@/i18n.js';
@ -180,7 +181,7 @@ function onChangeUsername(): void {
usernameState.value = 'wait';
usernameAbortController.value = new AbortController();
os.api('username/available', {
misskeyApi('username/available', {
username: username.value,
}, undefined, usernameAbortController.value.signal).then(result => {
usernameState.value = result.available ? 'ok' : 'unavailable';
@ -203,7 +204,7 @@ function onChangeEmail(): void {
emailState.value = 'wait';
emailAbortController.value = new AbortController();
os.api('email-address/available', {
misskeyApi('email-address/available', {
emailAddress: email.value,
}, undefined, emailAbortController.value.signal).then(result => {
emailState.value = result.available ? 'ok' :
@ -245,7 +246,7 @@ async function onSubmit(): Promise<void> {
submitting.value = true;
try {
await os.api('signup', {
await misskeyApi('signup', {
username: username.value,
password: password.value,
emailAddress: email.value,
@ -262,7 +263,7 @@ async function onSubmit(): Promise<void> {
});
emit('signupEmailPending');
} else {
const res = await os.api('signin', {
const res = await misskeyApi('signin', {
username: username.value,
password: password.value,
});

View file

@ -56,6 +56,7 @@ import MkModalWindow from '@/components/MkModalWindow.vue';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import MkTextarea from '@/components/MkTextarea.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@ -121,7 +122,7 @@ async function del() {
});
if (canceled) return;
os.api('admin/announcements/delete', {
misskeyApi('admin/announcements/delete', {
id: props.announcement.id,
}).then(() => {
emit('done', {

View file

@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import * as Misskey from 'misskey-js';
import { onMounted, ref } from 'vue';
import MkMiniChart from '@/components/MkMiniChart.vue';
import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { acct } from '@/filters/user.js';
const props = withDefaults(defineProps<{
@ -32,7 +32,7 @@ const chartValues = ref<number[] | null>(null);
onMounted(() => {
if (props.withChart) {
os.apiGet('charts/user/notes', { userId: props.user.id, limit: 16 + 1, span: 'day' }).then(res => {
misskeyApiGet('charts/user/notes', { userId: props.user.id, limit: 16 + 1, span: 'day' }).then(res => {
//
res.inc.splice(0, 1);
chartValues.value = res.inc;

View file

@ -60,6 +60,7 @@ import * as Misskey from 'misskey-js';
import MkFollowButton from '@/components/MkFollowButton.vue';
import { userPage } from '@/filters/user.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { getUserMenu } from '@/scripts/get-user-menu.js';
import number from '@/filters/number.js';
import { i18n } from '@/i18n.js';
@ -97,7 +98,7 @@ onMounted(() => {
Misskey.acct.parse(props.q.substring(1)) :
{ userId: props.q };
os.api('users/show', query).then(res => {
misskeyApi('users/show', query).then(res => {
if (!props.showing) return;
user.value = res;
});

View file

@ -62,7 +62,7 @@ import * as Misskey from 'misskey-js';
import MkInput from '@/components/MkInput.vue';
import FormSplit from '@/components/form/split.vue';
import MkModalWindow from '@/components/MkModalWindow.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
import { $i } from '@/account.js';
@ -90,7 +90,7 @@ const search = () => {
users.value = [];
return;
}
os.api('users/search-by-username-and-host', {
misskeyApi('users/search-by-username-and-host', {
username: username.value,
host: host.value,
limit: 10,
@ -118,7 +118,7 @@ const cancel = () => {
};
onMounted(() => {
os.api('users/show', {
misskeyApi('users/show', {
userIds: defaultStore.state.recentlyUsedUsers,
}).then(users => {
if (props.includeSelf && users.find(x => $i ? x.id === $i.id : true) == null) {

View file

@ -49,7 +49,7 @@ import { i18n } from '@/i18n.js';
import MkSwitch from '@/components/MkSwitch.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkFolder from '@/components/MkFolder.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const isLocked = ref(false);
const hideOnlineStatus = ref(false);
@ -57,7 +57,7 @@ const noCrawle = ref(false);
const preventAiLearning = ref(true);
watch([isLocked, hideOnlineStatus, noCrawle, preventAiLearning], () => {
os.api('i/update', {
misskeyApi('i/update', {
isLocked: !!isLocked.value,
hideOnlineStatus: !!hideOnlineStatus.value,
noCrawle: !!noCrawle.value,

View file

@ -29,7 +29,7 @@ import * as Misskey from 'misskey-js';
import { ref } from 'vue';
import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const props = defineProps<{
user: Misskey.entities.UserDetailed;
@ -39,7 +39,7 @@ const isFollowing = ref(false);
async function follow() {
isFollowing.value = true;
os.api('following/create', {
misskeyApi('following/create', {
userId: props.user.id,
});
}

View file

@ -17,7 +17,7 @@ import { onMounted, shallowRef, ref } from 'vue';
import { Chart } from 'chart.js';
import gradient from 'chartjs-plugin-gradient';
import tinycolor from 'tinycolor2';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { chartVLine } from '@/scripts/chart-vline.js';
@ -53,7 +53,7 @@ async function renderChart() {
}));
};
const raw = await os.api('charts/active-users', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/active-users', { limit: chartLimit, span: 'day' });
const vLineColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)';

View file

@ -60,6 +60,7 @@ import MkTimeline from '@/components/MkTimeline.vue';
import MkInfo from '@/components/MkInfo.vue';
import { instanceName } from '@/config.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import MkNumber from '@/components/MkNumber.vue';
@ -68,11 +69,11 @@ import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.
const meta = ref<Misskey.entities.MetaResponse | null>(null);
const stats = ref<Misskey.entities.StatsResponse | null>(null);
os.api('meta', { detail: true }).then(_meta => {
misskeyApi('meta', { detail: true }).then(_meta => {
meta.value = _meta;
});
os.api('stats', {}).then((res) => {
misskeyApi('stats', {}).then((res) => {
stats.value = res;
});

View file

@ -16,7 +16,7 @@ import * as Misskey from 'misskey-js';
import { NoteBlock } from './block.type.js';
import MkNote from '@/components/MkNote.vue';
import MkNoteDetailed from '@/components/MkNoteDetailed.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const props = defineProps<{
block: NoteBlock,
@ -26,7 +26,7 @@ const props = defineProps<{
const note = ref<Misskey.entities.Note | null>(null);
onMounted(() => {
os.api('notes/show', { noteId: props.block.note })
misskeyApi('notes/show', { noteId: props.block.note })
.then(result => {
note.value = result;
});

View file

@ -5,7 +5,7 @@
import { shallowRef, computed, markRaw, watch } from 'vue';
import * as Misskey from 'misskey-js';
import { api, apiGet } from '@/os.js';
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
import { useStream } from '@/stream.js';
import { get, set } from '@/scripts/idb-proxy.js';
@ -52,11 +52,11 @@ export async function fetchCustomEmojis(force = false) {
let res;
if (force) {
res = await api('emojis', {});
res = await misskeyApi('emojis', {});
} else {
const lastFetchedAt = await get('lastEmojisFetchedAt');
if (lastFetchedAt && (now - lastFetchedAt) < 1000 * 60 * 60) return;
res = await apiGet('emojis', {});
res = await misskeyApiGet('emojis', {});
}
customEmojis.value = res.emojis;

View file

@ -5,7 +5,7 @@
import { computed, reactive } from 'vue';
import * as Misskey from 'misskey-js';
import { api } from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { miLocalStorage } from '@/local-storage.js';
import { DEFAULT_INFO_IMAGE_URL, DEFAULT_NOT_FOUND_IMAGE_URL, DEFAULT_SERVER_ERROR_IMAGE_URL } from '@/const.js';
@ -26,7 +26,7 @@ export const infoImageUrl = computed(() => instance.infoImageUrl ?? DEFAULT_INFO
export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFAULT_NOT_FOUND_IMAGE_URL);
export async function fetchInstance() {
const meta = await api('meta', {
const meta = await misskeyApi('meta', {
detail: false,
});

View file

@ -5,12 +5,11 @@
// TODO: なんでもかんでもos.tsに突っ込むのやめたいのでよしなに分割する
import { pendingApiRequestsCount, api, apiGet } from '@/scripts/api.js';
export { pendingApiRequestsCount, api, apiGet };
import { Component, markRaw, Ref, ref, defineAsyncComponent } from 'vue';
import { EventEmitter } from 'eventemitter3';
import insertTextAtCursor from 'insert-text-at-cursor';
import * as Misskey from 'misskey-js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import MkPostFormDialog from '@/components/MkPostFormDialog.vue';
import MkWaitingDialog from '@/components/MkWaitingDialog.vue';
@ -33,7 +32,7 @@ export const apiWithDialog = ((
data: Record<string, any> = {},
token?: string | null | undefined,
) => {
const promise = api(endpoint, data, token);
const promise = misskeyApi(endpoint, data, token);
promiseDialog(promise, null, async (err) => {
let title = null;
let text = err.message + '\n' + (err as any).id;
@ -83,7 +82,7 @@ export const apiWithDialog = ((
});
return promise;
}) as typeof api;
}) as typeof misskeyApi;
export function promiseDialog<T extends Promise<any>>(
promise: T,
@ -621,7 +620,7 @@ export function checkExistence(fileData: ArrayBuffer): Promise<any> {
const data = new FormData();
data.append('md5', getMD5(fileData));
os.api('drive/files/find-by-hash', {
api('drive/files/find-by-hash', {
md5: getMD5(fileData)
}).then(resp => {
resolve(resp.length > 0 ? resp[0] : null);

View file

@ -29,7 +29,7 @@ import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import { version } from '@/config.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { unisonReload } from '@/scripts/unison-reload.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -46,7 +46,7 @@ const loaded = ref(false);
const serverIsDead = ref(false);
const meta = ref<Misskey.entities.MetaResponse | null>(null);
os.api('meta', {
misskeyApi('meta', {
detail: false,
}).then(res => {
loaded.value = true;

View file

@ -114,7 +114,7 @@ import FormSplit from '@/components/form/split.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkKeyValue from '@/components/MkKeyValue.vue';
import MkInstanceStats from '@/components/MkInstanceStats.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import number from '@/filters/number.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -136,7 +136,7 @@ watch(tab, () => {
}
});
const initStats = () => os.api('stats', {
const initStats = () => misskeyApi('stats', {
}).then((res) => {
stats.value = res;
});

View file

@ -79,6 +79,7 @@ import MkUserCardMini from '@/components/MkUserCardMini.vue';
import MkInfo from '@/components/MkInfo.vue';
import bytes from '@/filters/bytes.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { iAmAdmin, iAmModerator } from '@/account.js';
@ -93,8 +94,8 @@ const props = defineProps<{
}>();
async function fetch() {
file.value = await os.api('drive/files/show', { fileId: props.fileId });
info.value = await os.api('admin/drive/show-file', { fileId: props.fileId });
file.value = await misskeyApi('drive/files/show', { fileId: props.fileId });
info.value = await misskeyApi('admin/drive/show-file', { fileId: props.fileId });
isSensitive.value = file.value.isSensitive;
}
@ -113,7 +114,7 @@ async function del() {
}
async function toggleIsSensitive(v) {
await os.api('drive/files/update', { fileId: props.fileId, isSensitive: v });
await misskeyApi('drive/files/update', { fileId: props.fileId, isSensitive: v });
isSensitive.value = v;
}

View file

@ -219,6 +219,7 @@ import FormSuspense from '@/components/form/suspense.vue';
import MkFileListForAdmin from '@/components/MkFileListForAdmin.vue';
import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { url } from '@/config.js';
import { acct } from '@/filters/user.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -262,11 +263,11 @@ const announcementsPagination = {
const expandedRoles = ref([]);
function createFetcher() {
return () => Promise.all([os.api('users/show', {
return () => Promise.all([misskeyApi('users/show', {
userId: props.userId,
}), os.api('admin/show-user', {
}), misskeyApi('admin/show-user', {
userId: props.userId,
}), iAmAdmin ? os.api('admin/get-user-ips', {
}), iAmAdmin ? misskeyApi('admin/get-user-ips', {
userId: props.userId,
}) : Promise.resolve(null)]).then(([_user, _info, _ips]) => {
user.value = _user;
@ -278,7 +279,7 @@ function createFetcher() {
moderationNote.value = info.value.moderationNote;
watch(moderationNote, async () => {
await os.api('admin/update-user-note', { userId: user.value.id, text: moderationNote.value });
await misskeyApi('admin/update-user-note', { userId: user.value.id, text: moderationNote.value });
await refreshUser();
});
});
@ -301,7 +302,7 @@ async function resetPassword() {
if (confirm.canceled) {
return;
} else {
const { password } = await os.api('admin/reset-password', {
const { password } = await misskeyApi('admin/reset-password', {
userId: user.value.id,
});
os.alert({
@ -319,7 +320,7 @@ async function toggleSuspend(v) {
if (confirm.canceled) {
suspended.value = !v;
} else {
await os.api(v ? 'admin/suspend-user' : 'admin/unsuspend-user', { userId: user.value.id });
await misskeyApi(v ? 'admin/suspend-user' : 'admin/unsuspend-user', { userId: user.value.id });
await refreshUser();
}
}
@ -331,7 +332,7 @@ async function unsetUserAvatar() {
});
if (confirm.canceled) return;
const process = async () => {
await os.api('admin/unset-user-avatar', { userId: user.value.id });
await misskeyApi('admin/unset-user-avatar', { userId: user.value.id });
os.success();
};
await process().catch(err => {
@ -350,7 +351,7 @@ async function unsetUserBanner() {
});
if (confirm.canceled) return;
const process = async () => {
await os.api('admin/unset-user-banner', { userId: user.value.id });
await misskeyApi('admin/unset-user-banner', { userId: user.value.id });
os.success();
};
await process().catch(err => {
@ -369,7 +370,7 @@ async function deleteAllFiles() {
});
if (confirm.canceled) return;
const process = async () => {
await os.api('admin/delete-all-files-of-a-user', { userId: user.value.id });
await misskeyApi('admin/delete-all-files-of-a-user', { userId: user.value.id });
os.success();
};
await process().catch(err => {
@ -406,7 +407,7 @@ async function deleteAccount() {
}
async function assignRole() {
const roles = await os.api('admin/roles/list');
const roles = await misskeyApi('admin/roles/list');
const { canceled, result: roleId } = await os.select({
title: i18n.ts._role.chooseRoleToAssign,
@ -482,7 +483,7 @@ watch(() => props.userId, () => {
});
watch(user, () => {
os.api('ap/get', {
misskeyApi('ap/get', {
uri: user.value.uri ?? `${url}/users/${user.value.id}`,
}).then(res => {
ap.value = res;

View file

@ -96,6 +96,7 @@ import MkFolder from '@/components/MkFolder.vue';
import MkSelect from '@/components/MkSelect.vue';
import FormSplit from '@/components/form/split.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -108,7 +109,7 @@ const daysOfWeek: string[] = [i18n.ts._weekday.sunday, i18n.ts._weekday.monday,
const filterType = ref('all');
let publishing: boolean | null = null;
os.api('admin/ad/list', { publishing: publishing }).then(adsResponse => {
misskeyApi('admin/ad/list', { publishing: publishing }).then(adsResponse => {
if (adsResponse != null) {
ads.value = adsResponse.map(r => {
const exdate = new Date(r.expiresAt);
@ -174,7 +175,7 @@ function remove(ad) {
function save(ad) {
if (ad.id == null) {
os.api('admin/ad/create', {
misskeyApi('admin/ad/create', {
...ad,
expiresAt: new Date(ad.expiresAt).getTime(),
startsAt: new Date(ad.startsAt).getTime(),
@ -191,7 +192,7 @@ function save(ad) {
});
});
} else {
os.api('admin/ad/update', {
misskeyApi('admin/ad/update', {
...ad,
expiresAt: new Date(ad.expiresAt).getTime(),
startsAt: new Date(ad.startsAt).getTime(),
@ -210,7 +211,7 @@ function save(ad) {
}
function more() {
os.api('admin/ad/list', { untilId: ads.value.reduce((acc, ad) => ad.id != null ? ad : acc).id, publishing: publishing }).then(adsResponse => {
misskeyApi('admin/ad/list', { untilId: ads.value.reduce((acc, ad) => ad.id != null ? ad : acc).id, publishing: publishing }).then(adsResponse => {
if (adsResponse == null) return;
ads.value = ads.value.concat(adsResponse.map(r => {
const exdate = new Date(r.expiresAt);
@ -227,7 +228,7 @@ function more() {
}
function refresh() {
os.api('admin/ad/list', { publishing: publishing }).then(adsResponse => {
misskeyApi('admin/ad/list', { publishing: publishing }).then(adsResponse => {
if (adsResponse == null) return;
ads.value = adsResponse.map(r => {
const exdate = new Date(r.expiresAt);

View file

@ -79,6 +79,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
import MkRadios from '@/components/MkRadios.vue';
import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkFolder from '@/components/MkFolder.vue';
@ -86,7 +87,7 @@ import MkTextarea from '@/components/MkTextarea.vue';
const announcements = ref<any[]>([]);
os.api('admin/announcements/list').then(announcementResponse => {
misskeyApi('admin/announcements/list').then(announcementResponse => {
announcements.value = announcementResponse;
});
@ -112,7 +113,7 @@ function del(announcement) {
}).then(({ canceled }) => {
if (canceled) return;
announcements.value = announcements.value.filter(x => x !== announcement);
os.api('admin/announcements/delete', announcement);
misskeyApi('admin/announcements/delete', announcement);
});
}
@ -134,13 +135,13 @@ async function save(announcement) {
}
function more() {
os.api('admin/announcements/list', { untilId: announcements.value.reduce((acc, announcement) => announcement.id != null ? announcement : acc).id }).then(announcementResponse => {
misskeyApi('admin/announcements/list', { untilId: announcements.value.reduce((acc, announcement) => announcement.id != null ? announcement : acc).id }).then(announcementResponse => {
announcements.value = announcements.value.concat(announcementResponse);
});
}
function refresh() {
os.api('admin/announcements/list').then(announcementResponse => {
misskeyApi('admin/announcements/list').then(announcementResponse => {
announcements.value = announcementResponse;
});
}

View file

@ -72,6 +72,7 @@ import MkButton from '@/components/MkButton.vue';
import FormSuspense from '@/components/form/suspense.vue';
import FormSlot from '@/components/form/slot.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
@ -86,7 +87,7 @@ const turnstileSiteKey = ref<string | null>(null);
const turnstileSecretKey = ref<string | null>(null);
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
hcaptchaSiteKey.value = meta.hcaptchaSiteKey;
hcaptchaSecretKey.value = meta.hcaptchaSecretKey;
recaptchaSiteKey.value = meta.recaptchaSiteKey;

View file

@ -101,6 +101,7 @@ import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import FormSuspense from '@/components/form/suspense.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { instance, fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -122,7 +123,7 @@ const notFoundImageUrl = ref<string | null>(null);
const manifestJsonOverride = ref<string>('{}');
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
iconUrl.value = meta.iconUrl;
app192IconUrl.value = meta.app192IconUrl;
app512IconUrl.value = meta.app512IconUrl;

View file

@ -21,13 +21,13 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed } from 'vue';
import FormSuspense from '@/components/form/suspense.vue';
import MkKeyValue from '@/components/MkKeyValue.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import bytes from '@/filters/bytes.js';
import number from '@/filters/number.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const databasePromiseFactory = () => os.api('admin/get-table-stats').then(res => Object.entries(res).sort((a, b) => b[1].size - a[1].size));
const databasePromiseFactory = () => misskeyApi('admin/get-table-stats').then(res => Object.entries(res).sort((a, b) => b[1].size - a[1].size));
const headerActions = computed(() => []);

View file

@ -73,6 +73,7 @@ import FormSuspense from '@/components/form/suspense.vue';
import FormSplit from '@/components/form/split.vue';
import FormSection from '@/components/form/section.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance, instance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -87,7 +88,7 @@ const smtpUser = ref<string>('');
const smtpPass = ref<string>('');
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
enableEmail.value = meta.enableEmail;
email.value = meta.email;
smtpSecure.value = meta.smtpSecure;

View file

@ -42,6 +42,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
import FormSuspense from '@/components/form/suspense.vue';
import FormSection from '@/components/form/section.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -50,7 +51,7 @@ const deeplAuthKey = ref<string>('');
const deeplIsPro = ref<boolean>(false);
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
deeplAuthKey.value = meta.deeplAuthKey;
deeplIsPro.value = meta.deeplIsPro;
}

View file

@ -42,6 +42,7 @@ import MkInput from '@/components/MkInput.vue';
import MkSelect from '@/components/MkSelect.vue';
import MkFileListForAdmin from '@/components/MkFileListForAdmin.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -83,7 +84,7 @@ async function find() {
});
if (canceled) return;
os.api('admin/drive/show-file', q.startsWith('http://') || q.startsWith('https://') ? { url: q.trim() } : { fileId: q.trim() }).then(file => {
misskeyApi('admin/drive/show-file', q.startsWith('http://') || q.startsWith('https://') ? { url: q.trim() } : { fileId: q.trim() }).then(file => {
show(file);
}).catch(err => {
if (err.code === 'NO_SUCH_FILE') {

View file

@ -34,6 +34,7 @@ import MkSuperMenu from '@/components/MkSuperMenu.vue';
import MkInfo from '@/components/MkInfo.vue';
import { instance } from '@/instance.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { lookupUser, lookupUserByEmail } from '@/scripts/lookup-user.js';
import { useRouter } from '@/router.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
@ -62,7 +63,7 @@ let noEmailServer = !instance.enableEmail;
const thereIsUnresolvedAbuseReport = ref(false);
const currentPage = computed(() => router.currentRef.value.child);
os.api('admin/abuse-user-reports', {
misskeyApi('admin/abuse-user-reports', {
state: 'unresolved',
limit: 1,
}).then(reports => {
@ -266,7 +267,7 @@ provideMetadataReceiver((info) => {
});
function invite() {
os.api('admin/invite/create').then(x => {
misskeyApi('admin/invite/create').then(x => {
os.alert({
type: 'info',
text: x[0].code,

View file

@ -29,6 +29,7 @@ import MkButton from '@/components/MkButton.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import FormSuspense from '@/components/form/suspense.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -38,7 +39,7 @@ const silencedHosts = ref<string>('');
const tab = ref('block');
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
blockedHosts.value = meta.blockedHosts.join('\n');
silencedHosts.value = meta.silencedHosts.join('\n');
}

View file

@ -59,6 +59,7 @@ import { computed, ref, shallowRef } from 'vue';
import XHeader from './_header_.vue';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import MkButton from '@/components/MkButton.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkSelect from '@/components/MkSelect.vue';
@ -93,14 +94,14 @@ async function createWithOptions() {
count: createCount.value,
};
const tickets = await os.api('admin/invite/create', options);
const tickets = await misskeyApi('admin/invite/create', options);
os.alert({
type: 'success',
title: i18n.ts.inviteCodeCreated,
text: tickets?.map(x => x.code).join('\n'),
text: tickets.map(x => x.code).join('\n'),
});
tickets?.forEach(ticket => pagingComponent.value?.prepend(ticket));
tickets.forEach(ticket => pagingComponent.value?.prepend(ticket));
}
function deleted(id: string) {

View file

@ -66,6 +66,7 @@ import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import FormSuspense from '@/components/form/suspense.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -81,7 +82,7 @@ const tosUrl = ref<string | null>(null);
const privacyPolicyUrl = ref<string | null>(null);
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
enableRegistration.value = !meta.disableRegistration;
emailRequiredForSignup.value = meta.emailRequiredForSignup;
sensitiveWords.value = meta.sensitiveWords.join('\n');

View file

@ -90,6 +90,7 @@ import MkInput from '@/components/MkInput.vue';
import FormSuspense from '@/components/form/suspense.vue';
import FormSplit from '@/components/form/split.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -110,7 +111,7 @@ const objectStorageSetPublicRead = ref<boolean>(false);
const objectStorageS3ForcePathStyle = ref<boolean>(true);
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
useObjectStorage.value = meta.useObjectStorage;
objectStorageBaseUrl.value = meta.objectStorageBaseUrl;
objectStorageBucket.value = meta.objectStorageBucket;

View file

@ -47,6 +47,7 @@ import { ref, computed } from 'vue';
import XHeader from './_header_.vue';
import FormSuspense from '@/components/form/suspense.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -58,7 +59,7 @@ const enableChartsForRemoteUser = ref<boolean>(false);
const enableChartsForFederatedInstances = ref<boolean>(false);
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
enableServerMachineStats.value = meta.enableServerMachineStats;
enableIdenticonGeneration.value = meta.enableIdenticonGeneration;
enableChartsForRemoteUser.value = meta.enableChartsForRemoteUser;

View file

@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { onMounted, shallowRef, ref } from 'vue';
import { Chart } from 'chart.js';
import gradient from 'chartjs-plugin-gradient';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { chartVLine } from '@/scripts/chart-vline.js';
@ -52,7 +52,7 @@ async function renderChart() {
}));
};
const raw = await os.api('charts/active-users', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/active-users', { limit: chartLimit, span: 'day' });
const vLineColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)';

View file

@ -23,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { onMounted, shallowRef, ref } from 'vue';
import { Chart } from 'chart.js';
import gradient from 'chartjs-plugin-gradient';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { chartVLine } from '@/scripts/chart-vline.js';
import { defaultStore } from '@/store.js';
@ -65,7 +65,7 @@ onMounted(async () => {
}));
};
const raw = await os.api('charts/ap-request', { limit: chartLimit, span: 'day' });
const raw = await misskeyApi('charts/ap-request', { limit: chartLimit, span: 'day' });
const vLineColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)';
const succColor = '#87e000';

View file

@ -49,6 +49,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { onMounted, ref } from 'vue';
import XPie, { type InstanceForPie } from './overview.pie.vue';
import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import number from '@/filters/number.js';
import MkNumberDiff from '@/components/MkNumberDiff.vue';
import { i18n } from '@/i18n.js';
@ -65,13 +66,13 @@ const fetching = ref(true);
const { handler: externalTooltipHandler } = useChartTooltip();
onMounted(async () => {
const chart = await os.apiGet('charts/federation', { limit: 2, span: 'day' });
const chart = await misskeyApiGet('charts/federation', { limit: 2, span: 'day' });
federationPubActive.value = chart.pubActive[0];
federationPubActiveDiff.value = chart.pubActive[0] - chart.pubActive[1];
federationSubActive.value = chart.subActive[0];
federationSubActiveDiff.value = chart.subActive[0] - chart.subActive[1];
os.apiGet('federation/stats', { limit: 10 }).then(res => {
misskeyApiGet('federation/stats', { limit: 10 }).then(res => {
topSubInstancesForPie.value = [
...res.topSubInstances.map(x => ({
name: x.host,

View file

@ -18,8 +18,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { useInterval } from '@/scripts/use-interval.js';
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
import { defaultStore } from '@/store.js';
@ -28,7 +28,7 @@ const instances = ref<Misskey.entities.FederationInstance[]>([]);
const fetching = ref(true);
const fetch = async () => {
const fetchedInstances = await os.api('federation/instances', {
const fetchedInstances = await misskeyApi('federation/instances', {
sort: '+latestRequestReceivedAt',
limit: 6,
});

View file

@ -18,15 +18,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { defaultStore } from '@/store.js';
const moderators = ref<Misskey.entities.UserDetailed[] | null>(null);
const fetching = ref(true);
onMounted(async () => {
moderators.value = await os.api('admin/show-users', {
moderators.value = await misskeyApi('admin/show-users', {
sort: '+lastActiveDate',
state: 'adminOrModerator',
limit: 30,

View file

@ -63,7 +63,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
import MkNumberDiff from '@/components/MkNumberDiff.vue';
import MkNumber from '@/components/MkNumber.vue';
import { i18n } from '@/i18n.js';
@ -78,17 +78,17 @@ const fetching = ref(true);
onMounted(async () => {
const [_stats, _onlineUsersCount] = await Promise.all([
os.api('stats', {}),
os.apiGet('get-online-users-count').then(res => res.count),
misskeyApi('stats', {}),
misskeyApiGet('get-online-users-count').then(res => res.count),
]);
stats.value = _stats;
onlineUsersCount.value = _onlineUsersCount;
os.apiGet('charts/users', { limit: 2, span: 'day' }).then(chart => {
misskeyApiGet('charts/users', { limit: 2, span: 'day' }).then(chart => {
usersComparedToThePrevDay.value = stats.value.originalUsersCount - chart.local.total[1];
});
os.apiGet('charts/notes', { limit: 2, span: 'day' }).then(chart => {
misskeyApiGet('charts/notes', { limit: 2, span: 'day' }).then(chart => {
notesComparedToThePrevDay.value = stats.value.originalNotesCount - chart.local.total[1];
});

View file

@ -18,8 +18,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { useInterval } from '@/scripts/use-interval.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
import { defaultStore } from '@/store.js';
@ -28,7 +28,7 @@ const newUsers = ref<Misskey.entities.UserDetailed[] | null>(null);
const fetching = ref(true);
const fetch = async () => {
const _newUsers = await os.api('admin/show-users', {
const _newUsers = await misskeyApi('admin/show-users', {
limit: 5,
sort: '+createdAt',
origin: 'local',

View file

@ -79,6 +79,7 @@ import XModerators from './overview.moderators.vue';
import XHeatmap from './overview.heatmap.vue';
import type { InstanceForPie } from './overview.pie.vue';
import * as os from '@/os.js';
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -117,14 +118,14 @@ onMounted(async () => {
magicGrid.listen();
*/
os.apiGet('charts/federation', { limit: 2, span: 'day' }).then(chart => {
misskeyApiGet('charts/federation', { limit: 2, span: 'day' }).then(chart => {
federationPubActive.value = chart.pubActive[0];
federationPubActiveDiff.value = chart.pubActive[0] - chart.pubActive[1];
federationSubActive.value = chart.subActive[0];
federationSubActiveDiff.value = chart.subActive[0] - chart.subActive[1];
});
os.apiGet('federation/stats', { limit: 10 }).then(res => {
misskeyApiGet('federation/stats', { limit: 10 }).then(res => {
topSubInstancesForPie.value = [
...res.topSubInstances.map(x => ({
name: x.host,
@ -149,18 +150,18 @@ onMounted(async () => {
];
});
os.api('admin/server-info').then(serverInfoResponse => {
misskeyApi('admin/server-info').then(serverInfoResponse => {
serverInfo.value = serverInfoResponse;
});
os.api('admin/show-users', {
misskeyApi('admin/show-users', {
limit: 5,
sort: '+createdAt',
}).then(res => {
newUsers.value = res;
});
os.api('federation/instances', {
misskeyApi('federation/instances', {
sort: '+latestRequestReceivedAt',
limit: 25,
}).then(res => {

View file

@ -28,6 +28,7 @@ import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue';
import FormSuspense from '@/components/form/suspense.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -36,10 +37,10 @@ const proxyAccount = ref<Misskey.entities.UserDetailed | null>(null);
const proxyAccountId = ref<string | null>(null);
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
proxyAccountId.value = meta.proxyAccountId;
if (proxyAccountId.value) {
proxyAccount.value = await os.api('users/show', { userId: proxyAccountId.value });
proxyAccount.value = await misskeyApi('users/show', { userId: proxyAccountId.value });
}
}

View file

@ -51,7 +51,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue';
import XChart from './queue.chart.chart.vue';
import number from '@/filters/number.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
import MkFolder from '@/components/MkFolder.vue';
@ -105,7 +105,7 @@ const onStatsLog = (statsLog) => {
onMounted(() => {
if (props.domain === 'inbox' || props.domain === 'deliver') {
os.api(`admin/queue/${props.domain}-delayed`).then(result => {
misskeyApi(`admin/queue/${props.domain}-delayed`).then(result => {
jobs.value = result;
});
}

View file

@ -29,6 +29,7 @@ import * as Misskey from 'misskey-js';
import XHeader from './_header_.vue';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -41,7 +42,7 @@ async function addRelay() {
placeholder: i18n.ts.inboxUrl,
});
if (canceled) return;
os.api('admin/relays/add', {
misskeyApi('admin/relays/add', {
inbox,
}).then((relay: any) => {
refresh();
@ -54,7 +55,7 @@ async function addRelay() {
}
function remove(inbox: string) {
os.api('admin/relays/remove', {
misskeyApi('admin/relays/remove', {
inbox,
}).then(() => {
refresh();
@ -67,7 +68,7 @@ function remove(inbox: string) {
}
function refresh() {
os.api('admin/relays/list').then(relayList => {
misskeyApi('admin/relays/list').then(relayList => {
relays.value = relayList;
});
}

View file

@ -28,6 +28,7 @@ import { v4 as uuid } from 'uuid';
import XHeader from './_header_.vue';
import XEditor from './roles.editor.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { useRouter } from '@/router.js';
@ -44,7 +45,7 @@ const role = ref<Misskey.entities.Role | null>(null);
const data = ref<any>(null);
if (props.id) {
role.value = await os.api('admin/roles/show', {
role.value = await misskeyApi('admin/roles/show', {
roleId: props.id,
});

View file

@ -67,6 +67,7 @@ import XHeader from './_header_.vue';
import XEditor from './roles.editor.vue';
import MkFolder from '@/components/MkFolder.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { useRouter } from '@/router.js';
@ -92,7 +93,7 @@ const usersPagination = {
const expandedItems = ref([]);
const role = reactive(await os.api('admin/roles/show', {
const role = reactive(await misskeyApi('admin/roles/show', {
roleId: props.id,
}));

View file

@ -233,6 +233,7 @@ import MkButton from '@/components/MkButton.vue';
import MkRange from '@/components/MkRange.vue';
import MkRolePreview from '@/components/MkRolePreview.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { instance } from '@/instance.js';
@ -243,7 +244,7 @@ import { ROLE_POLICIES } from '@/const.js';
const router = useRouter();
const baseRoleQ = ref('');
const roles = await os.api('admin/roles/list');
const roles = await misskeyApi('admin/roles/list');
const policies = reactive<Record<typeof ROLE_POLICIES[number], any>>({});
for (const ROLE_POLICY of ROLE_POLICIES) {

View file

@ -148,6 +148,7 @@ import MkInput from '@/components/MkInput.vue';
import MkButton from '@/components/MkButton.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -170,7 +171,7 @@ const truemailAuthKey = ref<string | null>(null);
const bannedEmailDomains = ref<string>('');
async function init() {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
summalyProxy.value = meta.summalyProxy;
enableHcaptcha.value = meta.enableHcaptcha;
enableRecaptcha.value = meta.enableRecaptcha;

View file

@ -158,6 +158,7 @@ import FormSection from '@/components/form/section.vue';
import FormSplit from '@/components/form/split.vue';
import FormSuspense from '@/components/form/suspense.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -184,7 +185,7 @@ const perUserListTimelineCacheMax = ref<number>(0);
const notesPerOneAd = ref<number>(0);
async function init(): Promise<void> {
const meta = await os.api('admin/meta');
const meta = await misskeyApi('admin/meta');
name.value = meta.name;
shortName.value = meta.shortName;
description.value = meta.description;

View file

@ -45,6 +45,7 @@ import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { $i, updateAccount } from '@/account.js';
@ -84,7 +85,7 @@ async function read(announcement) {
a.isRead = true;
return a;
});
os.api('i/read-announcement', { announcementId: announcement.id });
misskeyApi('i/read-announcement', { announcementId: announcement.id });
updateAccount({
unreadAnnouncements: $i!.unreadAnnouncements.filter(a => a.id !== announcement.id),
});

View file

@ -29,6 +29,7 @@ import * as Misskey from 'misskey-js';
import MkTimeline from '@/components/MkTimeline.vue';
import { scroll } from '@/scripts/scroll.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useRouter } from '@/router.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js';
@ -73,7 +74,7 @@ function focus() {
}
watch(() => props.antennaId, async () => {
antenna.value = await os.api('antennas/show', {
antenna.value = await misskeyApi('antennas/show', {
antennaId: props.antennaId,
});
}, { immediate: true });

View file

@ -41,7 +41,7 @@ import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const body = ref('{}');
@ -51,14 +51,14 @@ const sending = ref(false);
const res = ref('');
const withCredential = ref(true);
os.api('endpoints').then(endpointResponse => {
misskeyApi('endpoints').then(endpointResponse => {
endpoints.value = endpointResponse;
});
function send() {
sending.value = true;
const requestBody = JSON5.parse(body.value);
os.api(endpoint.value as keyof Endpoints, requestBody, requestBody.i || (withCredential.value ? undefined : null)).then(resp => {
misskeyApi(endpoint.value as keyof Endpoints, requestBody, requestBody.i || (withCredential.value ? undefined : null)).then(resp => {
sending.value = false;
res.value = JSON5.stringify(resp, null, 2);
}, err => {
@ -68,7 +68,7 @@ function send() {
}
function onEndpointChange() {
os.api('endpoint', { endpoint: endpoint.value }, withCredential.value ? undefined : null).then(resp => {
misskeyApi('endpoint', { endpoint: endpoint.value }, withCredential.value ? undefined : null).then(resp => {
const endpointBody = {};
for (const p of resp.params) {
endpointBody[p.name] =

View file

@ -23,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
@ -44,7 +44,7 @@ const name = computed(() => {
});
function cancel() {
os.api('auth/deny', {
misskeyApi('auth/deny', {
token: props.session.token,
}).then(() => {
emit('denied');
@ -52,7 +52,7 @@ function cancel() {
}
function accept() {
os.api('auth/accept', {
misskeyApi('auth/accept', {
token: props.session.token,
}).then(() => {
emit('accepted');

View file

@ -46,7 +46,7 @@ import { onMounted, ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import XForm from './auth.form.vue';
import MkSignin from '@/components/MkSignin.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { $i, login } from '@/account.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js';
@ -75,13 +75,13 @@ onMounted(async () => {
if (!$i) return;
try {
session.value = await os.api('auth/session/show', {
session.value = await misskeyApi('auth/session/show', {
token: props.token,
});
//
if (session.value.app.isAuthorized) {
await os.api('auth/accept', {
await misskeyApi('auth/accept', {
token: session.value.token,
});
accepted();

View file

@ -40,6 +40,7 @@ import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkFolder from '@/components/MkFolder.vue';
@ -63,7 +64,7 @@ function del(avatarDecoration) {
}).then(({ canceled }) => {
if (canceled) return;
avatarDecorations.value = avatarDecorations.value.filter(x => x !== avatarDecoration);
os.api('admin/avatar-decorations/delete', avatarDecoration);
misskeyApi('admin/avatar-decorations/delete', avatarDecoration);
});
}
@ -77,7 +78,7 @@ async function save(avatarDecoration) {
}
function load() {
os.api('admin/avatar-decorations/list').then(_avatarDecorations => {
misskeyApi('admin/avatar-decorations/list').then(_avatarDecorations => {
avatarDecorations.value = _avatarDecorations;
});
}

View file

@ -76,6 +76,7 @@ import MkInput from '@/components/MkInput.vue';
import MkColorInput from '@/components/MkColorInput.vue';
import { selectFile } from '@/scripts/select-file.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useRouter } from '@/router.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js';
@ -105,7 +106,7 @@ watch(() => bannerId.value, async () => {
if (bannerId.value == null) {
bannerUrl.value = null;
} else {
bannerUrl.value = (await os.api('drive/files/show', {
bannerUrl.value = (await misskeyApi('drive/files/show', {
fileId: bannerId.value,
})).url;
}
@ -114,7 +115,7 @@ watch(() => bannerId.value, async () => {
async function fetchChannel() {
if (props.channelId == null) return;
channel.value = await os.api('channels/show', {
channel.value = await misskeyApi('channels/show', {
channelId: props.channelId,
});
@ -179,7 +180,7 @@ async function archive() {
if (canceled) return;
os.api('channels/update', {
misskeyApi('channels/update', {
channelId: props.channelId,
isArchived: true,
}).then(() => {

View file

@ -74,6 +74,7 @@ import MkPostForm from '@/components/MkPostForm.vue';
import MkTimeline from '@/components/MkTimeline.vue';
import XChannelFollowButton from '@/components/MkChannelFollowButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useRouter } from '@/router.js';
import { $i, iAmModerator } from '@/account.js';
import { i18n } from '@/i18n.js';
@ -113,7 +114,7 @@ const featuredPagination = computed(() => ({
}));
watch(() => props.channelId, async () => {
channel.value = await os.api('channels/show', {
channel.value = await misskeyApi('channels/show', {
channelId: props.channelId,
});
favorited.value = channel.value.isFavorited ?? false;

View file

@ -32,6 +32,7 @@ import MkNotes from '@/components/MkNotes.vue';
import { $i } from '@/account.js';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { url } from '@/config.js';
import MkButton from '@/components/MkButton.vue';
@ -56,7 +57,7 @@ const pagination = {
const isOwned = computed<boolean | null>(() => $i && clip.value && ($i.id === clip.value.userId));
watch(() => props.clipId, async () => {
clip.value = await os.api('clips/show', {
clip.value = await misskeyApi('clips/show', {
clipId: props.clipId,
});
favorited.value = clip.value.isFavorited;

View file

@ -82,6 +82,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
import FormSplit from '@/components/form/split.vue';
import { selectFile } from '@/scripts/select-file.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -177,7 +178,7 @@ const menu = (ev: MouseEvent) => {
icon: 'ti ti-download',
text: i18n.ts.export,
action: async () => {
os.api('export-custom-emojis', {
misskeyApi('export-custom-emojis', {
})
.then(() => {
os.alert({
@ -196,7 +197,7 @@ const menu = (ev: MouseEvent) => {
text: i18n.ts.import,
action: async () => {
const file = await selectFile(ev.currentTarget ?? ev.target);
os.api('admin/emoji/import-zip', {
misskeyApi('admin/emoji/import-zip', {
fileId: file.id,
})
.then(() => {

View file

@ -79,6 +79,7 @@ import bytes from '@/filters/bytes.js';
import { infoImageUrl } from '@/instance.js';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useRouter } from '@/router.js';
const router = useRouter();
@ -94,7 +95,7 @@ const isImage = computed(() => file.value?.type.startsWith('image/'));
async function fetch() {
fetching.value = true;
file.value = await os.api('drive/files/show', {
file.value = await misskeyApi('drive/files/show', {
fileId: props.fileId,
}).catch((err) => {
console.error(err);

View file

@ -85,6 +85,7 @@ import MkInput from '@/components/MkInput.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkFolder from '@/components/MkFolder.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { customEmojiCategories } from '@/custom-emojis.js';
import MkSwitch from '@/components/MkSwitch.vue';
@ -107,7 +108,7 @@ const rolesThatCanBeUsedThisEmojiAsReaction = ref<Misskey.entities.Role[]>([]);
const file = ref<Misskey.entities.DriveFile>();
watch(roleIdsThatCanBeUsedThisEmojiAsReaction, async () => {
rolesThatCanBeUsedThisEmojiAsReaction.value = (await Promise.all(roleIdsThatCanBeUsedThisEmojiAsReaction.value.map((id) => os.api('admin/roles/show', { roleId: id }).catch(() => null)))).filter(x => x != null);
rolesThatCanBeUsedThisEmojiAsReaction.value = (await Promise.all(roleIdsThatCanBeUsedThisEmojiAsReaction.value.map((id) => misskeyApi('admin/roles/show', { roleId: id }).catch(() => null)))).filter(x => x != null);
}, { immediate: true });
const imgUrl = computed(() => file.value ? file.value.url : props.emoji ? `/emoji/${props.emoji.name}.webp` : null);
@ -126,7 +127,7 @@ async function changeImage(ev) {
}
async function addRole() {
const roles = await os.api('admin/roles/list');
const roles = await misskeyApi('admin/roles/list');
const currentRoleIds = rolesThatCanBeUsedThisEmojiAsReaction.value.map(x => x.id);
const { canceled, result: role } = await os.select({
@ -188,7 +189,7 @@ async function del() {
});
if (canceled) return;
os.api('admin/emoji/delete', {
misskeyApi('admin/emoji/delete', {
id: props.emoji.id,
}).then(() => {
emit('done', {

View file

@ -16,6 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { } from 'vue';
import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { i18n } from '@/i18n.js';
@ -43,7 +44,7 @@ function menu(ev) {
text: i18n.ts.info,
icon: 'ti ti-info-circle',
action: () => {
os.apiGet('emoji', { name: props.emoji.name }).then(res => {
misskeyApiGet('emoji', { name: props.emoji.name }).then(res => {
os.alert({
type: 'info',
text: `Name: ${res.name}\nAliases: ${res.aliases.join(' ')}\nCategory: ${res.category}\nisSensitive: ${res.isSensitive}\nlocalOnly: ${res.localOnly}\nLicense: ${res.license}\nURL: ${res.url}`,

View file

@ -15,11 +15,11 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkRolePreview from '@/components/MkRolePreview.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const roles = ref<Misskey.entities.Role[] | null>(null);
os.api('roles/list').then(res => {
misskeyApi('roles/list').then(res => {
roles.value = res.filter(x => x.target === 'manual').sort((a, b) => b.displayOrder - a.displayOrder);
});
</script>

View file

@ -68,7 +68,7 @@ import * as Misskey from 'misskey-js';
import MkUserList from '@/components/MkUserList.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
import MkTab from '@/components/MkTab.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
@ -123,14 +123,14 @@ const recentlyRegisteredUsersF = { endpoint: 'users', limit: 10, noPaging: true,
sort: '+createdAt',
} };
os.api('hashtags/list', {
misskeyApi('hashtags/list', {
sort: '+attachedLocalUsers',
attachedToLocalUserOnly: true,
limit: 30,
}).then(tags => {
tagsLocal.value = tags;
});
os.api('hashtags/list', {
misskeyApi('hashtags/list', {
sort: '+attachedRemoteUsers',
attachedToRemoteUserOnly: true,
limit: 30,

View file

@ -38,6 +38,7 @@ import { computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkTextarea from '@/components/MkTextarea.vue';
@ -369,7 +370,7 @@ const flash = ref<Misskey.entities.Flash | null>(null);
const visibility = ref<Misskey.entities.FlashUpdateRequest['visibility']>('public');
if (props.id) {
flash.value = await os.api('flash/show', {
flash.value = await misskeyApi('flash/show', {
flashId: props.id,
});
}

View file

@ -62,6 +62,7 @@ import * as Misskey from 'misskey-js';
import { Interpreter, Parser, values } from '@syuilo/aiscript';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { url } from '@/config.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -84,7 +85,7 @@ const error = ref<any>(null);
function fetchFlash() {
flash.value = null;
os.api('flash/show', {
misskeyApi('flash/show', {
flashId: props.id,
}).then(_flash => {
flash.value = _flash;

View file

@ -41,7 +41,7 @@ import { shallowRef, computed } from 'vue';
import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue';
import { userPage, acct } from '@/filters/user.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { infoImageUrl } from '@/instance.js';
@ -54,13 +54,13 @@ const pagination = {
};
function accept(user) {
os.api('following/requests/accept', { userId: user.id }).then(() => {
misskeyApi('following/requests/accept', { userId: user.id }).then(() => {
paginationComponent.value.reload();
});
}
function reject(user) {
os.api('following/requests/reject', { userId: user.id }).then(() => {
misskeyApi('following/requests/reject', { userId: user.id }).then(() => {
paginationComponent.value.reload();
});
}

View file

@ -12,9 +12,10 @@ SPDX-License-Identifier: AGPL-3.0-only
import { } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { mainRouter } from '@/router.js';
import { i18n } from '@/i18n.js';
import { defaultStore } from "@/store.js";
import { defaultStore } from '@/store.js';
async function follow(user): Promise<void> {
const { canceled } = await os.confirm({
@ -42,7 +43,7 @@ if (acct == null) {
let promise;
if (acct.startsWith('https://')) {
promise = os.api('ap/show', {
promise = misskeyApi('ap/show', {
uri: acct,
});
promise.then(res => {
@ -60,7 +61,7 @@ if (acct.startsWith('https://')) {
}
});
} else {
promise = os.api('users/show', Misskey.acct.parse(acct));
promise = misskeyApi('users/show', Misskey.acct.parse(acct));
promise.then(user => {
follow(user);
});

View file

@ -47,6 +47,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
import FormSuspense from '@/components/form/suspense.vue';
import { selectFiles } from '@/scripts/select-file.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { useRouter } from '@/router.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js';
@ -107,7 +108,7 @@ async function del() {
}
watch(() => props.postId, () => {
init.value = () => props.postId ? os.api('gallery/posts/show', {
init.value = () => props.postId ? misskeyApi('gallery/posts/show', {
postId: props.postId,
}).then(post => {
files.value = post.files ?? [];

View file

@ -66,6 +66,7 @@ import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import MkContainer from '@/components/MkContainer.vue';
import MkPagination from '@/components/MkPagination.vue';
import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue';
@ -97,7 +98,7 @@ const otherPostsPagination = {
function fetchPost() {
post.value = null;
os.api('gallery/posts/show', {
misskeyApi('gallery/posts/show', {
postId: props.postId,
}).then(_post => {
post.value = _post;

View file

@ -105,6 +105,7 @@ import MkInfo from '@/components/MkInfo.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkKeyValue from '@/components/MkKeyValue.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { AiScriptPluginMeta, parsePluginMeta, installPlugin } from '@/scripts/install-plugin.js';
import { parseThemeCode, installTheme } from '@/scripts/install-theme.js';
import { unisonReload } from '@/scripts/unison-reload.js';
@ -159,7 +160,7 @@ async function fetch() {
uiPhase.value = 'error';
return;
}
const res = await os.api('fetch-external-resources', {
const res = await misskeyApi('fetch-external-resources', {
url: url.value,
hash: hash.value,
}).catch((err) => {

View file

@ -129,6 +129,7 @@ import MkKeyValue from '@/components/MkKeyValue.vue';
import MkSelect from '@/components/MkSelect.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import number from '@/filters/number.js';
import { iAmModerator, iAmAdmin } from '@/account.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -164,9 +165,9 @@ const usersPagination = {
async function fetch(): Promise<void> {
if (iAmAdmin) {
meta.value = await os.api('admin/meta');
meta.value = await misskeyApi('admin/meta');
}
instance.value = await os.api('federation/show-instance', {
instance.value = await misskeyApi('federation/show-instance', {
host: props.host,
});
suspended.value = instance.value?.isSuspended ?? false;
@ -179,7 +180,7 @@ async function toggleBlock(): Promise<void> {
if (!meta.value) throw new Error('No meta?');
if (!instance.value) throw new Error('No instance?');
const { host } = instance.value;
await os.api('admin/update-meta', {
await misskeyApi('admin/update-meta', {
blockedHosts: isBlocked.value ? meta.value.blockedHosts.concat([host]) : meta.value.blockedHosts.filter(x => x !== host),
});
}
@ -189,14 +190,14 @@ async function toggleSilenced(): Promise<void> {
if (!instance.value) throw new Error('No instance?');
const { host } = instance.value;
const silencedHosts = meta.value.silencedHosts ?? [];
await os.api('admin/update-meta', {
await misskeyApi('admin/update-meta', {
silencedHosts: isSilenced.value ? silencedHosts.concat([host]) : silencedHosts.filter(x => x !== host),
});
}
async function toggleSuspend(): Promise<void> {
if (!instance.value) throw new Error('No instance?');
await os.api('admin/federation/update-instance', {
await misskeyApi('admin/federation/update-instance', {
host: instance.value.host,
isSuspended: suspended.value,
});
@ -204,7 +205,7 @@ async function toggleSuspend(): Promise<void> {
function refreshMetadata(): void {
if (!instance.value) throw new Error('No instance?');
os.api('admin/federation/refresh-remote-instance-metadata', {
misskeyApi('admin/federation/refresh-remote-instance-metadata', {
host: instance.value.host,
});
os.alert({

Some files were not shown because too many files have changed in this diff Show more