ntfy-notiser: skicka kort notis när något läggs till för nedladdning
All checks were successful
build-and-push / build (push) Successful in 17s

Konfigureras på inställningssidan (server-URL, topic, på/av-toggle,
testknapp) med NTFY_URL/NTFY_TOPIC som env-fallback. Notisen är
fire-and-forget och kan aldrig fälla själva tillägget.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-01 18:33:37 +02:00
parent 5a93ebf53f
commit d8a5089eaf
7 changed files with 308 additions and 9 deletions

View File

@@ -4,7 +4,8 @@ import { onMounted, ref } from 'vue'
const gemini = ref({ apiKey: '', model: '' })
const jellyfin = ref({ url: '', apiKey: '', userId: '' })
const ytmusic = ref({ clientId: '', clientSecret: '' })
const saved = ref({ gemini: {}, jellyfin: {}, ytmusic: {}, suggest: {} })
const ntfy = ref({ url: '', topic: '', enabled: false })
const saved = ref({ gemini: {}, jellyfin: {}, ytmusic: {}, ntfy: {}, suggest: {} })
const suggestCfg = ref(null)
const SUGGEST_META = {
@@ -42,6 +43,11 @@ onMounted(async () => {
gemini.value.model = saved.value.gemini.model
jellyfin.value.url = saved.value.jellyfin.url
jellyfin.value.userId = saved.value.jellyfin.userId
ntfy.value = {
url: saved.value.ntfy?.url ?? '',
topic: saved.value.ntfy?.topic ?? '',
enabled: saved.value.ntfy?.enabled ?? false,
}
suggestCfg.value = saved.value.suggest
})
@@ -61,14 +67,22 @@ async function saveAndTest(service) {
const body =
service === 'gemini'
? { gemini: { apiKey: gemini.value.apiKey || null, model: gemini.value.model || null } }
: {
jellyfin: {
url: jellyfin.value.url || null,
apiKey: jellyfin.value.apiKey || null,
userId: jellyfin.value.userId || null,
userName: jfUsers.value.find((u) => u.id === jellyfin.value.userId)?.name ?? null,
},
}
: service === 'ntfy'
? {
ntfy: {
url: ntfy.value.url || null,
topic: ntfy.value.topic || null,
enabled: Boolean(ntfy.value.enabled),
},
}
: {
jellyfin: {
url: jellyfin.value.url || null,
apiKey: jellyfin.value.apiKey || null,
userId: jellyfin.value.userId || null,
userName: jfUsers.value.find((u) => u.id === jellyfin.value.userId)?.name ?? null,
},
}
await fetch('/api/settings', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
@@ -289,6 +303,31 @@ async function connectYtMusic() {
</template>
</article>
<article class="card">
<h3>Notiser (ntfy) <span v-if="saved.ntfy?.enabled" class="badge"> </span></h3>
<p class="dim">
Skickar en kort notis till en ntfy-topic när något läggs till för
nedladdning. Samma topic som resten av media-stacken använder för
hämtningar.
</p>
<label>Server-URL
<input v-model="ntfy.url" type="text" placeholder="https://ntfy.brasse-pc.eu" />
</label>
<label>Topic
<input v-model="ntfy.topic" type="text" placeholder="media-hamtningar" />
</label>
<label class="check">
<input v-model="ntfy.enabled" type="checkbox" />
Skicka notis när något läggs till
</label>
<div class="row">
<button :disabled="busy.ntfy" @click="saveAndTest('ntfy')">
{{ busy.ntfy ? 'Testar' : 'Spara & skicka testnotis' }}
</button>
<span v-if="results.ntfy" :class="results.ntfy.ok ? 'ok' : 'fail'">{{ results.ntfy.message }}</span>
</div>
</article>
<article class="card">
<h3>
YouTube Music