Skip to content

Commit c680e35

Browse files
enhance(frontend): 広告が同一ドメインの場合はRouterで遷移するように (#13510)
* enhance(frontend): 広告が同一ドメインの場合はRouterで遷移するように * Update Changelog * Update CHANGELOG.md --------- Co-authored-by: syuilo <[email protected]>
1 parent 412e9f2 commit c680e35

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
### Client
77
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
8+
- Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように
89
- Enhance: リアクション・いいねの総数を表示するように
910
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
1011
- Fix: 一部のページ内リンクが正しく動作しない問題を修正

packages/frontend/src/components/global/MkAd.vue

+17-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@ SPDX-License-Identifier: AGPL-3.0-only
1414
[$style.form_vertical]: chosen.place === 'vertical',
1515
}]"
1616
>
17-
<a :href="chosen.url" target="_blank" :class="$style.link">
17+
<component
18+
:is="self ? 'MkA' : 'a'"
19+
:class="$style.link"
20+
v-bind="self ? {
21+
to: chosen.url.substring(local.length),
22+
} : {
23+
href: chosen.url,
24+
rel: 'nofollow noopener',
25+
target: '_blank',
26+
}"
27+
>
1828
<img :src="chosen.imageUrl" :class="$style.img">
1929
<button class="_button" :class="$style.i" @click.prevent.stop="toggleMenu"><i :class="$style.iIcon" class="ti ti-info-circle"></i></button>
20-
</a>
30+
</component>
2131
</div>
2232
<div v-else :class="$style.menu">
2333
<div :class="$style.menuContainer">
@@ -32,10 +42,10 @@ SPDX-License-Identifier: AGPL-3.0-only
3242
</template>
3343

3444
<script lang="ts" setup>
35-
import { ref } from 'vue';
45+
import { ref, computed } from 'vue';
3646
import { i18n } from '@/i18n.js';
3747
import { instance } from '@/instance.js';
38-
import { host } from '@/config.js';
48+
import { url as local, host } from '@/config.js';
3949
import MkButton from '@/components/MkButton.vue';
4050
import { defaultStore } from '@/store.js';
4151
import * as os from '@/os.js';
@@ -96,6 +106,9 @@ const choseAd = (): Ad | null => {
96106
};
97107

98108
const chosen = ref(choseAd());
109+
110+
const self = computed(() => chosen.value?.url.startsWith(local));
111+
99112
const shouldHide = ref(!defaultStore.state.forceShowAds && $i && $i.policies.canHideAds && (props.specify == null));
100113

101114
function reduceFrequency(): void {

0 commit comments

Comments
 (0)