wip
This commit is contained in:
parent
0a0c93df2a
commit
bc02fd5c4d
|
@ -127,7 +127,9 @@ rt {
|
|||
}
|
||||
|
||||
._button {
|
||||
@extend ._noSelect;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-webkit-touch-callout: none;
|
||||
appearance: none;
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
|
|
|
@ -7,15 +7,10 @@
|
|||
// よって、devモードとして起動されるときはビルド時に組み込む形としておく。
|
||||
// (pnpm start時はpugファイルの中で静的リソースとして読み込むようになっており、この問題は起こっていない)
|
||||
import '@tabler/icons-webfont/dist/tabler-icons.scss';
|
||||
import { embedPage } from '@/config.js';
|
||||
|
||||
await main();
|
||||
|
||||
if (embedPage) {
|
||||
import('@/_embed_boot_.js');
|
||||
} else {
|
||||
import('@/_boot_.js');
|
||||
}
|
||||
import('@/_boot_.js');
|
||||
|
||||
/**
|
||||
* backend/src/server/web/boot.jsで差し込まれている起動処理のうち、最低限必要なものを模倣するための処理
|
||||
|
|
|
@ -14,7 +14,6 @@ import { apiUrl } from '@/config.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';
|
||||
import { embedPage } from '@/config.js';
|
||||
|
||||
// TODO: 他のタブと永続化されたstateを同期
|
||||
|
||||
|
@ -23,7 +22,6 @@ type Account = Misskey.entities.MeDetailed & { token: string };
|
|||
const accountData = miLocalStorage.getItem('account');
|
||||
|
||||
function initAccount() {
|
||||
if (embedPage) return null;
|
||||
if (accountData) return reactive(JSON.parse(accountData) as Account);
|
||||
return null;
|
||||
}
|
||||
|
@ -85,14 +83,10 @@ export async function signout() {
|
|||
}
|
||||
|
||||
export async function getAccounts(): Promise<{ id: Account['id'], token: Account['token'] }[]> {
|
||||
if (embedPage) return [];
|
||||
|
||||
return (await get('accounts')) || [];
|
||||
}
|
||||
|
||||
export async function addAccount(id: Account['id'], token: Account['token']) {
|
||||
if (embedPage) return;
|
||||
|
||||
const accounts = await getAccounts();
|
||||
if (!accounts.some(x => x.id === id)) {
|
||||
await set('accounts', accounts.concat([{ id, token }]));
|
||||
|
@ -194,8 +188,6 @@ export async function refreshAccount() {
|
|||
}
|
||||
|
||||
export async function login(token: Account['token'], redirect?: string) {
|
||||
if (embedPage) return;
|
||||
|
||||
const showing = ref(true);
|
||||
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkWaitingDialog.vue')), {
|
||||
success: false,
|
||||
|
|
|
@ -8,7 +8,6 @@ import * as Misskey from 'misskey-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';
|
||||
import { embedPage } from '@/config.js';
|
||||
|
||||
// TODO: 他のタブと永続化されたstateを同期
|
||||
|
||||
|
@ -37,7 +36,7 @@ export const infoImageUrl = computed(() => instance.infoImageUrl ?? DEFAULT_INFO
|
|||
|
||||
export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFAULT_NOT_FOUND_IMAGE_URL);
|
||||
|
||||
export const isEnabledUrlPreview = computed(() => (instance.enableUrlPreview ?? true) && !embedPage);
|
||||
export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true);
|
||||
|
||||
export async function fetchInstance(force = false): Promise<Misskey.entities.MetaDetailed> {
|
||||
if (!force) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import {
|
|||
set as iset,
|
||||
del as idel,
|
||||
} from 'idb-keyval';
|
||||
import { embedPage } from '@/config.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
|
||||
const PREFIX = 'idbfallback::';
|
||||
|
@ -27,10 +26,7 @@ if (window.Cypress) {
|
|||
console.log('Cypress detected. It will use localStorage.');
|
||||
}
|
||||
|
||||
if (embedPage) {
|
||||
idbAvailable = false;
|
||||
console.log('Embed page detected. It will use safeSessionStorage.');
|
||||
} else if (idbAvailable) {
|
||||
if (idbAvailable) {
|
||||
await iset('idb-test', 'test')
|
||||
.catch(err => {
|
||||
console.error('idb error', err);
|
||||
|
|
|
@ -7,7 +7,6 @@ import { defineAsyncComponent, inject } from 'vue';
|
|||
import { $i } from '@/account.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { popup } from '@/os.js';
|
||||
import { embedPage } from '@/config.js';
|
||||
|
||||
export type OpenOnRemoteOptions = {
|
||||
/**
|
||||
|
@ -48,22 +47,18 @@ export type OpenOnRemoteOptions = {
|
|||
export function pleaseLogin(path?: string, openOnRemote?: OpenOnRemoteOptions) {
|
||||
if ($i) return;
|
||||
|
||||
if (embedPage) {
|
||||
window.open(path ?? '/', '_blank', 'noopener');
|
||||
} else {
|
||||
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {
|
||||
autoSet: true,
|
||||
message: openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired,
|
||||
openOnRemote,
|
||||
}, {
|
||||
cancelled: () => {
|
||||
if (path) {
|
||||
window.location.href = path;
|
||||
}
|
||||
},
|
||||
closed: () => dispose(),
|
||||
});
|
||||
}
|
||||
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {
|
||||
autoSet: true,
|
||||
message: openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired,
|
||||
openOnRemote,
|
||||
}, {
|
||||
cancelled: () => {
|
||||
if (path) {
|
||||
window.location.href = path;
|
||||
}
|
||||
},
|
||||
closed: () => dispose(),
|
||||
});
|
||||
|
||||
throw new Error('signin required');
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import { globalEvents } from '@/events.js';
|
|||
import lightTheme from '@/themes/_light.json5';
|
||||
import darkTheme from '@/themes/_dark.json5';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
import { embedPage } from '@/config.js';
|
||||
|
||||
export type Theme = {
|
||||
id: string;
|
||||
|
@ -96,9 +95,7 @@ export function applyTheme(theme: Theme, persist = true) {
|
|||
document.documentElement.style.setProperty(`--${k}`, v.toString());
|
||||
}
|
||||
|
||||
if (!embedPage) {
|
||||
document.documentElement.style.setProperty('color-scheme', colorScheme);
|
||||
}
|
||||
document.documentElement.style.setProperty('color-scheme', colorScheme);
|
||||
|
||||
if (persist) {
|
||||
miLocalStorage.setItem('theme', JSON.stringify(props));
|
||||
|
|
|
@ -7,8 +7,7 @@ import * as Misskey from 'misskey-js';
|
|||
import { markRaw } from 'vue';
|
||||
import { $i } from '@/account.js';
|
||||
import { wsOrigin } from '@/config.js';
|
||||
import { StreamMock } from '@/scripts/stream-mock.js';
|
||||
import { embedPage } from '@/config.js';
|
||||
//import { StreamMock } from '@/scripts/stream-mock.js';
|
||||
|
||||
// heart beat interval in ms
|
||||
const HEART_BEAT_INTERVAL = 1000 * 60;
|
||||
|
@ -21,14 +20,9 @@ export function useStream(): Misskey.IStream {
|
|||
if (stream) return stream;
|
||||
|
||||
// TODO: No Websocketモードもここで判定
|
||||
if (embedPage) {
|
||||
stream = markRaw(new StreamMock(wsOrigin, null));
|
||||
return stream;
|
||||
} else {
|
||||
stream = markRaw(new Misskey.Stream(wsOrigin, $i ? {
|
||||
token: $i.token,
|
||||
} : null));
|
||||
}
|
||||
stream = markRaw(new Misskey.Stream(wsOrigin, $i ? {
|
||||
token: $i.token,
|
||||
} : null));
|
||||
|
||||
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
|
||||
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
|
||||
|
|
Loading…
Reference in a new issue