This commit is contained in:
syuilo 2025-03-20 16:07:52 +09:00
parent f25963e2c2
commit 7f534a41a6
19 changed files with 32 additions and 32 deletions

View file

@ -14,7 +14,7 @@ import { subBoot } from '@/boot/sub-boot.js';
const subBootPaths = ['/share', '/auth', '/miauth', '/oauth', '/signup-complete', '/install-extensions']; const subBootPaths = ['/share', '/auth', '/miauth', '/oauth', '/signup-complete', '/install-extensions'];
if (subBootPaths.some(i => location.pathname === i || location.pathname.startsWith(i + '/'))) { if (subBootPaths.some(i => window.location.pathname === i || window.location.pathname.startsWith(i + '/'))) {
subBoot(); subBoot();
} else { } else {
mainBoot(); mainBoot();

View file

@ -191,7 +191,7 @@ export async function login(token: AccountWithToken['token'], redirect?: string)
// 他のタブは再読み込みするだけ // 他のタブは再読み込みするだけ
reloadChannel.postMessage(null); reloadChannel.postMessage(null);
// このページはredirectで指定された先に移動 // このページはredirectで指定された先に移動
location.href = redirect; window.location.href = redirect;
return; return;
} }

View file

@ -98,14 +98,14 @@ export async function common(createVue: () => App<Element>) {
document.addEventListener('touchend', () => {}, { passive: true }); document.addEventListener('touchend', () => {}, { passive: true });
// URLに#pswpを含む場合は取り除く // URLに#pswpを含む場合は取り除く
if (location.hash === '#pswp') { if (window.location.hash === '#pswp') {
history.replaceState(null, '', location.href.replace('#pswp', '')); history.replaceState(null, '', window.location.href.replace('#pswp', ''));
} }
// 一斉リロード // 一斉リロード
reloadChannel.addEventListener('message', path => { reloadChannel.addEventListener('message', path => {
if (path !== null) location.href = path; if (path !== null) window.location.href = path;
else location.reload(); else window.location.reload();
}); });
// If mobile, insert the viewport meta tag // If mobile, insert the viewport meta tag
@ -130,11 +130,11 @@ export async function common(createVue: () => App<Element>) {
}); });
//#region loginId //#region loginId
const params = new URLSearchParams(location.search); const params = new URLSearchParams(window.location.search);
const loginId = params.get('loginId'); const loginId = params.get('loginId');
if (loginId) { if (loginId) {
const target = getUrlWithoutLoginId(location.href); const target = getUrlWithoutLoginId(window.location.href);
if (!$i || $i.id !== loginId) { if (!$i || $i.id !== loginId) {
const account = await getAccountFromId(loginId); const account = await getAccountFromId(loginId);

View file

@ -43,7 +43,7 @@ export async function mainBoot() {
if (!$i) uiStyle = 'visitor'; if (!$i) uiStyle = 'visitor';
if (searchParams.has('zen')) uiStyle = 'zen'; if (searchParams.has('zen')) uiStyle = 'zen';
if (uiStyle === 'deck' && prefer.s['deck.useSimpleUiForNonRootPages'] && location.pathname !== '/') uiStyle = 'zen'; if (uiStyle === 'deck' && prefer.s['deck.useSimpleUiForNonRootPages'] && window.location.pathname !== '/') uiStyle = 'zen';
if (searchParams.has('ui')) uiStyle = searchParams.get('ui'); if (searchParams.has('ui')) uiStyle = searchParams.get('ui');
@ -216,7 +216,7 @@ export async function mainBoot() {
let reloadDialogShowing = false; let reloadDialogShowing = false;
stream.on('_disconnected_', async () => { stream.on('_disconnected_', async () => {
if (prefer.s.serverDisconnectedBehavior === 'reload') { if (prefer.s.serverDisconnectedBehavior === 'reload') {
location.reload(); window.location.reload();
} else if (prefer.s.serverDisconnectedBehavior === 'dialog') { } else if (prefer.s.serverDisconnectedBehavior === 'dialog') {
if (reloadDialogShowing) return; if (reloadDialogShowing) return;
reloadDialogShowing = true; reloadDialogShowing = true;
@ -227,7 +227,7 @@ export async function mainBoot() {
}); });
reloadDialogShowing = false; reloadDialogShowing = false;
if (!canceled) { if (!canceled) {
location.reload(); window.location.reload();
} }
} }
}); });
@ -458,7 +458,7 @@ export async function mainBoot() {
const latestDonationInfoShownAt = miLocalStorage.getItem('latestDonationInfoShownAt'); const latestDonationInfoShownAt = miLocalStorage.getItem('latestDonationInfoShownAt');
const neverShowDonationInfo = miLocalStorage.getItem('neverShowDonationInfo'); const neverShowDonationInfo = miLocalStorage.getItem('neverShowDonationInfo');
if (neverShowDonationInfo !== 'true' && (createdAt.getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 3))) && !location.pathname.startsWith('/miauth')) { if (neverShowDonationInfo !== 'true' && (createdAt.getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 3))) && !window.location.pathname.startsWith('/miauth')) {
if (latestDonationInfoShownAt == null || (new Date(latestDonationInfoShownAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 30)))) { if (latestDonationInfoShownAt == null || (new Date(latestDonationInfoShownAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 30)))) {
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkDonation.vue')), {}, { const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkDonation.vue')), {}, {
closed: () => dispose(), closed: () => dispose(),

View file

@ -180,7 +180,7 @@ function applyToPreview() {
nextTick(() => { nextTick(() => {
if (currentPreviewUrl === embedPreviewUrl.value) { if (currentPreviewUrl === embedPreviewUrl.value) {
// URL // URL
iframeEl.value?.contentWindow?.location.reload(); iframeEl.value?.contentWindow?.window.location.reload();
} }
}); });
} }

View file

@ -87,7 +87,7 @@ function openWindow() {
function nav(ev: MouseEvent) { function nav(ev: MouseEvent) {
if (behavior === 'browser') { if (behavior === 'browser') {
location.href = props.to; window.location.href = props.to;
return; return;
} }

View file

@ -320,7 +320,7 @@ export class Nirax<DEF extends RouteDef[]> extends EventEmitter<RouterEvents> {
} }
const res = this.navigate(fullPath); const res = this.navigate(fullPath);
if (res.route.path === '/:(*)') { if (res.route.path === '/:(*)') {
location.href = fullPath; window.location.href = fullPath;
} else { } else {
this.emit('push', { this.emit('push', {
beforeFullPath, beforeFullPath,

View file

@ -167,7 +167,7 @@ export const navbarItemDef = reactive({
title: i18n.ts.reload, title: i18n.ts.reload,
icon: 'ti ti-refresh', icon: 'ti ti-refresh',
action: (ev) => { action: (ev) => {
location.reload(); window.location.reload();
}, },
}, },
profile: { profile: {

View file

@ -64,7 +64,7 @@ function accepted() {
if (session.value && session.value.app.callbackUrl) { if (session.value && session.value.app.callbackUrl) {
const url = new URL(session.value.app.callbackUrl); const url = new URL(session.value.app.callbackUrl);
if (['javascript:', 'file:', 'data:', 'mailto:', 'tel:', 'vbscript:'].includes(url.protocol)) throw new Error('invalid url'); if (['javascript:', 'file:', 'data:', 'mailto:', 'tel:', 'vbscript:'].includes(url.protocol)) throw new Error('invalid url');
location.href = `${session.value.app.callbackUrl}?token=${session.value.token}`; window.location.href = `${session.value.app.callbackUrl}?token=${session.value.token}`;
} }
} }

View file

@ -31,7 +31,7 @@ import MkButton from '@/components/MkButton.vue';
const state = ref<'fetching' | 'done'>('fetching'); const state = ref<'fetching' | 'done'>('fetching');
function fetch() { function fetch() {
const params = new URL(location.href).searchParams; const params = new URL(window.location.href).searchParams;
// acctdeprecated // acctdeprecated
let uri = params.get('uri') ?? params.get('acct'); let uri = params.get('uri') ?? params.get('acct');
@ -76,12 +76,12 @@ function close(): void {
// 100ms // 100ms
window.setTimeout(() => { window.setTimeout(() => {
location.href = '/'; window.location.href = '/';
}, 100); }, 100);
} }
function goToMisskey(): void { function goToMisskey(): void {
location.href = '/'; window.location.href = '/';
} }
fetch(); fetch();

View file

@ -61,7 +61,7 @@ async function onAccept(token: string) {
const cbUrl = new URL(props.callback); const cbUrl = new URL(props.callback);
if (['javascript:', 'file:', 'data:', 'mailto:', 'tel:', 'vbscript:'].includes(cbUrl.protocol)) throw new Error('invalid url'); if (['javascript:', 'file:', 'data:', 'mailto:', 'tel:', 'vbscript:'].includes(cbUrl.protocol)) throw new Error('invalid url');
cbUrl.searchParams.set('session', props.session); cbUrl.searchParams.set('session', props.session);
location.href = cbUrl.toString(); window.location.href = cbUrl.toString();
} else { } else {
authRoot.value?.showUI('success'); authRoot.value?.showUI('success');
} }

View file

@ -182,12 +182,12 @@ function close(): void {
// 100ms // 100ms
window.setTimeout(() => { window.setTimeout(() => {
location.href = '/'; window.location.href = '/';
}, 100); }, 100);
} }
function goToMisskey(): void { function goToMisskey(): void {
location.href = '/'; window.location.href = '/';
} }
function onPosted(): void { function onPosted(): void {

View file

@ -17,10 +17,10 @@ export function createRouter(fullPath: string): Router {
return new Nirax(ROUTE_DEF, fullPath, !!$i, page(() => import('@/pages/not-found.vue'))); return new Nirax(ROUTE_DEF, fullPath, !!$i, page(() => import('@/pages/not-found.vue')));
} }
export const mainRouter = createRouter(location.pathname + location.search + location.hash); export const mainRouter = createRouter(window.location.pathname + window.location.search + window.location.hash);
window.addEventListener('popstate', (event) => { window.addEventListener('popstate', (event) => {
mainRouter.replace(location.pathname + location.search + location.hash); mainRouter.replace(window.location.pathname + window.location.search + window.location.hash);
}); });
mainRouter.addListener('push', ctx => { mainRouter.addListener('push', ctx => {

View file

@ -34,7 +34,7 @@ function resetDisconnected() {
} }
function reload() { function reload() {
location.reload(); window.location.reload();
} }
useStream().on('_disconnected_', onDisconnected); useStream().on('_disconnected_', onDisconnected);

View file

@ -139,7 +139,7 @@ if (window.innerWidth < 1024) {
const currentUI = miLocalStorage.getItem('ui'); const currentUI = miLocalStorage.getItem('ui');
miLocalStorage.setItem('ui_temp', currentUI ?? 'default'); miLocalStorage.setItem('ui_temp', currentUI ?? 'default');
miLocalStorage.setItem('ui', 'default'); miLocalStorage.setItem('ui', 'default');
location.reload(); window.location.reload();
} }
document.documentElement.style.overflowY = 'scroll'; document.documentElement.style.overflowY = 'scroll';

View file

@ -170,7 +170,7 @@ if (window.innerWidth > 1024) {
if (tempUI) { if (tempUI) {
miLocalStorage.setItem('ui', tempUI); miLocalStorage.setItem('ui', tempUI);
miLocalStorage.removeItem('ui_temp'); miLocalStorage.removeItem('ui_temp');
location.reload(); window.location.reload();
} }
} }

View file

@ -37,7 +37,7 @@ const isRoot = computed(() => mainRouter.currentRoute.value.name === 'index');
const pageMetadata = ref<null | PageMetadata>(null); const pageMetadata = ref<null | PageMetadata>(null);
const showBottom = !(new URLSearchParams(location.search)).has('zen') && ui === 'deck'; const showBottom = !(new URLSearchParams(window.location.search)).has('zen') && ui === 'deck';
provide(DI.router, mainRouter); provide(DI.router, mainRouter);
provideMetadataReceiver((metadataGetter) => { provideMetadataReceiver((metadataGetter) => {

View file

@ -35,6 +35,6 @@ export async function reloadAsk(opts: {
if (opts.unison) { if (opts.unison) {
unisonReload(); unisonReload();
} else { } else {
location.reload(); window.location.reload();
} }
} }

View file

@ -12,9 +12,9 @@ export const reloadChannel = new BroadcastChannel<string | null>('reload');
export function unisonReload(path?: string) { export function unisonReload(path?: string) {
if (path !== undefined) { if (path !== undefined) {
reloadChannel.postMessage(path); reloadChannel.postMessage(path);
location.href = path; window.location.href = path;
} else { } else {
reloadChannel.postMessage(null); reloadChannel.postMessage(null);
location.reload(); window.location.reload();
} }
} }