This commit is contained in:
CenTdemeern1 2024-10-21 19:42:53 +02:00
parent 9668d6187c
commit d7244b3c71
4 changed files with 60 additions and 8 deletions

34
locales/index.d.ts vendored
View file

@ -11004,6 +11004,40 @@ export interface Locale extends ILocale {
* Show warning when opening external URLs
*/
"warnExternalUrl": string;
"_flash": {
/**
* Flash Content Hidden
*/
"contentHidden": string;
/**
* Powered by Ruffle.
*/
"poweredByRuffle": string;
/**
* Always be wary of arbitrary code execution!
*/
"arbitraryCodeExecutionWarning": string;
/**
* Flash Content Failed To Load:
*/
"failedToLoad": string;
/**
* Flash Content Is Loading
*/
"isLoading": string;
/**
* Loading Ruffle player
*/
"loadingRufflePlayer": string;
/**
* Loading Flash file
*/
"loadingFlashFile": string;
/**
* raw.esm.sh could not be accessed, meaning this instance's Content Security Policy is likely out of date. Please contact your instance administrators.
*/
"cspError": string;
};
"_mfm": {
/**
* This is not a widespread feature, it may not display properly on most other fedi software, including other Misskey forks

View file

@ -14,17 +14,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-else :class="$style.flash_player_enabled">
<div :class="$style.flash_display">
<div v-if="playerHide" :class="$style.player_hide" @click="dismissWarning()">
<b><i class="ph-eye ph-bold ph-lg"></i> Flash Content Hidden</b>
<span>Powered by Ruffle.</span>
<span>Always be wary of arbitrary code execution!</span>
<b><i class="ph-eye ph-bold ph-lg"></i> {{ i18n.ts._flash.contentHidden }}</b>
<span>{{ i18n.ts._flash.poweredByRuffle }}</span>
<span>{{ i18n.ts._flash.arbitraryCodeExecutionWarning }}</span>
<span>{{ i18n.ts.clickToShow }}</span>
</div>
<div v-if="ruffleError" :class="$style.player_hide">
<b><i class="ph-warning ph-bold ph-lg"></i> Flash Content Failed To Load:</b>
<b><i class="ph-warning ph-bold ph-lg"></i> {{ i18n.ts._flash.failedToLoad }}</b>
<code>{{ ruffleError }}</code>
</div>
<div v-else-if="loadingStatus" :class="$style.player_hide">
<b>Flash Content Is Loading<MkEllipsis/></b>
<b>{{ i18n.ts._flash.isLoading }}<MkEllipsis/></b>
<MkLoading/>
<p>{{ loadingStatus }}</p>
</div>
@ -100,7 +100,7 @@ function handleError(error: unknown) {
*/
async function loadRuffle() {
if (window.RufflePlayer !== undefined) return;
loadingStatus.value = 'Loading Ruffle player';
loadingStatus.value = i18n.ts._flash.loadingRufflePlayer;
await import('@ruffle-rs/ruffle'); // Assumption: this will throw if esm.sh has a hiccup or something. If not, the next undefined check will catch it.
window.RufflePlayer = window.RufflePlayer as PublicAPILike | PublicAPI | undefined; // Assert unknown type due to side effects
if (window.RufflePlayer === undefined) throw Error('esm.sh has shit itself, but not in an expected way (has esm.sh permanently shut down? how close is the heat death of the universe?)');
@ -169,7 +169,7 @@ function createPlayer() {
function loadContent() {
if (player.value === undefined) throw Error('Player is uninitialized.');
ruffleContainer.value?.appendChild(player.value);
loadingStatus.value = 'Loading Flash file';
loadingStatus.value = i18n.ts._flash.loadingFlashFile;
player.value.load(url.value).then(() => {
loadingStatus.value = undefined;
}).catch(error => {
@ -179,7 +179,7 @@ function loadContent() {
handleError(error); // Unexpected error
}).catch(() => {
// Must be CSP because esm.sh should be online if `loadRuffle()` didn't fail
handleError('raw.esm.sh could not be accessed, meaning this instance\'s Content Security Policy is likely out of date. Please contact your instance administrators.');
handleError(i18n.ts._flash.cspError);
});
});
}

View file

@ -156,6 +156,15 @@ allowClickingNotifications: "Allow clicking on pop-up notifications"
pinnedOnly: "Pinned"
blockingYou: "Blocking you"
warnExternalUrl: "Show warning when opening external URLs"
_flash:
contentHidden: "Flash Content Hidden"
poweredByRuffle: "Powered by Ruffle."
arbitraryCodeExecutionWarning: "Always be wary of arbitrary code execution!"
failedToLoad: "Flash Content Failed To Load:"
isLoading: "Flash Content Is Loading"
loadingRufflePlayer: "Loading Ruffle player"
loadingFlashFile: "Loading Flash file"
cspError: "raw.esm.sh could not be accessed, meaning this instance's Content Security Policy is likely out of date. Please contact your instance administrators."
_delivery:
stop: "Suspend delivery"
resume: "Resume delivery"

View file

@ -142,6 +142,15 @@ sensitiveMediaRevealConfirm: "センシティブなメディアです。表示
severAllFollowRelations: "以下の関係をすべて断ち切る"
severAllFollowRelationsConfirm: "すべての人間関係を壊す?これは不可逆です!これは{instanceName}の{followingCount}フォローと{followersCount}フォロワーの関係を壊す!"
severAllFollowRelationsQueued: "キューに入れられた{host}とのすべてのフォロー関係を切断する。"
_flash:
contentHidden: "Flashコンテンツ非表示"
poweredByRuffle: "Powered by Ruffle." # Doesn't need a translation, apparently.
arbitraryCodeExecutionWarning: "任意コード実行にご注意!"
failedToLoad: "Flashコンテンツ読込に失敗"
isLoading: "Flashコンテンツ読込中"
loadingRufflePlayer: "Ruffleプレイヤー読込中"
loadingFlashFile: "Flashファイル読込中"
cspError: "raw.esm.shにアクセスできませんでした。このサーバーのコンテンツセキュリティポリシー(CSP) が廃止されている可能性があり、サーバー管理者に連絡してください。"
_delivery:
stop: "配信停止"
resume: "配信再開"