Skip to content

Commit d2a617c

Browse files
committed
fix: ESLint
1 parent fa2ecc4 commit d2a617c

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

packages/frontend/src/components/MkNote.vue

+8-5
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const isMyRenote = $i && ($i.id === note.value.userId);
253253
const showContent = ref(false);
254254
const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null);
255255
const urls = computed(() => parsed.value ? extractUrlFromMfm(parsed.value).filter((url) => appearNote.value.renote?.url !== url.href && appearNote.value.renote?.uri !== url.href) : null);
256-
const previewUrls = computed(() => urls.value.filter(url => url.preview))
256+
const previewUrls = computed(() => urls.value.filter(url => url.preview));
257257
const isLong = shouldCollapsed(appearNote.value, urls.value ?? []);
258258
const collapsed = ref(appearNote.value.cw == null && isLong);
259259
const isDeleted = ref(false);
@@ -269,35 +269,38 @@ const renoteCollapsed = ref(
269269
(appearNote.value.myReaction != null)
270270
)
271271
);
272+
272273
function isURL(str) {
273274
try {
274275
new URL(str);
275276
return true;
276-
} catch (e) {
277+
} catch (error) {
277278
return false;
278279
}
279280
}
281+
280282
function getDomain(url) {
281283
try {
282284
const domain = new URL(url).hostname;
283285
return domain;
284-
} catch (e) {
286+
} catch (error) {
285287
return null;
286288
}
287289
}
290+
288291
const isSuspectPhishingLink = computed(() => {
289292
return urls.value.some(url => {
290293
// url.textが配列でない場合、配列に変換
291294
const text = Array.isArray(url.text) ? url.text.join('') : url.text;
292295

293296
// textがURLでない場合、すぐに次のurlへ
294-
console.log(text)
297+
console.log(text);
295298
if (!isURL((text.startsWith('https://') || text.startsWith('http://')) ? text : `https://${text}`)) return false;
296299

297300
// hrefとtextのドメインを比較
298301
const hrefDomain = getDomain(url.href);
299302
const textDomain = getDomain(text);
300-
console.log(hrefDomain, textDomain)
303+
console.log(hrefDomain, textDomain);
301304

302305
// ドメインが一致しない場合、フィッシングの疑いあり
303306
return hrefDomain !== textDomain && textDomain;

packages/frontend/src/components/MkNoteDetailed.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
277277
const translating = ref(false);
278278
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
279279
const urls = parsed ? extractUrlFromMfm(parsed).filter((url) => appearNote.value.renote?.url !== url.href && appearNote.value.renote?.uri !== url.href) : null;
280-
const previewUrls = urls.filter(url => url.preview)
280+
const previewUrls = urls.filter(url => url.preview);
281281
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
282282
const conversation = ref<Misskey.entities.Note[]>([]);
283283
const replies = ref<Misskey.entities.Note[]>([]);
@@ -287,30 +287,32 @@ function isURL(str) {
287287
try {
288288
new URL(str);
289289
return true;
290-
} catch (e) {
290+
} catch (error) {
291291
return false;
292292
}
293293
}
294+
294295
function getDomain(url) {
295296
try {
296297
const domain = new URL(url).hostname;
297298
return domain;
298-
} catch (e) {
299+
} catch (error) {
299300
return null;
300301
}
301302
}
303+
302304
const isSuspectPhishingLink = urls.some(url => {
303305
// url.textが配列でない場合、配列に変換
304306
const text = Array.isArray(url.text) ? url.text.join('') : url.text;
305307

306308
// textがURLでない場合、すぐに次のurlへ
307-
console.log(text)
309+
console.log(text);
308310
if (!isURL((text.startsWith('https://') || text.startsWith('http://')) ? text : `https://${text}`)) return false;
309311

310312
// hrefとtextのドメインを比較
311313
const hrefDomain = getDomain(url.href);
312314
const textDomain = getDomain(text);
313-
console.log(hrefDomain, textDomain)
315+
console.log(hrefDomain, textDomain);
314316

315317
// ドメインが一致しない場合、フィッシングの疑いあり
316318
return hrefDomain !== textDomain && textDomain;

packages/frontend/src/scripts/extract-url-from-mfm.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function extractUrlFromMfm(nodes: mfm.MfmNode[], respectSilentFlag = true
2525
href: x.props.url,
2626
text: extractTextValues(x.children) ?? [],
2727
preview: (!respectSilentFlag || !x.props.silent),
28-
})
28+
});
2929
}));
3030

3131
return urls.reduce((array, url) => {

0 commit comments

Comments
 (0)