enhance(frontend): window.openやaタグにnoopenerオプションをつける (MisskeyIO#283)
This commit is contained in:
parent
c54d1cdde2
commit
ab5d2eca1f
12 changed files with 20 additions and 20 deletions
|
@ -23,7 +23,7 @@ const query = ref(props.q);
|
||||||
const search = () => {
|
const search = () => {
|
||||||
const sp = new URLSearchParams();
|
const sp = new URLSearchParams();
|
||||||
sp.append('q', query.value);
|
sp.append('q', query.value);
|
||||||
window.open(`https://www.google.com/search?${sp.toString()}`, '_blank');
|
window.open(`https://www.google.com/search?${sp.toString()}`, '_blank', 'noopener');
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<component
|
<component
|
||||||
:is="self ? 'MkA' : 'a'" ref="el" style="word-break: break-all;" class="_link" :[attr]="self ? url.substring(local.length) : url" :rel="rel" :target="target"
|
:is="self ? 'MkA' : 'a'" ref="el" style="word-break: break-all;" class="_link" :[attr]="self ? url.substring(local.length) : url" :rel="rel ?? 'nofollow noopener'" :target="target"
|
||||||
:title="url"
|
:title="url"
|
||||||
>
|
>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
|
|
@ -112,7 +112,7 @@ const contextmenu = computed(() => ([{
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
text: i18n.ts.openInNewTab,
|
text: i18n.ts.openInNewTab,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(url + router.getCurrentPath(), '_blank');
|
window.open(url + router.getCurrentPath(), '_blank', 'noopener');
|
||||||
windowEl.value.close();
|
windowEl.value.close();
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -107,31 +107,31 @@ function showMenu(ev) {
|
||||||
text: i18n.ts.impressum,
|
text: i18n.ts.impressum,
|
||||||
icon: 'ti ti-file-invoice',
|
icon: 'ti ti-file-invoice',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(instance.impressumUrl, '_blank');
|
window.open(instance.impressumUrl, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined, (instance.tosUrl) ? {
|
} : undefined, (instance.tosUrl) ? {
|
||||||
text: i18n.ts.termsOfService,
|
text: i18n.ts.termsOfService,
|
||||||
icon: 'ti ti-notebook',
|
icon: 'ti ti-notebook',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(instance.tosUrl, '_blank');
|
window.open(instance.tosUrl, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined, (instance.privacyPolicyUrl) ? {
|
} : undefined, (instance.privacyPolicyUrl) ? {
|
||||||
text: i18n.ts.privacyPolicy,
|
text: i18n.ts.privacyPolicy,
|
||||||
icon: 'ti ti-shield-lock',
|
icon: 'ti ti-shield-lock',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(instance.privacyPolicyUrl, '_blank');
|
window.open(instance.privacyPolicyUrl, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : null, {
|
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : null, {
|
||||||
text: i18n.ts.help,
|
text: i18n.ts.help,
|
||||||
icon: 'ti ti-help-circle',
|
icon: 'ti ti-help-circle',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open('https://misskey-hub.net/help.md', '_blank');
|
window.open('https://misskey-hub.net/help.md', '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
}], ev.currentTarget ?? ev.target);
|
}], ev.currentTarget ?? ev.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
function exploreOtherServers() {
|
function exploreOtherServers() {
|
||||||
window.open('https://join.misskey.page/instances', '_blank');
|
window.open('https://join.misskey.page/instances', '_blank', 'noopener');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ function onContextmenu(ev) {
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
text: i18n.ts.openInNewTab,
|
text: i18n.ts.openInNewTab,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(props.to, '_blank');
|
window.open(props.to, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
icon: 'ti ti-link',
|
icon: 'ti ti-link',
|
||||||
|
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<component
|
<component
|
||||||
:is="self ? 'MkA' : 'a'" ref="el" :class="$style.root" class="_link" :[attr]="self ? props.url.substring(local.length) : props.url" :rel="rel" :target="target"
|
:is="self ? 'MkA' : 'a'" ref="el" :class="$style.root" class="_link" :[attr]="self ? props.url.substring(local.length) : props.url" :rel="rel ?? 'nofollow noopener'" :target="target"
|
||||||
@contextmenu.stop="() => {}"
|
@contextmenu.stop="() => {}"
|
||||||
>
|
>
|
||||||
<template v-if="!self">
|
<template v-if="!self">
|
||||||
|
|
|
@ -120,7 +120,7 @@ const headerActions = computed(() => [{
|
||||||
text: i18n.ts.openInNewTab,
|
text: i18n.ts.openInNewTab,
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
handler: () => {
|
handler: () => {
|
||||||
window.open(file.value.url, '_blank');
|
window.open(file.value.url, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ const headerActions = computed(() => [{
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
text: i18n.ts.dashboard,
|
text: i18n.ts.dashboard,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
window.open(config.url + '/queue', '_blank');
|
window.open(config.url + '/queue', '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ const headerActions = computed(() => [{
|
||||||
text: `https://${props.host}`,
|
text: `https://${props.host}`,
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
handler: () => {
|
handler: () => {
|
||||||
window.open(`https://${props.host}`, '_blank');
|
window.open(`https://${props.host}`, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<s
|
||||||
}),
|
}),
|
||||||
'Plugin:open_url': values.FN_NATIVE(([url]) => {
|
'Plugin:open_url': values.FN_NATIVE(([url]) => {
|
||||||
utils.assertString(url);
|
utils.assertString(url);
|
||||||
window.open(url.value, '_blank');
|
window.open(url.value, '_blank', 'noopener');
|
||||||
}),
|
}),
|
||||||
'Plugin:config': values.OBJ(config),
|
'Plugin:config': values.OBJ(config),
|
||||||
};
|
};
|
||||||
|
|
|
@ -278,7 +278,7 @@ export function getNoteMenu(props: {
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
text: i18n.ts.showOnRemote,
|
text: i18n.ts.showOnRemote,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(appearNote.url ?? appearNote.uri, '_blank');
|
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined,
|
} : undefined,
|
||||||
...(isSupportShare() ? [{
|
...(isSupportShare() ? [{
|
||||||
|
@ -382,7 +382,7 @@ export function getNoteMenu(props: {
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
text: i18n.ts.showOnRemote,
|
text: i18n.ts.showOnRemote,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(appearNote.url ?? appearNote.uri, '_blank');
|
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined]
|
} : undefined]
|
||||||
.filter(x => x !== undefined);
|
.filter(x => x !== undefined);
|
||||||
|
|
|
@ -83,25 +83,25 @@ export function openInstanceMenu(ev: MouseEvent) {
|
||||||
text: i18n.ts.impressum,
|
text: i18n.ts.impressum,
|
||||||
icon: 'ti ti-file-invoice',
|
icon: 'ti ti-file-invoice',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(instance.impressumUrl, '_blank');
|
window.open(instance.impressumUrl, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined, (instance.tosUrl) ? {
|
} : undefined, (instance.tosUrl) ? {
|
||||||
text: i18n.ts.termsOfService,
|
text: i18n.ts.termsOfService,
|
||||||
icon: 'ti ti-notebook',
|
icon: 'ti ti-notebook',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(instance.tosUrl, '_blank');
|
window.open(instance.tosUrl, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined, (instance.privacyPolicyUrl) ? {
|
} : undefined, (instance.privacyPolicyUrl) ? {
|
||||||
text: i18n.ts.privacyPolicy,
|
text: i18n.ts.privacyPolicy,
|
||||||
icon: 'ti ti-shield-lock',
|
icon: 'ti ti-shield-lock',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(instance.privacyPolicyUrl, '_blank');
|
window.open(instance.privacyPolicyUrl, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : null, {
|
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : null, {
|
||||||
text: i18n.ts.help,
|
text: i18n.ts.help,
|
||||||
icon: 'ti ti-help-circle',
|
icon: 'ti ti-help-circle',
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open('https://misskey-hub.net/help.html', '_blank');
|
window.open('https://misskey-hub.net/help.html', '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
}, ($i) ? {
|
}, ($i) ? {
|
||||||
text: i18n.ts._initialTutorial.launchTutorial,
|
text: i18n.ts._initialTutorial.launchTutorial,
|
||||||
|
|
Loading…
Reference in a new issue