feat(dictionary): add Hachidori backend support (#266)

This commit is contained in:
sudacode authored and GitHub committed 2026-10-24 21:08:18 -07:00
1 parent e690ffba07
commit cbaa4626e1
143 files changed
+5564 -305

No files matched your search

@@ -0,0 +1,19 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { parseDictionaryExternalUrl } from './dictionary-external-link';
test('dictionary links accept web URLs and reject privileged schemes and credentials', () => {
assert.equal(
parseDictionaryExternalUrl('https://example.com/word?q=猫'),
'https://example.com/word?q=%E7%8C%AB',
);
for (const value of [
'file:///etc/passwd',
'javascript:alert(1)',
'https://user:pass@example.com',
null,
{},
]) {
assert.throws(() => parseDictionaryExternalUrl(value));
}
});