-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jon Staab
committed
Feb 24, 2025
1 parent
604aa8c
commit 88baaa0
Showing
3 changed files
with
93 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script lang="ts"> | ||
import {onMount} from 'svelte' | ||
import {postJson} from '@welshman/lib' | ||
import {pubkey} from '@welshman/app' | ||
import Anchor from 'src/partials/Anchor.svelte' | ||
import {dufflepud, getSetting} from 'src/engine' | ||
export let urls: string[] | ||
export let author: string | ||
let maxScore = 0 | ||
let threshold = author !== $pubkey && getSetting('hide_sensitive') ? 0.5 : 1 | ||
const ignoreWarning = () => { | ||
threshold = 1 | ||
} | ||
onMount(() => { | ||
for (const url of urls) { | ||
postJson(dufflepud('media/alert'), {url}).then(({score = 0}) => { | ||
maxScore = Math.max(score, maxScore) | ||
}) | ||
} | ||
}) | ||
</script> | ||
|
||
{#if maxScore >= threshold} | ||
<div class="flex gap-2 text-neutral-300"> | ||
<i class="fa fa-warning m-1" /> | ||
<p> | ||
This note contains sensitive content.<br /> | ||
<Anchor underline on:click={ignoreWarning}>Show anyway</Anchor> | ||
</p> | ||
</div> | ||
{:else} | ||
<slot /> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters