feat(images): default frontend assets to image service

This commit is contained in:
2026-08-08 09:30:58 +00:00
parent bda76b7888
commit 4374c490ac
28 changed files with 228 additions and 61 deletions
@@ -0,0 +1,31 @@
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import {
configuredGameAssetUrl,
configuredImagePublicUrl,
configuredSharedIconPublicUrl,
configuredUserIconPublicUrl,
externalizeLegacyImageUrl,
} from '../src/utils/imageAssets.ts';
void describe('imageAssets', () => {
void it('uses the dedicated image host when no frontend override is provided', () => {
assert.equal(configuredImagePublicUrl(), 'https://sam-image.hided.net');
assert.equal(configuredGameAssetUrl(), 'https://sam-image.hided.net/game');
assert.equal(configuredSharedIconPublicUrl(), 'https://sam-image.hided.net/icons');
assert.equal(configuredUserIconPublicUrl(), 'https://sam-image.hided.net/icons');
});
void it('maps legacy local image paths to the dedicated image host', () => {
assert.equal(
externalizeLegacyImageUrl('/image/icons/default.jpg'),
'https://sam-image.hided.net/icons/default.jpg'
);
assert.equal(
externalizeLegacyImageUrl('/image/general/장수/유비.png'),
'https://sam-image.hided.net/icons/장수/유비.png'
);
assert.equal(externalizeLegacyImageUrl('/gateway/logo.png'), '/gateway/logo.png');
});
});