mirror of
https://codeberg.org/kirche-im-netz/Startodon-Hub.git
synced 2025-08-05 02:34:47 +02:00
create-starterpack-popup an neue config angepasst
This commit is contained in:
parent
0b40c319d8
commit
0c82d183cb
2 changed files with 7 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
import { createPopup, destroyAllPopups } from '../components/popupManager.js';
|
||||
import { createPopup, destroyAllPopups } from './popupManager.js';
|
||||
|
||||
const POST_URL = 'https://api.fedikirche.de/starterpack';
|
||||
const AUTH_TOKEN = '5e1185f21148c3f6c81cfcd15a3449eadb42c0c248f010810956d926bacffb55';
|
||||
|
@ -77,18 +77,15 @@ function setupFormEvents(popup) {
|
|||
|
||||
const kitName = formData.get('kitName');
|
||||
const kitDescription = formData.get('kitDescription');
|
||||
let kitAuthor = formData.get('kitAuthor').trim();
|
||||
const kitAuthor = formData.get('kitAuthor').trim();
|
||||
|
||||
// Validierung und Bereinigung des Autors
|
||||
if (kitAuthor.match(/^@[a-zA-Z0-9_]+@[a-zA-Z0-9.-]+$/)) {
|
||||
const [empty, username, domain] = kitAuthor.split('@');
|
||||
kitAuthor = `https://${domain}/@${username}`;
|
||||
} else {
|
||||
// Validierung des Autors
|
||||
if (!kitAuthor.match(/^@[a-zA-Z0-9_]+@[a-zA-Z0-9.-]+$/)) {
|
||||
alert(`Fehler im Feld "Autor": Ungültiger Mastodon-Handle (${kitAuthor}). Bitte im Format @nutzername@server eingeben.`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Validierung und Bereinigung der Accounts
|
||||
// Validierung der Accounts
|
||||
const kitAccounts = formData
|
||||
.get('kitAccounts')
|
||||
.split('\n')
|
||||
|
@ -98,8 +95,7 @@ function setupFormEvents(popup) {
|
|||
alert(`Fehler im Feld "Accounts" (Zeile ${index + 1}): Ungültiges Kontoformat (${trimmed}). Bitte im Format @nutzername@server eingeben.`);
|
||||
throw new Error(`Ungültiges Kontoformat: ${trimmed}`);
|
||||
}
|
||||
const [empty, username, domain] = trimmed.split('@');
|
||||
return `https://${domain}/@${username}`;
|
||||
return trimmed;
|
||||
});
|
||||
|
||||
if (!kitName || !kitDescription || !kitAuthor || kitAccounts.length === 0) {
|
|
@ -1,6 +1,6 @@
|
|||
import { createStarterKitElement, enhanceStarterKits } from './utils/starterkit-utils.js';
|
||||
import { seededShuffleChildren } from './utils/shuffle-utils.js';
|
||||
import { initializeCreateStarterKitPopup } from './utils/create-starterkit.js';
|
||||
import { initializeCreateStarterKitPopup } from './components/create-starterpack-popup.js';
|
||||
import { loadPostwall } from './components/postwall.js';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue