diff --git a/e2e/integration/account-settings.spec.ts b/e2e/integration/account-settings.spec.ts index 7b97959a..2383e547 100644 --- a/e2e/integration/account-settings.spec.ts +++ b/e2e/integration/account-settings.spec.ts @@ -53,14 +53,14 @@ test.describe('account settings', () => { }); test.describe('profile page', () => { - test('profile page renders its heading and coming-soon state', async ({ authedPage }) => { + test('profile page renders its heading and the public profile settings', async ({ + authedPage, + }) => { await authedPage.goto('/profile'); await authedPage.waitForLoadState('networkidle'); - // The route is a placeholder today: a heading and an empty state, no user info of its own. - // Anything user-specific on the page would come from the surrounding shell, not the profile. const main = authedPage.getByRole('main'); await expect(main.getByRole('heading', { name: /^profile$/i })).toBeVisible(); - await expect(main.getByText(/profile is coming soon/i)).toBeVisible(); + await expect(main.getByText(/make my profile public/i)).toBeVisible(); }); }); diff --git a/e2e/integration/public-profiles.spec.ts b/e2e/integration/public-profiles.spec.ts new file mode 100644 index 00000000..c89bc0bb --- /dev/null +++ b/e2e/integration/public-profiles.spec.ts @@ -0,0 +1,80 @@ +import { expect, test } from './lib/test-fixtures'; + +test.describe('public profiles and custom URLs', () => { + test('profile is private by default', async ({ browser, user }) => { + const anon = await browser.newContext(); + const page = await anon.newPage(); + await page.goto(`/u/${user.credentials.username}`); + await expect(page.getByText('Profile not found')).toBeVisible(); + await anon.close(); + }); + + test('custom URL, public profile and default public share', async ({ + authedPage, + browser, + user, + }) => { + const username = user.credentials.username; + const page = authedPage; + + // Create a public share with a custom URL + await page.goto('/shares/public'); + await page.getByRole('main').getByRole('button', { name: 'New Share' }).first().click(); + const dialog = page.getByRole('dialog'); + await dialog.getByLabel('Name').fill('Profile Share'); + await dialog.getByLabel('Custom URL').fill('Bad--Slug'); + await expect(dialog.getByText(/use 2-32 lowercase letters/i)).toBeVisible(); + await expect(dialog.getByRole('button', { name: 'Create' })).toBeDisabled(); + await dialog.getByLabel('Custom URL').fill('Fun-Times'); + await expect(dialog.getByText(`/u/${username}/fun-times`)).toBeVisible(); + await dialog.getByRole('button', { name: 'Create' }).click(); + await expect(page.getByText('Created new public share')).toBeVisible(); + await expect(page.getByRole('main').locator('input[readonly]')).toHaveValue( + new RegExp(`/u/${username}/fun-times$`) + ); + + // Change the custom URL from the edit page + await page.getByRole('heading', { name: 'Profile Share' }).click(); + await expect(page).toHaveURL(/\/shares\/public\/[0-9a-f-]+$/); + await page.goto(`${page.url()}/edit`); + const settings = page.locator('[data-slot="card"]', { hasText: 'Name, custom URL and expiry' }); + await settings.getByLabel('Custom URL').fill('renamed'); + await settings.getByRole('button', { name: 'Save Changes' }).click(); + await expect(page.getByText('Public share updated')).toBeVisible(); + + // Make the profile public with pronouns, bio, a social and the default share + await page.goto('/profile'); + await page.getByRole('switch', { name: /make my profile public/i }).click(); + await page.getByRole('textbox', { name: 'Pronouns' }).fill('they/them'); + await page.getByRole('textbox', { name: 'Bio' }).fill('Hello from the e2e suite'); + await page.getByRole('button', { name: 'Add social' }).click(); + await page.getByPlaceholder('https://example.com').fill('https://example.org/me'); + await page.getByRole('combobox').filter({ hasText: 'None' }).click(); + await page.getByRole('option', { name: 'Profile Share' }).click(); + await page.getByRole('button', { name: 'Save Changes' }).click(); + await expect(page.getByText('Profile saved')).toBeVisible(); + + // Visitors without an account see the profile, the default share and the custom URL + const anon = await browser.newContext(); + const visitor = await anon.newPage(); + + await visitor.goto(`/u/${username}`); + await expect(visitor.getByText('Hello from the e2e suite')).toBeVisible(); + await expect(visitor.getByText('they/them')).toBeVisible(); + await expect(visitor.getByRole('link', { name: /example\.org\/me/ })).toHaveAttribute( + 'href', + 'https://example.org/me' + ); + await expect(visitor.getByRole('heading', { name: 'Profile Share' })).toBeVisible(); + await expect(visitor.getByRole('button', { name: 'Enter as Guest' })).toBeVisible(); + + await visitor.goto(`/u/${username}/renamed`); + await expect(visitor.getByRole('heading', { name: 'Profile Share' })).toBeVisible(); + await expect(visitor.getByText('Hello from the e2e suite')).toBeVisible(); + + await visitor.goto(`/u/${username}/fun-times`); + await expect(visitor.getByText(/its custom URL has changed/i)).toBeVisible(); + + await anon.close(); + }); +}); diff --git a/e2e/integration/public-share-password.spec.ts b/e2e/integration/public-share-password.spec.ts new file mode 100644 index 00000000..dedc5183 --- /dev/null +++ b/e2e/integration/public-share-password.spec.ts @@ -0,0 +1,84 @@ +import { expect, test } from './lib/test-fixtures'; + +test.describe('public share passwords', () => { + test('visitors unlock a password protected public share', async ({ + authedPage, + browser, + user, + }) => { + const username = user.credentials.username; + const page = authedPage; + + // Create a password protected public share + await page.goto('/shares/public'); + await page.getByRole('main').getByRole('button', { name: 'New Share' }).first().click(); + const dialog = page.getByRole('dialog'); + await dialog.getByLabel('Name').fill('Locked Share'); + await dialog.getByLabel('Custom URL').fill('locked'); + await dialog.getByLabel('Password (optional)').fill('abc'); + await expect(dialog.getByText('Use 4 to 128 characters.')).toBeVisible(); + await expect(dialog.getByRole('button', { name: 'Create' })).toBeDisabled(); + await dialog.getByLabel('Password (optional)').fill('open sesame'); + await dialog.getByRole('button', { name: 'Create' }).click(); + await expect(page.getByText('Created new public share')).toBeVisible(); + await expect(page.getByLabel('Password protected')).toBeVisible(); + + // A visitor has to enter the password first + const anon = await browser.newContext(); + const visitor = await anon.newPage(); + await visitor.goto(`/u/${username}/locked`); + await expect(visitor.getByRole('heading', { name: 'Locked Share' })).toBeVisible(); + await expect(visitor.getByText('This public share is password protected.')).toBeVisible(); + await expect(visitor.getByRole('button', { name: 'Enter as Guest' })).toBeHidden(); + + await visitor.getByLabel('Password').fill('wrong password'); + await visitor.getByRole('button', { name: 'Unlock' }).click(); + await expect(visitor.getByText('Incorrect password')).toBeVisible(); + + await visitor.getByLabel('Password').fill('open sesame'); + await visitor.getByRole('button', { name: 'Unlock' }).click(); + await expect(visitor.getByRole('button', { name: 'Enter as Guest' })).toBeVisible(); + + // The unlock is remembered for the tab + await visitor.reload(); + await expect(visitor.getByRole('button', { name: 'Enter as Guest' })).toBeVisible(); + + // Changing the password locks the visitor out again + await page.getByRole('heading', { name: 'Locked Share' }).click(); + await expect(page).toHaveURL(/\/shares\/public\/[0-9a-f-]+$/); + await page.goto(`${page.url()}/edit`); + const passwordCard = page.locator('[data-slot="card"]', { + hasText: 'Visitors have to enter it', + }); + await passwordCard.getByLabel('New password').fill('new secret'); + await passwordCard.getByRole('button', { name: 'Change password' }).click(); + await expect(page.getByText('Password saved')).toBeVisible(); + + await visitor.reload(); + await expect(visitor.getByText('This public share is password protected.')).toBeVisible(); + + // Removing it opens the share + await passwordCard.getByRole('button', { name: 'Remove password' }).click(); + await expect(page.getByText('Password removed')).toBeVisible(); + await expect(passwordCard.getByText(/No password/)).toBeVisible(); + + await visitor.reload(); + await expect(visitor.getByRole('button', { name: 'Enter as Guest' })).toBeVisible(); + + // Adding a password sends a visitor who is in control back to the password prompt + await visitor.getByRole('button', { name: 'Enter as Guest' }).click(); + await visitor.getByPlaceholder('Guest Name').fill('Visitor'); + await visitor.getByRole('button', { name: 'Enter', exact: true }).click(); + await expect(visitor.getByText('This public share is password protected.')).toBeHidden(); + + await passwordCard.getByLabel('Password', { exact: true }).fill('another secret'); + await passwordCard.getByRole('button', { name: 'Set password' }).click(); + await expect(page.getByText('Password saved')).toBeVisible(); + + await expect( + visitor.getByText('The owner set a new password. Enter it to continue.') + ).toBeVisible(); + + await anon.close(); + }); +}); diff --git a/messages/de.json b/messages/de.json index e5b81100..ff9209d9 100644 --- a/messages/de.json +++ b/messages/de.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Öffentliche Freigabe nicht gefunden", "problem_share_link_shocker_already_in_share_link_title": "Der Shocker ist bereits in dieser öffentlichen Freigabe", "problem_share_link_shocker_not_in_share_link_title": "Der Shocker ist nicht in dieser öffentlichen Freigabe", + "problem_share_link_slug_invalid_title": "Ungültige benutzerdefinierte URL", + "problem_share_link_slug_invalid_desc": "Verwende 2–32 Kleinbuchstaben, Ziffern und einzelne Bindestriche, ohne Bindestrich am Anfang oder Ende.", + "problem_share_link_slug_taken_title": "Du hast bereits eine öffentliche Freigabe mit dieser benutzerdefinierten URL", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Mindestens ein Eintrag ist keine gültige Domain, es wurde nichts hinzugefügt", + "problem_share_shocker_share_limit_reached_title": "Shocker hat zu viele Freigaben", + "problem_share_shocker_share_limit_reached_desc": "Ein Shocker kann mit höchstens 100 Nutzern geteilt werden.", + "problem_share_link_too_many_share_links_title": "Du hast zu viele öffentliche Freigaben", + "problem_share_link_too_many_share_links_desc": "Du hast das Maximum von 500 öffentlichen Freigaben erreicht.", + "problem_share_link_not_password_protected_title": "Diese öffentliche Freigabe hat kein Passwort", + "problem_share_link_password_incorrect_title": "Falsches Passwort", + "problem_share_link_too_many_password_attempts_title": "Zu viele falsche Passwörter", + "problem_share_link_too_many_password_attempts_desc": "Für diese öffentliche Freigabe wurden zu viele falsche Passwörter eingegeben. Versuche es in ein paar Minuten erneut.", + "problem_user_profile_not_found_title": "Profil nicht gefunden", + "problem_user_profile_default_public_share_not_found_title": "Standardmäßige öffentliche Freigabe nicht gefunden", + "problem_user_profile_default_public_share_not_found_desc": "Sie ist möglicherweise abgelaufen oder wurde gelöscht.", + "problem_user_profile_social_invalid_title": "Ungültiges soziales Netzwerk", + "problem_user_profile_social_invalid_desc": "Websites benötigen eine vollständige https://-URL, andere Netzwerke nur deinen Benutzernamen.", "problem_shocker_control_no_permission_title": "Du darfst diesen Shocker nicht steuern", "problem_shocker_control_not_found_title": "Shocker nicht gefunden", "problem_shocker_control_paused_title": "Der Shocker ist pausiert", diff --git a/messages/en.json b/messages/en.json index fed88298..721168e5 100644 --- a/messages/en.json +++ b/messages/en.json @@ -638,6 +638,37 @@ "profile_title": "Profile", "profile_coming_soon": "Profile is coming soon", "profile_coming_soon_desc": "Your public profile is not available yet. Account details live under Settings.", + "profile_subtitle": "Choose what people see on your profile and your public shares.", + "profile_load_failed": "Your profile could not be loaded.", + "profile_view": "View profile", + "profile_public_title": "Public profile", + "profile_public_desc": "Your profile is private until you turn this on.", + "profile_public_toggle": "Make my profile public", + "profile_public_on_hint": "Anyone can see your profile, and your public shares show your pronouns, bio and socials.", + "profile_public_off_hint": "Only you can see your profile. Your public shares still work through their links.", + "profile_about_title": "About you", + "profile_about_desc": "Shown on your profile and on your public shares.", + "profile_pronouns": "Pronouns", + "profile_pronouns_placeholder": "e.g. they/them", + "profile_too_long": "Must be {{max}} characters or fewer", + "profile_bio": "Bio", + "profile_bio_placeholder": "Tell people a bit about yourself", + "profile_socials": "Socials", + "profile_socials_desc": "Links to your other accounts, up to {{max}}.", + "profile_socials_add": "Add social", + "profile_socials_remove": "Remove social", + "profile_social_website": "Website", + "profile_social_invalid_website": "Enter a full URL starting with https://", + "profile_social_invalid_handle": "Enter just your username, without spaces or links", + "profile_default_share": "Default public share", + "profile_default_share_desc": "Shown on your profile page so visitors can use it right away.", + "profile_default_share_none": "None", + "profile_preview": "Preview", + "profile_toast_saved": "Profile saved", + "public_profile_not_found_title": "Profile not found", + "public_profile_not_found_desc": "This user does not exist or has not made their profile public.", + "public_profile_no_default_share": "{{name}} has not picked a public share to show here yet.", + "public_profile_share_failed": "The public share could not be loaded.", "common_retry": "Retry", "common_never_used": "Never used", @@ -851,6 +882,30 @@ "public_share_view_enter": "Enter", "public_share_view_enter_guest": "Enter as Guest", "public_share_login": "Login", + "public_share_custom_url": "Custom URL", + "public_share_custom_url_optional": "Optional, lowercase letters, numbers and hyphens", + "public_share_slug_invalid": "Use 2-32 lowercase letters, numbers and single hyphens", + "public_share_slug_not_found_desc": "This public share does not exist, or its custom URL has changed.", + "public_share_password_title": "Password", + "public_share_password_settings_desc": "Visitors have to enter it before they can see or control the shockers. Setting or changing it disconnects everyone using this public share.", + "public_share_password_status_on": "Password protected", + "public_share_password_status_off": "No password, anyone with the link can use it", + "public_share_password_label": "Password", + "public_share_password_new": "New password", + "public_share_password_optional": "Password (optional)", + "public_share_password_set": "Set password", + "public_share_password_change": "Change password", + "public_share_password_remove": "Remove password", + "public_share_password_length": "Use {{min}} to {{max}} characters.", + "public_share_password_toast_set": "Password saved", + "public_share_password_toast_removed": "Password removed", + "public_share_password_desc": "This public share is password protected.", + "public_share_password_placeholder": "Enter the password", + "public_share_password_unlock": "Unlock", + "public_share_password_changed": "The owner set a new password. Enter it to continue.", + "public_share_settings_title": "Settings", + "public_share_settings_desc": "Name, custom URL and expiry of this public share.", + "public_share_toast_settings_saved": "Public share updated", "perm_shock_on": "Shock enabled", "perm_shock_off": "Shock disabled", "perm_vibrate_on": "Vibrate enabled", @@ -1099,6 +1154,23 @@ "problem_share_link_not_found_title": "Public share not found", "problem_share_link_shocker_already_in_share_link_title": "Shocker is already in this public share", "problem_share_link_shocker_not_in_share_link_title": "Shocker is not in this public share", + "problem_share_link_slug_invalid_title": "Invalid custom URL", + "problem_share_link_slug_invalid_desc": "Use 2-32 lowercase letters, numbers and single hyphens, not starting or ending with a hyphen.", + "problem_share_link_slug_taken_title": "You already have a public share with this custom URL", + "problem_admin_email_provider_blacklist_invalid_domains_title": "One or more entries are not valid domains, nothing was added", + "problem_share_shocker_share_limit_reached_title": "Shocker has too many shares", + "problem_share_shocker_share_limit_reached_desc": "A shocker can be shared with at most 100 users.", + "problem_share_link_too_many_share_links_title": "You have too many public shares", + "problem_share_link_too_many_share_links_desc": "You have reached the maximum of 500 public shares.", + "problem_share_link_not_password_protected_title": "This public share has no password", + "problem_share_link_password_incorrect_title": "Incorrect password", + "problem_share_link_too_many_password_attempts_title": "Too many incorrect passwords", + "problem_share_link_too_many_password_attempts_desc": "Too many incorrect passwords were entered for this public share. Try again in a few minutes.", + "problem_user_profile_not_found_title": "Profile not found", + "problem_user_profile_default_public_share_not_found_title": "Default public share not found", + "problem_user_profile_default_public_share_not_found_desc": "It may have expired or been deleted.", + "problem_user_profile_social_invalid_title": "Invalid social", + "problem_user_profile_social_invalid_desc": "Websites need a full https:// URL, other socials just your username.", "problem_shocker_control_no_permission_title": "You do not have permission to control this shocker", "problem_shocker_control_not_found_title": "Shocker not found", "problem_shocker_control_paused_title": "Shocker is paused", diff --git a/messages/es.json b/messages/es.json index f6ef677d..f7444f0c 100644 --- a/messages/es.json +++ b/messages/es.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "No se encontró el enlace público", "problem_share_link_shocker_already_in_share_link_title": "El shocker ya está en este enlace público", "problem_share_link_shocker_not_in_share_link_title": "El shocker no está en este enlace público", + "problem_share_link_slug_invalid_title": "URL personalizada no válida", + "problem_share_link_slug_invalid_desc": "Usa de 2 a 32 letras minúsculas, números y guiones simples, sin empezar ni terminar con un guion.", + "problem_share_link_slug_taken_title": "Ya tienes un enlace público con esta URL personalizada", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Una o más entradas no son dominios válidos, no se añadió nada", + "problem_share_shocker_share_limit_reached_title": "El shocker tiene demasiados accesos compartidos", + "problem_share_shocker_share_limit_reached_desc": "Un shocker se puede compartir con un máximo de 100 usuarios.", + "problem_share_link_too_many_share_links_title": "Tienes demasiados enlaces públicos", + "problem_share_link_too_many_share_links_desc": "Has alcanzado el máximo de 500 enlaces públicos.", + "problem_share_link_not_password_protected_title": "Este enlace público no tiene contraseña", + "problem_share_link_password_incorrect_title": "Contraseña incorrecta", + "problem_share_link_too_many_password_attempts_title": "Demasiadas contraseñas incorrectas", + "problem_share_link_too_many_password_attempts_desc": "Se introdujeron demasiadas contraseñas incorrectas para este enlace público. Inténtalo de nuevo en unos minutos.", + "problem_user_profile_not_found_title": "No se encontró el perfil", + "problem_user_profile_default_public_share_not_found_title": "No se encontró el enlace público predeterminado", + "problem_user_profile_default_public_share_not_found_desc": "Puede que haya caducado o se haya eliminado.", + "problem_user_profile_social_invalid_title": "Red social no válida", + "problem_user_profile_social_invalid_desc": "Los sitios web necesitan una URL completa con https://; las demás redes, solo tu nombre de usuario.", "problem_shocker_control_no_permission_title": "No tienes permiso para controlar este shocker", "problem_shocker_control_not_found_title": "No se encontró el shocker", "problem_shocker_control_paused_title": "El shocker está en pausa", diff --git a/messages/et.json b/messages/et.json index b4075e5f..5ef03f5d 100644 --- a/messages/et.json +++ b/messages/et.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Avalikku jagamist ei leitud", "problem_share_link_shocker_already_in_share_link_title": "Shocker on juba selles avalikus jagamises", "problem_share_link_shocker_not_in_share_link_title": "Shocker pole selles avalikus jagamises", + "problem_share_link_slug_invalid_title": "Vigane kohandatud URL", + "problem_share_link_slug_invalid_desc": "Kasuta 2–32 väiketähte, numbrit ja üksikut sidekriipsu, mis ei alga ega lõppe sidekriipsuga.", + "problem_share_link_slug_taken_title": "Sul on juba selle kohandatud URL-iga avalik jagamine", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Üks või mitu kirjet ei ole kehtivad domeenid, midagi ei lisatud", + "problem_share_shocker_share_limit_reached_title": "Šokeril on liiga palju jagamisi", + "problem_share_shocker_share_limit_reached_desc": "Šokerit saab jagada kõige rohkem 100 kasutajaga.", + "problem_share_link_too_many_share_links_title": "Sul on liiga palju avalikke jagamisi", + "problem_share_link_too_many_share_links_desc": "Oled jõudnud 500 avaliku jagamise piirini.", + "problem_share_link_not_password_protected_title": "Sellel avalikul jagamisel pole parooli", + "problem_share_link_password_incorrect_title": "Vale parool", + "problem_share_link_too_many_password_attempts_title": "Liiga palju valesid paroole", + "problem_share_link_too_many_password_attempts_desc": "Selle avaliku jagamise jaoks sisestati liiga palju valesid paroole. Proovi mõne minuti pärast uuesti.", + "problem_user_profile_not_found_title": "Profiili ei leitud", + "problem_user_profile_default_public_share_not_found_title": "Vaikimisi avalikku jagamist ei leitud", + "problem_user_profile_default_public_share_not_found_desc": "See võib olla aegunud või kustutatud.", + "problem_user_profile_social_invalid_title": "Vigane sotsiaalmeedia konto", + "problem_user_profile_social_invalid_desc": "Veebisaidid vajavad täielikku https:// URL-i, teised kontod ainult sinu kasutajanime.", "problem_shocker_control_no_permission_title": "Sul pole õigust seda shockerit juhtida", "problem_shocker_control_not_found_title": "Shockerit ei leitud", "problem_shocker_control_paused_title": "Shocker on peatatud", diff --git a/messages/fi.json b/messages/fi.json index 83b00122..660eecda 100644 --- a/messages/fi.json +++ b/messages/fi.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Julkista jakoa ei löytynyt", "problem_share_link_shocker_already_in_share_link_title": "Shocker on jo tässä julkisessa jaossa", "problem_share_link_shocker_not_in_share_link_title": "Shocker ei ole tässä julkisessa jaossa", + "problem_share_link_slug_invalid_title": "Virheellinen mukautettu URL", + "problem_share_link_slug_invalid_desc": "Käytä 2–32 pientä kirjainta, numeroa ja yksittäistä yhdysmerkkiä, ei yhdysmerkkiä alussa tai lopussa.", + "problem_share_link_slug_taken_title": "Sinulla on jo julkinen jako tällä mukautetulla URL-osoitteella", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Yksi tai useampi merkintä ei ole kelvollinen verkkotunnus, mitään ei lisätty", + "problem_share_shocker_share_limit_reached_title": "Shockerilla on liian monta jakoa", + "problem_share_shocker_share_limit_reached_desc": "Shockerin voi jakaa enintään 100 käyttäjälle.", + "problem_share_link_too_many_share_links_title": "Sinulla on liian monta julkista jakoa", + "problem_share_link_too_many_share_links_desc": "Olet saavuttanut 500 julkisen jaon enimmäismäärän.", + "problem_share_link_not_password_protected_title": "Tällä julkisella jaolla ei ole salasanaa", + "problem_share_link_password_incorrect_title": "Väärä salasana", + "problem_share_link_too_many_password_attempts_title": "Liian monta väärää salasanaa", + "problem_share_link_too_many_password_attempts_desc": "Tälle julkiselle jaolle syötettiin liian monta väärää salasanaa. Yritä uudelleen muutaman minuutin kuluttua.", + "problem_user_profile_not_found_title": "Profiilia ei löytynyt", + "problem_user_profile_default_public_share_not_found_title": "Oletusarvoista julkista jakoa ei löytynyt", + "problem_user_profile_default_public_share_not_found_desc": "Se on voinut vanhentua tai se on poistettu.", + "problem_user_profile_social_invalid_title": "Virheellinen some-tili", + "problem_user_profile_social_invalid_desc": "Verkkosivustot tarvitsevat täyden https://-osoitteen, muut tilit vain käyttäjänimesi.", "problem_shocker_control_no_permission_title": "Sinulla ei ole oikeutta ohjata tätä shockeria", "problem_shocker_control_not_found_title": "Shockeria ei löytynyt", "problem_shocker_control_paused_title": "Shocker on keskeytetty", diff --git a/messages/fr.json b/messages/fr.json index 19f92a7f..19659627 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Partage public introuvable", "problem_share_link_shocker_already_in_share_link_title": "Le shocker est déjà dans ce partage public", "problem_share_link_shocker_not_in_share_link_title": "Le shocker n'est pas dans ce partage public", + "problem_share_link_slug_invalid_title": "URL personnalisée invalide", + "problem_share_link_slug_invalid_desc": "Utilise de 2 à 32 lettres minuscules, chiffres et tirets simples, sans tiret au début ni à la fin.", + "problem_share_link_slug_taken_title": "Tu as déjà un partage public avec cette URL personnalisée", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Une ou plusieurs entrées ne sont pas des domaines valides, rien n’a été ajouté", + "problem_share_shocker_share_limit_reached_title": "Le shocker a trop de partages", + "problem_share_shocker_share_limit_reached_desc": "Un shocker peut être partagé avec 100 utilisateurs au maximum.", + "problem_share_link_too_many_share_links_title": "Tu as trop de partages publics", + "problem_share_link_too_many_share_links_desc": "Tu as atteint le maximum de 500 partages publics.", + "problem_share_link_not_password_protected_title": "Ce partage public n’a pas de mot de passe", + "problem_share_link_password_incorrect_title": "Mot de passe incorrect", + "problem_share_link_too_many_password_attempts_title": "Trop de mots de passe incorrects", + "problem_share_link_too_many_password_attempts_desc": "Trop de mots de passe incorrects ont été saisis pour ce partage public. Réessaie dans quelques minutes.", + "problem_user_profile_not_found_title": "Profil introuvable", + "problem_user_profile_default_public_share_not_found_title": "Partage public par défaut introuvable", + "problem_user_profile_default_public_share_not_found_desc": "Il a peut-être expiré ou été supprimé.", + "problem_user_profile_social_invalid_title": "Réseau social invalide", + "problem_user_profile_social_invalid_desc": "Les sites web nécessitent une URL complète en https://, les autres réseaux seulement ton nom d’utilisateur.", "problem_shocker_control_no_permission_title": "Vous n'êtes pas autorisé à contrôler ce shocker", "problem_shocker_control_not_found_title": "Shocker introuvable", "problem_shocker_control_paused_title": "Le shocker est en pause", diff --git a/messages/ja.json b/messages/ja.json index 49fe349e..78c3ac30 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -1047,6 +1047,23 @@ "problem_share_link_not_found_title": "公開共有が見つかりません", "problem_share_link_shocker_already_in_share_link_title": "ショッカーはすでにこの公開共有に含まれています", "problem_share_link_shocker_not_in_share_link_title": "ショッカーはこの公開共有に含まれていません", + "problem_share_link_slug_invalid_title": "カスタムURLが無効です", + "problem_share_link_slug_invalid_desc": "小文字、数字、単一のハイフンを2~32文字で使用してください。先頭と末尾にハイフンは使えません。", + "problem_share_link_slug_taken_title": "このカスタムURLの公開共有はすでにあります", + "problem_admin_email_provider_blacklist_invalid_domains_title": "無効なドメインが含まれているため、何も追加されませんでした", + "problem_share_shocker_share_limit_reached_title": "このショッカーの共有が多すぎます", + "problem_share_shocker_share_limit_reached_desc": "ショッカーは最大100人のユーザーと共有できます。", + "problem_share_link_too_many_share_links_title": "公開共有が多すぎます", + "problem_share_link_too_many_share_links_desc": "公開共有の上限(500件)に達しました。", + "problem_share_link_not_password_protected_title": "この公開共有にはパスワードがありません", + "problem_share_link_password_incorrect_title": "パスワードが正しくありません", + "problem_share_link_too_many_password_attempts_title": "パスワードの入力ミスが多すぎます", + "problem_share_link_too_many_password_attempts_desc": "この公開共有に対して誤ったパスワードが何度も入力されました。数分後にもう一度お試しください。", + "problem_user_profile_not_found_title": "プロフィールが見つかりません", + "problem_user_profile_default_public_share_not_found_title": "デフォルトの公開共有が見つかりません", + "problem_user_profile_default_public_share_not_found_desc": "期限切れか、削除された可能性があります。", + "problem_user_profile_social_invalid_title": "SNSが無効です", + "problem_user_profile_social_invalid_desc": "ウェブサイトは https:// から始まる完全なURL、その他のSNSはユーザー名のみを入力してください。", "problem_shocker_control_no_permission_title": "このショッカーを操作する権限がありません", "problem_shocker_control_not_found_title": "ショッカーが見つかりません", "problem_shocker_control_paused_title": "ショッカーは一時停止中です", diff --git a/messages/nb.json b/messages/nb.json index e8db3d28..61d911f3 100644 --- a/messages/nb.json +++ b/messages/nb.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Fant ikke delingslenken", "problem_share_link_shocker_already_in_share_link_title": "Denne shockeren deles allerede via lenken", "problem_share_link_shocker_not_in_share_link_title": "Denne shockeren deles ikke via lenken", + "problem_share_link_slug_invalid_title": "Ugyldig egendefinert URL", + "problem_share_link_slug_invalid_desc": "Bruk 2–32 små bokstaver, tall og enkle bindestreker, uten bindestrek først eller sist.", + "problem_share_link_slug_taken_title": "Du har allerede en delingslenke med denne egendefinerte URL-en", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Én eller flere oppføringer er ikke gyldige domener, ingenting ble lagt til", + "problem_share_shocker_share_limit_reached_title": "Shockeren har for mange delinger", + "problem_share_shocker_share_limit_reached_desc": "En shocker kan deles med høyst 100 brukere.", + "problem_share_link_too_many_share_links_title": "Du har for mange delingslenker", + "problem_share_link_too_many_share_links_desc": "Du har nådd maksimum på 500 delingslenker.", + "problem_share_link_not_password_protected_title": "Denne delingslenken har ikke passord", + "problem_share_link_password_incorrect_title": "Feil passord", + "problem_share_link_too_many_password_attempts_title": "For mange feil passord", + "problem_share_link_too_many_password_attempts_desc": "Det ble skrevet inn for mange feil passord for denne delingslenken. Prøv igjen om noen minutter.", + "problem_user_profile_not_found_title": "Fant ikke profilen", + "problem_user_profile_default_public_share_not_found_title": "Fant ikke standard delingslenke", + "problem_user_profile_default_public_share_not_found_desc": "Den kan ha utløpt eller blitt slettet.", + "problem_user_profile_social_invalid_title": "Ugyldig sosial konto", + "problem_user_profile_social_invalid_desc": "Nettsteder trenger en fullstendig https://-URL, andre kontoer bare brukernavnet ditt.", "problem_shocker_control_no_permission_title": "Du har ikke tillatelse til å styre denne shockeren", "problem_shocker_control_not_found_title": "Fant ikke shockeren", "problem_shocker_control_paused_title": "Shockeren er satt på pause", diff --git a/messages/nl.json b/messages/nl.json index 008fd897..8bdad6fa 100644 --- a/messages/nl.json +++ b/messages/nl.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Openbare deling niet gevonden", "problem_share_link_shocker_already_in_share_link_title": "Shocker zit al in deze openbare deling", "problem_share_link_shocker_not_in_share_link_title": "Shocker zit niet in deze openbare deling", + "problem_share_link_slug_invalid_title": "Ongeldige aangepaste URL", + "problem_share_link_slug_invalid_desc": "Gebruik 2–32 kleine letters, cijfers en enkele koppeltekens, zonder koppelteken aan het begin of eind.", + "problem_share_link_slug_taken_title": "Je hebt al een openbare deling met deze aangepaste URL", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Een of meer items zijn geen geldige domeinen, er is niets toegevoegd", + "problem_share_shocker_share_limit_reached_title": "Shocker heeft te veel deelacties", + "problem_share_shocker_share_limit_reached_desc": "Een shocker kan met maximaal 100 gebruikers worden gedeeld.", + "problem_share_link_too_many_share_links_title": "Je hebt te veel openbare delingen", + "problem_share_link_too_many_share_links_desc": "Je hebt het maximum van 500 openbare delingen bereikt.", + "problem_share_link_not_password_protected_title": "Deze openbare deling heeft geen wachtwoord", + "problem_share_link_password_incorrect_title": "Onjuist wachtwoord", + "problem_share_link_too_many_password_attempts_title": "Te veel onjuiste wachtwoorden", + "problem_share_link_too_many_password_attempts_desc": "Er zijn te veel onjuiste wachtwoorden ingevoerd voor deze openbare deling. Probeer het over een paar minuten opnieuw.", + "problem_user_profile_not_found_title": "Profiel niet gevonden", + "problem_user_profile_default_public_share_not_found_title": "Standaard openbare deling niet gevonden", + "problem_user_profile_default_public_share_not_found_desc": "Deze is mogelijk verlopen of verwijderd.", + "problem_user_profile_social_invalid_title": "Ongeldig sociaal account", + "problem_user_profile_social_invalid_desc": "Websites hebben een volledige https://-URL nodig, andere accounts alleen je gebruikersnaam.", "problem_shocker_control_no_permission_title": "Je hebt geen toestemming om deze shocker te bedienen", "problem_shocker_control_not_found_title": "Shocker niet gevonden", "problem_shocker_control_paused_title": "Shocker is gepauzeerd", diff --git a/messages/sv.json b/messages/sv.json index 65926ced..d30bd1d2 100644 --- a/messages/sv.json +++ b/messages/sv.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Den offentliga delningen hittades inte", "problem_share_link_shocker_already_in_share_link_title": "Shockern finns redan i den här offentliga delningen", "problem_share_link_shocker_not_in_share_link_title": "Shockern finns inte i den här offentliga delningen", + "problem_share_link_slug_invalid_title": "Ogiltig anpassad URL", + "problem_share_link_slug_invalid_desc": "Använd 2–32 små bokstäver, siffror och enstaka bindestreck, utan bindestreck först eller sist.", + "problem_share_link_slug_taken_title": "Du har redan en offentlig delning med den här anpassade URL:en", + "problem_admin_email_provider_blacklist_invalid_domains_title": "En eller flera poster är inte giltiga domäner, inget lades till", + "problem_share_shocker_share_limit_reached_title": "Shockern har för många delningar", + "problem_share_shocker_share_limit_reached_desc": "En shocker kan delas med högst 100 användare.", + "problem_share_link_too_many_share_links_title": "Du har för många offentliga delningar", + "problem_share_link_too_many_share_links_desc": "Du har nått maxgränsen på 500 offentliga delningar.", + "problem_share_link_not_password_protected_title": "Den här offentliga delningen har inget lösenord", + "problem_share_link_password_incorrect_title": "Fel lösenord", + "problem_share_link_too_many_password_attempts_title": "För många felaktiga lösenord", + "problem_share_link_too_many_password_attempts_desc": "För många felaktiga lösenord har angetts för den här offentliga delningen. Försök igen om några minuter.", + "problem_user_profile_not_found_title": "Profilen hittades inte", + "problem_user_profile_default_public_share_not_found_title": "Den förvalda offentliga delningen hittades inte", + "problem_user_profile_default_public_share_not_found_desc": "Den kan ha gått ut eller tagits bort.", + "problem_user_profile_social_invalid_title": "Ogiltigt socialt konto", + "problem_user_profile_social_invalid_desc": "Webbplatser behöver en fullständig https://-URL, andra konton bara ditt användarnamn.", "problem_shocker_control_no_permission_title": "Du har inte behörighet att styra den här shockern", "problem_shocker_control_not_found_title": "Shockern hittades inte", "problem_shocker_control_paused_title": "Shockern är pausad", diff --git a/messages/uk.json b/messages/uk.json index e4342bb7..05120621 100644 --- a/messages/uk.json +++ b/messages/uk.json @@ -1062,6 +1062,23 @@ "problem_share_link_not_found_title": "Публічне посилання не знайдено", "problem_share_link_shocker_already_in_share_link_title": "Шокер уже є в цьому публічному посиланні", "problem_share_link_shocker_not_in_share_link_title": "Шокера немає в цьому публічному посиланні", + "problem_share_link_slug_invalid_title": "Недійсна власна URL-адреса", + "problem_share_link_slug_invalid_desc": "Використовуйте 2–32 малі літери, цифри та поодинокі дефіси, без дефіса на початку чи в кінці.", + "problem_share_link_slug_taken_title": "У вас уже є публічне посилання з цією власною URL-адресою", + "problem_admin_email_provider_blacklist_invalid_domains_title": "Один або кілька записів не є дійсними доменами, нічого не додано", + "problem_share_shocker_share_limit_reached_title": "Шокер має забагато спільних доступів", + "problem_share_shocker_share_limit_reached_desc": "Шокер можна поділити щонайбільше зі 100 користувачами.", + "problem_share_link_too_many_share_links_title": "У вас забагато публічних посилань", + "problem_share_link_too_many_share_links_desc": "Ви досягли максимуму в 500 публічних посилань.", + "problem_share_link_not_password_protected_title": "Це публічне посилання не має пароля", + "problem_share_link_password_incorrect_title": "Неправильний пароль", + "problem_share_link_too_many_password_attempts_title": "Забагато неправильних паролів", + "problem_share_link_too_many_password_attempts_desc": "Для цього публічного посилання введено забагато неправильних паролів. Спробуйте ще раз за кілька хвилин.", + "problem_user_profile_not_found_title": "Профіль не знайдено", + "problem_user_profile_default_public_share_not_found_title": "Публічне посилання за замовчуванням не знайдено", + "problem_user_profile_default_public_share_not_found_desc": "Можливо, термін його дії минув або його видалено.", + "problem_user_profile_social_invalid_title": "Недійсна соцмережа", + "problem_user_profile_social_invalid_desc": "Для вебсайтів потрібна повна URL-адреса з https://, для інших соцмереж — лише ваше ім’я користувача.", "problem_shocker_control_no_permission_title": "У тебе немає дозволу керувати цим шокером", "problem_shocker_control_not_found_title": "Шокер не знайдено", "problem_shocker_control_paused_title": "Шокер призупинено", diff --git a/messages/uwu.json b/messages/uwu.json index b4ac5393..cf33402d 100644 --- a/messages/uwu.json +++ b/messages/uwu.json @@ -1052,6 +1052,23 @@ "problem_share_link_not_found_title": "Couldn't sniff out that public share", "problem_share_link_shocker_already_in_share_link_title": "That zappy fwiend is already here", "problem_share_link_shocker_not_in_share_link_title": "That zappy fwiend isn't in this share", + "problem_share_link_slug_invalid_title": "That custom URL is all wonky", + "problem_share_link_slug_invalid_desc": "Use 2-32 wowercase wetters, numbers and singwe hyphens, no hyphen at the stawt ow end, pwease~", + "problem_share_link_slug_taken_title": "You alweady have a public share with that custom URL", + "problem_admin_email_provider_blacklist_invalid_domains_title": "One ow mowe entwies awen't vawid domains, nyothing was added >w<", + "problem_share_shocker_share_limit_reached_title": "Shockew has too many shawes", + "problem_share_shocker_share_limit_reached_desc": "A shockew can be shawed with at most 100 usews.", + "problem_share_link_too_many_share_links_title": "You have too many pubwic shawes", + "problem_share_link_too_many_share_links_desc": "You've weached the maximum of 500 pubwic shawes.", + "problem_share_link_not_password_protected_title": "This pubwic shawe has nyo passwowd", + "problem_share_link_password_incorrect_title": "Incowwect passwowd", + "problem_share_link_too_many_password_attempts_title": "Too many wwong passwowds", + "problem_share_link_too_many_password_attempts_desc": "Too many wwong passwowds wewe entewed fow this pubwic shawe. Twy again in a few minutes uwu", + "problem_user_profile_not_found_title": "Couldn't sniff out that profile", + "problem_user_profile_default_public_share_not_found_title": "Couldn't sniff out your defauwt public share", + "problem_user_profile_default_public_share_not_found_desc": "It might have expiwed ow been deweted.", + "problem_user_profile_social_invalid_title": "That social is all wonky", + "problem_user_profile_social_invalid_desc": "Websites need a fuww https:// URL, othew socials just youw usewname~", "problem_shocker_control_no_permission_title": "You can't boop this zappy fwiend", "problem_shocker_control_not_found_title": "Couldn't sniff out that zappy fwiend", "problem_shocker_control_paused_title": "That zappy fwiend is napping 💤", diff --git a/messages/zh-Hans.json b/messages/zh-Hans.json index 06f59f47..47d660b6 100644 --- a/messages/zh-Hans.json +++ b/messages/zh-Hans.json @@ -1047,6 +1047,23 @@ "problem_share_link_not_found_title": "未找到公开共享", "problem_share_link_shocker_already_in_share_link_title": "该电击器已在此公开共享中", "problem_share_link_shocker_not_in_share_link_title": "该电击器不在此公开共享中", + "problem_share_link_slug_invalid_title": "自定义 URL 无效", + "problem_share_link_slug_invalid_desc": "请使用 2–32 个小写字母、数字和单个连字符,且不能以连字符开头或结尾。", + "problem_share_link_slug_taken_title": "你已有使用此自定义 URL 的公开共享", + "problem_admin_email_provider_blacklist_invalid_domains_title": "一个或多个条目不是有效域名,未添加任何内容", + "problem_share_shocker_share_limit_reached_title": "该电击器的共享过多", + "problem_share_shocker_share_limit_reached_desc": "一个电击器最多可与 100 位用户共享。", + "problem_share_link_too_many_share_links_title": "你的公开共享过多", + "problem_share_link_too_many_share_links_desc": "你已达到 500 个公开共享的上限。", + "problem_share_link_not_password_protected_title": "此公开共享没有密码", + "problem_share_link_password_incorrect_title": "密码错误", + "problem_share_link_too_many_password_attempts_title": "密码错误次数过多", + "problem_share_link_too_many_password_attempts_desc": "此公开共享的密码错误次数过多。请几分钟后再试。", + "problem_user_profile_not_found_title": "未找到个人资料", + "problem_user_profile_default_public_share_not_found_title": "未找到默认公开共享", + "problem_user_profile_default_public_share_not_found_desc": "它可能已过期或已被删除。", + "problem_user_profile_social_invalid_title": "社交账号无效", + "problem_user_profile_social_invalid_desc": "网站需要以 https:// 开头的完整 URL,其他社交账号只需填写用户名。", "problem_shocker_control_no_permission_title": "你无权控制此电击器", "problem_shocker_control_not_found_title": "未找到电击器", "problem_shocker_control_paused_title": "电击器已暂停", diff --git a/messages/zh-Hant.json b/messages/zh-Hant.json index 393252a3..85c18ba3 100644 --- a/messages/zh-Hant.json +++ b/messages/zh-Hant.json @@ -1047,6 +1047,23 @@ "problem_share_link_not_found_title": "找不到公開分享", "problem_share_link_shocker_already_in_share_link_title": "電擊器已在此公開分享中", "problem_share_link_shocker_not_in_share_link_title": "電擊器不在此公開分享中", + "problem_share_link_slug_invalid_title": "自訂網址無效", + "problem_share_link_slug_invalid_desc": "請使用 2–32 個小寫字母、數字和單一連字號,且不能以連字號開頭或結尾。", + "problem_share_link_slug_taken_title": "你已有使用此自訂網址的公開分享", + "problem_admin_email_provider_blacklist_invalid_domains_title": "一個或多個項目不是有效網域,未新增任何內容", + "problem_share_shocker_share_limit_reached_title": "該電擊器的共享過多", + "problem_share_shocker_share_limit_reached_desc": "一個電擊器最多可與 100 位使用者共享。", + "problem_share_link_too_many_share_links_title": "你的公開分享過多", + "problem_share_link_too_many_share_links_desc": "你已達到 500 個公開分享的上限。", + "problem_share_link_not_password_protected_title": "此公開分享沒有密碼", + "problem_share_link_password_incorrect_title": "密碼錯誤", + "problem_share_link_too_many_password_attempts_title": "密碼錯誤次數過多", + "problem_share_link_too_many_password_attempts_desc": "此公開分享的密碼錯誤次數過多。請幾分鐘後再試。", + "problem_user_profile_not_found_title": "找不到個人檔案", + "problem_user_profile_default_public_share_not_found_title": "找不到預設公開分享", + "problem_user_profile_default_public_share_not_found_desc": "它可能已過期或已被刪除。", + "problem_user_profile_social_invalid_title": "社群帳號無效", + "problem_user_profile_social_invalid_desc": "網站需要以 https:// 開頭的完整網址,其他社群帳號只需填寫使用者名稱。", "problem_shocker_control_no_permission_title": "你沒有控制此電擊器的權限", "problem_shocker_control_not_found_title": "找不到電擊器", "problem_shocker_control_paused_title": "電擊器已暫停", diff --git a/src/lib/api/internal/generated/index.ts b/src/lib/api/internal/generated/index.ts index b95edc35..958c5b3d 100644 --- a/src/lib/api/internal/generated/index.ts +++ b/src/lib/api/internal/generated/index.ts @@ -57,9 +57,11 @@ export { authenticatedAccountChangeUsername, authenticatedAccountDeactivate, authenticatedAccountGetAuditLog, + authenticatedAccountGetProfile, authenticatedAccountGetSelf, authenticatedAccountListOAuthConnections, authenticatedAccountRemoveOAuthConnection, + authenticatedAccountUpdateProfile, deviceGetLiveControlGatewayV2, deviceGetSelf, devicePair, @@ -76,16 +78,21 @@ export { integrationsGetControlStatChanges, publicGetOnlineDevicesStatistics, publicGetPublicShare, + publicGetPublicShareBySlug, + publicGetUserProfile, + publicUnlockPublicShare, sessionsDeleteSession, sessionsGetSelfSession, sessionsListSessions, shareLinksAddShocker, shareLinksCreatePublicShare, shareLinksDeletePublicShare, + shareLinksEditPublicShare, shareLinksEditShocker, shareLinksList, shareLinksPauseShocker, shareLinksRemoveShocker, + shareLinksSetPublicSharePassword, sharesDeleteShareCode, sharesLinkShareCode, shockerEditShocker, @@ -143,6 +150,7 @@ export { PermissionType, RoleType, ShockerModelType, + SocialPlatform, SortDirection, UsernameAvailability, UsernameErrorType, @@ -396,6 +404,9 @@ export { type AuthenticatedAccountGetAuditLogData, type AuthenticatedAccountGetAuditLogResponse, type AuthenticatedAccountGetAuditLogResponses, + type AuthenticatedAccountGetProfileData, + type AuthenticatedAccountGetProfileResponse, + type AuthenticatedAccountGetProfileResponses, type AuthenticatedAccountGetSelfData, type AuthenticatedAccountGetSelfResponse, type AuthenticatedAccountGetSelfResponses, @@ -407,6 +418,11 @@ export { type AuthenticatedAccountRemoveOAuthConnectionErrors, type AuthenticatedAccountRemoveOAuthConnectionResponse, type AuthenticatedAccountRemoveOAuthConnectionResponses, + type AuthenticatedAccountUpdateProfileData, + type AuthenticatedAccountUpdateProfileError, + type AuthenticatedAccountUpdateProfileErrors, + type AuthenticatedAccountUpdateProfileResponse, + type AuthenticatedAccountUpdateProfileResponses, type AutomationTokenDto, type BackendInfoResponse, type BasicUserInfo, @@ -545,6 +561,7 @@ export { type OpenShockProblem, type OtaItem, type OwnPublicShareResponse, + type OwnUserProfileResponse, type OwnerShockerResponse, type PagedResultOfAuditLogEntryResponse, type PagedResultOfLogEntryWithHub, @@ -560,16 +577,39 @@ export { type PublicGetOnlineDevicesStatisticsData, type PublicGetOnlineDevicesStatisticsResponse, type PublicGetOnlineDevicesStatisticsResponses, + type PublicGetPublicShareBySlugData, + type PublicGetPublicShareBySlugError, + type PublicGetPublicShareBySlugErrors, + type PublicGetPublicShareBySlugResponse, + type PublicGetPublicShareBySlugResponses, type PublicGetPublicShareData, type PublicGetPublicShareError, type PublicGetPublicShareErrors, type PublicGetPublicShareResponse, type PublicGetPublicShareResponses, + type PublicGetUserProfileData, + type PublicGetUserProfileError, + type PublicGetUserProfileErrors, + type PublicGetUserProfileResponse, + type PublicGetUserProfileResponses, + type PublicShareAuthor, type PublicShareCreate, type PublicShareDevice, + type PublicShareEdit, type PublicShareEditShocker, + type PublicSharePasswordSet, type PublicShareResponse, type PublicShareShocker, + type PublicShareUnlock, + type PublicShareUnlockResponse, + type PublicUnlockPublicShareData, + type PublicUnlockPublicShareError, + type PublicUnlockPublicShareErrors, + type PublicUnlockPublicShareResponse, + type PublicUnlockPublicShareResponses, + type PublicUserProfileDetails, + type PublicUserProfilePublicShare, + type PublicUserProfileResponse, type ReceivedControlStats, type RemoveUserSharesResponse, type ReportTokensRequest, @@ -606,6 +646,11 @@ export { type ShareLinksDeletePublicShareErrors, type ShareLinksDeletePublicShareResponse, type ShareLinksDeletePublicShareResponses, + type ShareLinksEditPublicShareData, + type ShareLinksEditPublicShareError, + type ShareLinksEditPublicShareErrors, + type ShareLinksEditPublicShareResponse, + type ShareLinksEditPublicShareResponses, type ShareLinksEditShockerData, type ShareLinksEditShockerError, type ShareLinksEditShockerErrors, @@ -624,6 +669,11 @@ export { type ShareLinksRemoveShockerErrors, type ShareLinksRemoveShockerResponse, type ShareLinksRemoveShockerResponses, + type ShareLinksSetPublicSharePasswordData, + type ShareLinksSetPublicSharePasswordError, + type ShareLinksSetPublicSharePasswordErrors, + type ShareLinksSetPublicSharePasswordResponse, + type ShareLinksSetPublicSharePasswordResponses, type SharedDevice, type SharedShocker, type SharesDeleteShareCodeData, @@ -760,6 +810,8 @@ export { type UserControlStats, type UserNameBlacklistDto, type UserPatchDto, + type UserProfileSocial, + type UserProfileUpdate, type UserSelfResponse, type UserShareInfo, type UserSharesBulkPauseUserShareShockersData, diff --git a/src/lib/api/internal/generated/sdk.gen.ts b/src/lib/api/internal/generated/sdk.gen.ts index aca66270..209ed050 100644 --- a/src/lib/api/internal/generated/sdk.gen.ts +++ b/src/lib/api/internal/generated/sdk.gen.ts @@ -26,10 +26,14 @@ import { devicesOtaGetOtaUpdateHistoryResponseTransformer, integrationsGetControlStatChangesResponseTransformer, publicGetOnlineDevicesStatisticsResponseTransformer, + publicGetPublicShareBySlugResponseTransformer, publicGetPublicShareResponseTransformer, + publicUnlockPublicShareResponseTransformer, sessionsGetSelfSessionResponseTransformer, sessionsListSessionsResponseTransformer, + shareLinksEditPublicShareResponseTransformer, shareLinksListResponseTransformer, + shareLinksSetPublicSharePasswordResponseTransformer, shockerGetAllShockerLogsResponseTransformer, shockerGetShockerByIdResponseTransformer, shockerGetShockerLogsResponseTransformer, @@ -207,6 +211,8 @@ import type { AuthenticatedAccountDeactivateResponses, AuthenticatedAccountGetAuditLogData, AuthenticatedAccountGetAuditLogResponses, + AuthenticatedAccountGetProfileData, + AuthenticatedAccountGetProfileResponses, AuthenticatedAccountGetSelfData, AuthenticatedAccountGetSelfResponses, AuthenticatedAccountListOAuthConnectionsData, @@ -214,6 +220,9 @@ import type { AuthenticatedAccountRemoveOAuthConnectionData, AuthenticatedAccountRemoveOAuthConnectionErrors, AuthenticatedAccountRemoveOAuthConnectionResponses, + AuthenticatedAccountUpdateProfileData, + AuthenticatedAccountUpdateProfileErrors, + AuthenticatedAccountUpdateProfileResponses, DeviceGetLiveControlGatewayV2Data, DeviceGetLiveControlGatewayV2Errors, DeviceGetLiveControlGatewayV2Responses, @@ -255,9 +264,18 @@ import type { IntegrationsGetControlStatChangesResponses, PublicGetOnlineDevicesStatisticsData, PublicGetOnlineDevicesStatisticsResponses, + PublicGetPublicShareBySlugData, + PublicGetPublicShareBySlugErrors, + PublicGetPublicShareBySlugResponses, PublicGetPublicShareData, PublicGetPublicShareErrors, PublicGetPublicShareResponses, + PublicGetUserProfileData, + PublicGetUserProfileErrors, + PublicGetUserProfileResponses, + PublicUnlockPublicShareData, + PublicUnlockPublicShareErrors, + PublicUnlockPublicShareResponses, SessionsDeleteSessionData, SessionsDeleteSessionErrors, SessionsDeleteSessionResponses, @@ -274,6 +292,9 @@ import type { ShareLinksDeletePublicShareData, ShareLinksDeletePublicShareErrors, ShareLinksDeletePublicShareResponses, + ShareLinksEditPublicShareData, + ShareLinksEditPublicShareErrors, + ShareLinksEditPublicShareResponses, ShareLinksEditShockerData, ShareLinksEditShockerErrors, ShareLinksEditShockerResponses, @@ -285,6 +306,9 @@ import type { ShareLinksRemoveShockerData, ShareLinksRemoveShockerErrors, ShareLinksRemoveShockerResponses, + ShareLinksSetPublicSharePasswordData, + ShareLinksSetPublicSharePasswordErrors, + ShareLinksSetPublicSharePasswordResponses, SharesDeleteShareCodeData, SharesDeleteShareCodeErrors, SharesDeleteShareCodeResponses, @@ -820,7 +844,8 @@ export const shockerSendControl = ( /** * Set the global permissions and limits of a shocker. They apply to every control of the shocker, including - * the owner's own, on top of any share or token restrictions. A null limit means uncapped. + * the owner's own, on top of any share or token restrictions. A null limit means uncapped. The duration limit + * does not apply to live control; disallow live control to bound it. */ export const shockerSetShockerPermissions = ( options: Options @@ -1342,6 +1367,33 @@ export const shareLinksDeletePublicShare = ...options, }); +/** + * Edit the name, expiry and slug of a public share + */ +export const shareLinksEditPublicShare = ( + options: Options +): RequestResult< + ShareLinksEditPublicShareResponses, + ShareLinksEditPublicShareErrors, + ThrowOnError, + 'data' +> => + (options.client ?? client).put< + ShareLinksEditPublicShareResponses, + ShareLinksEditPublicShareErrors, + ThrowOnError, + 'data' + >({ + responseTransformer: shareLinksEditPublicShareResponseTransformer, + responseStyle: 'data', + url: '/1/shares/links/{publicShareId}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers, + }, + }); + /** * Pause a shocker in a public share */ @@ -1368,6 +1420,36 @@ export const shareLinksPauseShocker = ( }, }); +/** + * Set, change or remove the password of a public share + * + * Setting or changing the password disconnects everyone currently using the share; they have to enter the + * new one. Removing it keeps them connected. + */ +export const shareLinksSetPublicSharePassword = ( + options: Options +): RequestResult< + ShareLinksSetPublicSharePasswordResponses, + ShareLinksSetPublicSharePasswordErrors, + ThrowOnError, + 'data' +> => + (options.client ?? client).put< + ShareLinksSetPublicSharePasswordResponses, + ShareLinksSetPublicSharePasswordErrors, + ThrowOnError, + 'data' + >({ + responseTransformer: shareLinksSetPublicSharePasswordResponseTransformer, + responseStyle: 'data', + url: '/1/shares/links/{publicShareId}/password', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers, + }, + }); + export const sessionsDeleteSession = ( options: Options ): RequestResult< @@ -1428,6 +1510,23 @@ export const publicGetOnlineDevicesStatistics = ( + options: Options +): RequestResult => + (options.client ?? client).get< + PublicGetUserProfileResponses, + PublicGetUserProfileErrors, + ThrowOnError, + 'data' + >({ + responseStyle: 'data', + url: '/1/public/users/{username}', + ...options, + }); + /** * Gets information about a public share. */ @@ -1446,6 +1545,56 @@ export const publicGetPublicShare = ( ...options, }); +/** + * Gets information about a public share by its owner's username and custom slug. + */ +export const publicGetPublicShareBySlug = ( + options: Options +): RequestResult< + PublicGetPublicShareBySlugResponses, + PublicGetPublicShareBySlugErrors, + ThrowOnError, + 'data' +> => + (options.client ?? client).get< + PublicGetPublicShareBySlugResponses, + PublicGetPublicShareBySlugErrors, + ThrowOnError, + 'data' + >({ + responseTransformer: publicGetPublicShareBySlugResponseTransformer, + responseStyle: 'data', + url: '/1/public/shares/links/by-slug/{username}/{slug}', + ...options, + }); + +/** + * Unlocks a password-protected public share. + */ +export const publicUnlockPublicShare = ( + options: Options +): RequestResult< + PublicUnlockPublicShareResponses, + PublicUnlockPublicShareErrors, + ThrowOnError, + 'data' +> => + (options.client ?? client).post< + PublicUnlockPublicShareResponses, + PublicUnlockPublicShareErrors, + ThrowOnError, + 'data' + >({ + responseTransformer: publicUnlockPublicShareResponseTransformer, + responseStyle: 'data', + url: '/1/public/shares/links/{publicShareId}/unlock', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers, + }, + }); + /** * Lets a service holding many users keep their lifetime control stats in sync with a single call per tick. * Returns the lifetime totals of every requested user whose stats changed since the given cursor. @@ -1478,6 +1627,52 @@ export const integrationsGetControlStatChanges = ( + options?: Options +): RequestResult< + DeviceGetLiveControlGatewayV2Responses, + DeviceGetLiveControlGatewayV2Errors, + ThrowOnError, + 'data' +> => + (options?.client ?? client).get< + DeviceGetLiveControlGatewayV2Responses, + DeviceGetLiveControlGatewayV2Errors, + ThrowOnError, + 'data' + >({ + responseStyle: 'data', + url: '/2/device/assignLCG', + ...options, + }); + +/** + * Gets information about the authenticated device. + */ +export const deviceGetSelf = ( + options?: Options +): RequestResult => + (options?.client ?? client).get({ + responseStyle: 'data', + url: '/1/device/self', + ...options, + }); + +/** + * Pair a device with a pair code. + */ +export const devicePair = ( + options: Options +): RequestResult => + (options.client ?? client).get({ + responseStyle: 'data', + url: '/1/device/pair/{pairCode}', + ...options, + }); + /** * Gets the OTA update history for a device */ @@ -1666,52 +1861,6 @@ export const devicesGetShockers = ( ...options, }); -/** - * Gets the best suited LCG node for the client - */ -export const deviceGetLiveControlGatewayV2 = ( - options?: Options -): RequestResult< - DeviceGetLiveControlGatewayV2Responses, - DeviceGetLiveControlGatewayV2Errors, - ThrowOnError, - 'data' -> => - (options?.client ?? client).get< - DeviceGetLiveControlGatewayV2Responses, - DeviceGetLiveControlGatewayV2Errors, - ThrowOnError, - 'data' - >({ - responseStyle: 'data', - url: '/2/device/assignLCG', - ...options, - }); - -/** - * Gets information about the authenticated device. - */ -export const deviceGetSelf = ( - options?: Options -): RequestResult => - (options?.client ?? client).get({ - responseStyle: 'data', - url: '/1/device/self', - ...options, - }); - -/** - * Pair a device with a pair code. - */ -export const devicePair = ( - options: Options -): RequestResult => - (options.client ?? client).get({ - responseStyle: 'data', - url: '/1/device/pair/{pairCode}', - ...options, - }); - /** * Lists all automation tokens */ @@ -2965,3 +3114,46 @@ export const authenticatedAccountListOAuthConnections = ( + options?: Options +): RequestResult => + (options?.client ?? client).get< + AuthenticatedAccountGetProfileResponses, + unknown, + ThrowOnError, + 'data' + >({ + responseStyle: 'data', + url: '/1/account/profile', + ...options, + }); + +/** + * Update the current user's profile settings + */ +export const authenticatedAccountUpdateProfile = ( + options: Options +): RequestResult< + AuthenticatedAccountUpdateProfileResponses, + AuthenticatedAccountUpdateProfileErrors, + ThrowOnError, + 'data' +> => + (options.client ?? client).put< + AuthenticatedAccountUpdateProfileResponses, + AuthenticatedAccountUpdateProfileErrors, + ThrowOnError, + 'data' + >({ + responseStyle: 'data', + url: '/1/account/profile', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers, + }, + }); diff --git a/src/lib/api/internal/generated/transformers.gen.ts b/src/lib/api/internal/generated/transformers.gen.ts index 3ccc9ba6..fcb7927e 100644 --- a/src/lib/api/internal/generated/transformers.gen.ts +++ b/src/lib/api/internal/generated/transformers.gen.ts @@ -26,10 +26,14 @@ import type { DevicesOtaGetOtaUpdateHistoryResponse, IntegrationsGetControlStatChangesResponse, PublicGetOnlineDevicesStatisticsResponse, + PublicGetPublicShareBySlugResponse, PublicGetPublicShareResponse, + PublicUnlockPublicShareResponse, SessionsGetSelfSessionResponse, SessionsListSessionsResponse, + ShareLinksEditPublicShareResponse, ShareLinksListResponse, + ShareLinksSetPublicSharePasswordResponse, ShockerGetAllShockerLogsResponse, ShockerGetShockerByIdResponse, ShockerGetShockerLogsResponse, @@ -353,6 +357,20 @@ export const shareLinksListResponseTransformer = async ( return data; }; +export const shareLinksEditPublicShareResponseTransformer = async ( + data: any +): Promise => { + data = ownPublicShareResponseSchemaResponseTransformer(data); + return data; +}; + +export const shareLinksSetPublicSharePasswordResponseTransformer = async ( + data: any +): Promise => { + data = ownPublicShareResponseSchemaResponseTransformer(data); + return data; +}; + const loginSessionResponseSchemaResponseTransformer = (data: any) => { data.created = Temporal.Instant.from(data.created); data.expires = Temporal.Instant.from(data.expires); @@ -413,6 +431,25 @@ export const publicGetPublicShareResponseTransformer = async ( return data; }; +export const publicGetPublicShareBySlugResponseTransformer = async ( + data: any +): Promise => { + data = legacyDataResponseOfPublicShareResponseSchemaResponseTransformer(data); + return data; +}; + +const publicShareUnlockResponseSchemaResponseTransformer = (data: any) => { + data.expiresOn = Temporal.Instant.from(data.expiresOn); + return data; +}; + +export const publicUnlockPublicShareResponseTransformer = async ( + data: any +): Promise => { + data = publicShareUnlockResponseSchemaResponseTransformer(data); + return data; +}; + const userControlStatTotalsSchemaResponseTransformer = (data: any) => { data.received = data.received.map((item: any) => controlStatTotalsSchemaResponseTransformer(item) diff --git a/src/lib/api/internal/generated/types.gen.ts b/src/lib/api/internal/generated/types.gen.ts index a813583d..a7e7a4c8 100644 --- a/src/lib/api/internal/generated/types.gen.ts +++ b/src/lib/api/internal/generated/types.gen.ts @@ -84,6 +84,28 @@ export type AdminOnlineGatewayResponse = { connectedHubs: number; }; +export type AdminUsersView = { + id: string; + name: string; + email: string; + passwordHashType: null | PasswordHashingAlgorithm; + roles: Array; + createdAt: Temporal.Instant; + activatedAt: null | Temporal.Instant; + createdByAutomationTokenId: null | string; + deactivatedAt: null | Temporal.Instant; + deactivatedByUserId: null | string; + apiTokenCount: number; + passwordResetCount: number; + shockerUserShareCount: number; + shockerPublicShareCount: number; + emailChangeRequestCount: number; + nameChangeRequestCount: number; + deviceCount: number; + shockerCount: number; + shockerControlLogCount: number; +}; + export type AdminUserView = { id: string; name: string; @@ -166,28 +188,6 @@ export type AdminUserViewUserRef = { name: string; }; -export type AdminUsersView = { - id: string; - name: string; - email: string; - passwordHashType: null | PasswordHashingAlgorithm; - roles: Array; - createdAt: Temporal.Instant; - activatedAt: null | Temporal.Instant; - createdByAutomationTokenId: null | string; - deactivatedAt: null | Temporal.Instant; - deactivatedByUserId: null | string; - apiTokenCount: number; - passwordResetCount: number; - shockerUserShareCount: number; - shockerPublicShareCount: number; - emailChangeRequestCount: number; - nameChangeRequestCount: number; - deviceCount: number; - shockerCount: number; - shockerControlLogCount: number; -}; - export const AuditAction = { Login: 'Login', Logout: 'Logout', @@ -337,17 +337,17 @@ export type AuditMetadataAutomationTokenUsedMetadata = { flow: string; }; -export type AuditMetadataEmailChangeRequestedMetadata = { - t?: 'emailChangeRequested'; - newEmail: string; -}; - export type AuditMetadataEmailChangedMetadata = { t?: 'emailChanged'; old: string; new: string; }; +export type AuditMetadataEmailChangeRequestedMetadata = { + t?: 'emailChangeRequested'; + newEmail: string; +}; + export type AuditMetadataLoginMetadata = { t?: 'login'; sessionId: string; @@ -577,6 +577,17 @@ export type ControlStatChangesResponse = { users: Array; }; +export type ControlStatsResponse = { + /** + * Activity on shockers you own. + */ + received: ReceivedControlStats; + /** + * Activity you sent to shockers, your own included. + */ + given: GivenControlStats; +}; + /** * Aggregated activity of one control type, split by whether it was live control. */ @@ -595,17 +606,6 @@ export type ControlStatTotals = { maxIntensity: number; }; -export type ControlStatsResponse = { - /** - * Activity on shockers you own. - */ - received: ReceivedControlStats; - /** - * Activity you sent to shockers, your own included. - */ - given: GivenControlStats; -}; - export const ControlType = { Stop: 'Stop', Shock: 'Shock', @@ -626,6 +626,17 @@ export type CreateAutomationTokenDto = { autoCleanupAfter?: null | string; }; +export type CreatedAutomationTokenDto = { + id: string; + name: string; + secret: string; + types: Array; + createdAt: Temporal.Instant; + lastRotatedAt?: null | Temporal.Instant; + autoCleanupUsers?: boolean; + autoCleanupAfter?: null | string; +}; + export type CreateShareRequest = { shockers: Array; user?: null | string; @@ -641,17 +652,6 @@ export type CreateTokenRequestV2 = { shockerControl: ShockerControlSettings; }; -export type CreatedAutomationTokenDto = { - id: string; - name: string; - secret: string; - types: Array; - createdAt: Temporal.Instant; - lastRotatedAt?: null | Temporal.Instant; - autoCleanupUsers?: boolean; - autoCleanupAfter?: null | string; -}; - export type DailyControlStats = { /** * Day in the requested time zone. @@ -876,14 +876,14 @@ export type LegacyDataResponseOfArrayOfLogEntry = { data: Array; }; -export type LegacyDataResponseOfArrayOfOwnPublicShareResponse = { +export type LegacyDataResponseOfArrayOfOwnerShockerResponse = { message: string; - data: Array; + data: Array; }; -export type LegacyDataResponseOfArrayOfOwnerShockerResponse = { +export type LegacyDataResponseOfArrayOfOwnPublicShareResponse = { message: string; - data: Array; + data: Array; }; export type LegacyDataResponseOfArrayOfShareCodeInfo = { @@ -906,6 +906,11 @@ export type LegacyDataResponseOfBackendInfoResponse = { data: BackendInfoResponse; }; +export type LegacyDataResponseOfboolean = { + message: string; + data: boolean; +}; + export type LegacyDataResponseOfDeviceSelfResponse = { message: string; data: DeviceSelfResponse; @@ -968,11 +973,6 @@ export type LegacyDataResponseOfStatsResponse = { data: StatsResponse; }; -export type LegacyDataResponseOfboolean = { - message: string; - data: boolean; -}; - export type LegacyDataResponseOfstring = { message: string; data: string; @@ -1115,18 +1115,28 @@ export const OtaUpdateStatus = { export type OtaUpdateStatus = (typeof OtaUpdateStatus)[keyof typeof OtaUpdateStatus]; +export type OwnerShockerResponse = { + id: string; + name: string; + image: string; + devices: Array; +}; + export type OwnPublicShareResponse = { id: string; name: string; + slug: null | string; createdOn: Temporal.Instant; expiresOn?: null | Temporal.Instant; + hasPassword: boolean; }; -export type OwnerShockerResponse = { - id: string; - name: string; - image: string; - devices: Array; +export type OwnUserProfileResponse = { + isPublic: boolean; + pronouns: null | string; + bio: null | string; + socials: Array; + defaultPublicShareId: null | string; }; /** @@ -1258,9 +1268,24 @@ export type ProblemDetails = { instance?: null | string; }; +export type PublicShareAuthor = { + id: string; + name: string; + image: string; + profile: null | PublicUserProfileDetails; +}; + export type PublicShareCreate = { name: string; expiresOn?: null | Temporal.Instant; + /** + * Custom URL segment, reachable at /u/{username}/{slug}. Unique per owner. + */ + slug?: null | string; + /** + * Optional password visitors must enter before they can see or control the shockers. + */ + password?: null | string; }; export type PublicShareDevice = { @@ -1269,18 +1294,43 @@ export type PublicShareDevice = { shockers: Array; }; +/** + * Replaces all editable fields of a public share, null clears the expiry or slug. + */ +export type PublicShareEdit = { + name: string; + expiresOn: null | Temporal.Instant; + slug: null | string; +}; + export type PublicShareEditShocker = { permissions: ShockerPermissions; limits: ShockerLimits; cooldown?: null | number; }; +export type PublicSharePasswordSet = { + /** + * The new password, or null to remove it. Setting or changing it disconnects everyone currently using the share. + */ + password: null | string; +}; + export type PublicShareResponse = { id: string; name: string; + slug: null | string; createdOn: Temporal.Instant; expiresOn?: null | Temporal.Instant; - author: BasicUserInfo; + author: PublicShareAuthor; + /** + * Visitors have to enter a password before they can see or control the shockers. + */ + passwordProtected: boolean; + /** + * The share is password protected and this request did not unlock it: IList<PublicShareDevice> PublicShareResponse.Devices is empty. + */ + passwordRequired: boolean; devices?: Array; }; @@ -1304,6 +1354,38 @@ export type PublicShareShocker = { paused: number; }; +export type PublicShareUnlock = { + password: string; +}; + +export type PublicShareUnlockResponse = { + /** + * Send it in the OpenShockPublicShareUnlock header when loading the share, and as the unlockToken query + * parameter when connecting to its hub. Invalid once the password is changed. + */ + token: string; + expiresOn: Temporal.Instant; +}; + +export type PublicUserProfileDetails = { + pronouns: null | string; + bio: null | string; + socials: Array; +}; + +export type PublicUserProfilePublicShare = { + id: string; + name: string; + slug: null | string; + passwordProtected: boolean; +}; + +export type PublicUserProfileResponse = { + user: BasicUserInfo; + profile: PublicUserProfileDetails; + defaultPublicShare: null | PublicUserProfilePublicShare; +}; + export type ReceivedControlStats = { totals: Array; shockers: Array; @@ -1372,6 +1454,20 @@ export type ShareCodeInfo = { createdOn: Temporal.Instant; }; +export type SharedDevice = { + id: string; + name: string; + shockers: Array; +}; + +export type SharedShocker = { + id: string; + name: string; + isPaused: boolean; + permissions: ShockerPermissions; + limits: ShockerLimits; +}; + export type ShareInfo = { sharedWith: BasicUserInfo; createdOn: Temporal.Instant; @@ -1388,20 +1484,6 @@ export type ShareInviteBaseDetails = { sharedWith: null | BasicUserInfo; }; -export type SharedDevice = { - id: string; - name: string; - shockers: Array; -}; - -export type SharedShocker = { - id: string; - name: string; - isPaused: boolean; - permissions: ShockerPermissions; - limits: ShockerLimits; -}; - /** * Per-token shocker control configuration: a toggle plus min/max limits for intensity and duration. */ @@ -1425,6 +1507,9 @@ export type ShockerControlStats = { export type ShockerLimits = { intensity: null | number; + /** + * Maximum duration in milliseconds. Does not apply to live control, which has no fixed duration. + */ duration: null | number; }; @@ -1437,6 +1522,13 @@ export const ShockerModelType = { export type ShockerModelType = (typeof ShockerModelType)[keyof typeof ShockerModelType]; +export type ShockerPermissions = { + vibrate: boolean; + sound: boolean; + shock: boolean; + live?: boolean; +}; + export type ShockerPermLimitPair = { permissions: ShockerPermissions; limits: ShockerLimits; @@ -1455,13 +1547,6 @@ export type ShockerPermLimitPairWithIdAndName = { limits: ShockerLimits; }; -export type ShockerPermissions = { - vibrate: boolean; - sound: boolean; - shock: boolean; - live?: boolean; -}; - export type ShockerResponse = { name: string; isPaused: boolean; @@ -1492,6 +1577,25 @@ export type SignUpV2 = { turnstileResponse: string; }; +export const SocialPlatform = { + Website: 'Website', + Discord: 'Discord', + X: 'X', + Bluesky: 'Bluesky', + Mastodon: 'Mastodon', + Twitch: 'Twitch', + YouTube: 'YouTube', + Kick: 'Kick', + Reddit: 'Reddit', + Instagram: 'Instagram', + TikTok: 'TikTok', + GitHub: 'GitHub', + Telegram: 'Telegram', + FetLife: 'FetLife', +} as const; + +export type SocialPlatform = (typeof SocialPlatform)[keyof typeof SocialPlatform]; + /** * Sort direction for list endpoints. */ @@ -1534,6 +1638,15 @@ export type TokenResponseV2 = { shockerControl: ShockerControlSettings; }; +export type UserControlStats = { + /** + * Null for guests (public shares). + */ + userId: null | string; + user: null | BasicUserInfo; + stats: Array; +}; + /** * Lifetime totals of one user, the same views as ControlStatsResponse without breakdowns. */ @@ -1549,14 +1662,13 @@ export type UserControlStatTotals = { given: Array; }; -export type UserControlStats = { - /** - * Null for guests (public shares). - */ - userId: null | string; - user: null | BasicUserInfo; - stats: Array; -}; +export const UsernameAvailability = { + Available: 'Available', + Taken: 'Taken', + Invalid: 'Invalid', +} as const; + +export type UsernameAvailability = (typeof UsernameAvailability)[keyof typeof UsernameAvailability]; export type UserNameBlacklistDto = { id: string; @@ -1565,11 +1677,51 @@ export type UserNameBlacklistDto = { createdAt: Temporal.Instant; }; +export type UsernameCheckResponse = { + availability: UsernameAvailability; + error?: null | UsernameError; +}; + +export type UsernameError = { + message: string; + type: UsernameErrorType; +}; + +export const UsernameErrorType = { + TooShort: 'TooShort', + TooLong: 'TooLong', + StartOrEndWithWhitespace: 'StartOrEndWithWhitespace', + ResembleEmail: 'ResembleEmail', + ObnoxiousCharacters: 'ObnoxiousCharacters', + Blacklisted: 'Blacklisted', +} as const; + +export type UsernameErrorType = (typeof UsernameErrorType)[keyof typeof UsernameErrorType]; + export type UserPatchDto = { name?: null | string; email?: null | string; }; +export type UserProfileSocial = { + platform: SocialPlatform; + /** + * An absolute http(s) URL for SocialPlatform.Website, otherwise the handle on that platform. + */ + value: string; +}; + +export type UserProfileUpdate = { + isPublic: boolean; + pronouns?: null | string; + bio?: null | string; + socials?: Array; + /** + * Public share shown on the profile page, must be one of your own unexpired public shares. + */ + defaultPublicShareId?: null | string; +}; + export type UserSelfResponse = { id: string; name: string; @@ -1600,35 +1752,6 @@ export type UserShareInfo = { paused: number; }; -export const UsernameAvailability = { - Available: 'Available', - Taken: 'Taken', - Invalid: 'Invalid', -} as const; - -export type UsernameAvailability = (typeof UsernameAvailability)[keyof typeof UsernameAvailability]; - -export type UsernameCheckResponse = { - availability: UsernameAvailability; - error?: null | UsernameError; -}; - -export type UsernameError = { - message: string; - type: UsernameErrorType; -}; - -export const UsernameErrorType = { - TooShort: 'TooShort', - TooLong: 'TooLong', - StartOrEndWithWhitespace: 'StartOrEndWithWhitespace', - ResembleEmail: 'ResembleEmail', - ObnoxiousCharacters: 'ObnoxiousCharacters', - Blacklisted: 'Blacklisted', -} as const; - -export type UsernameErrorType = (typeof UsernameErrorType)[keyof typeof UsernameErrorType]; - export type V2UserShares = { outgoing: Array; incoming: Array; @@ -2845,6 +2968,10 @@ export type ShareLinksCreatePublicShareData = { }; export type ShareLinksCreatePublicShareErrors = { + /** + * Bad Request + */ + 400: OpenShockProblem; /** * You have reached the maximum number of public shares */ @@ -2893,6 +3020,43 @@ export type ShareLinksDeletePublicShareResponses = { export type ShareLinksDeletePublicShareResponse = ShareLinksDeletePublicShareResponses[keyof ShareLinksDeletePublicShareResponses]; +export type ShareLinksEditPublicShareData = { + body: PublicShareEdit; + path: { + publicShareId: string; + }; + query?: never; + url: '/1/shares/links/{publicShareId}'; +}; + +export type ShareLinksEditPublicShareErrors = { + /** + * Expiry date in the past or invalid slug + */ + 400: OpenShockProblem; + /** + * Public share not found or does not belong to you + */ + 404: OpenShockProblem; + /** + * Slug is already used by another of your public shares + */ + 409: OpenShockProblem; +}; + +export type ShareLinksEditPublicShareError = + ShareLinksEditPublicShareErrors[keyof ShareLinksEditPublicShareErrors]; + +export type ShareLinksEditPublicShareResponses = { + /** + * The updated public share + */ + 200: OwnPublicShareResponse; +}; + +export type ShareLinksEditPublicShareResponse = + ShareLinksEditPublicShareResponses[keyof ShareLinksEditPublicShareResponses]; + export type ShareLinksPauseShockerData = { body: PauseRequest; path: { @@ -2927,6 +3091,35 @@ export type ShareLinksPauseShockerResponses = { export type ShareLinksPauseShockerResponse = ShareLinksPauseShockerResponses[keyof ShareLinksPauseShockerResponses]; +export type ShareLinksSetPublicSharePasswordData = { + body: PublicSharePasswordSet; + path: { + publicShareId: string; + }; + query?: never; + url: '/1/shares/links/{publicShareId}/password'; +}; + +export type ShareLinksSetPublicSharePasswordErrors = { + /** + * Public share not found or does not belong to you + */ + 404: OpenShockProblem; +}; + +export type ShareLinksSetPublicSharePasswordError = + ShareLinksSetPublicSharePasswordErrors[keyof ShareLinksSetPublicSharePasswordErrors]; + +export type ShareLinksSetPublicSharePasswordResponses = { + /** + * The updated public share + */ + 200: OwnPublicShareResponse; +}; + +export type ShareLinksSetPublicSharePasswordResponse = + ShareLinksSetPublicSharePasswordResponses[keyof ShareLinksSetPublicSharePasswordResponses]; + export type SessionsDeleteSessionData = { body?: never; path: { @@ -3004,8 +3197,43 @@ export type PublicGetOnlineDevicesStatisticsResponses = { export type PublicGetOnlineDevicesStatisticsResponse = PublicGetOnlineDevicesStatisticsResponses[keyof PublicGetOnlineDevicesStatisticsResponses]; +export type PublicGetUserProfileData = { + body?: never; + path: { + username: string; + }; + query?: never; + url: '/1/public/users/{username}'; +}; + +export type PublicGetUserProfileErrors = { + /** + * The user does not exist or their profile is not public. + */ + 404: OpenShockProblem; +}; + +export type PublicGetUserProfileError = + PublicGetUserProfileErrors[keyof PublicGetUserProfileErrors]; + +export type PublicGetUserProfileResponses = { + /** + * The profile was successfully retrieved. + */ + 200: PublicUserProfileResponse; +}; + +export type PublicGetUserProfileResponse = + PublicGetUserProfileResponses[keyof PublicGetUserProfileResponses]; + export type PublicGetPublicShareData = { body?: never; + headers?: { + /** + * The token from unlocking a password-protected share. + */ + OpenShockPublicShareUnlock?: string; + }; path: { publicShareId: string; }; @@ -3033,6 +3261,83 @@ export type PublicGetPublicShareResponses = { export type PublicGetPublicShareResponse = PublicGetPublicShareResponses[keyof PublicGetPublicShareResponses]; +export type PublicGetPublicShareBySlugData = { + body?: never; + headers?: { + /** + * The token from unlocking a password-protected share. + */ + OpenShockPublicShareUnlock?: string; + }; + path: { + username: string; + slug: string; + }; + query?: never; + url: '/1/public/shares/links/by-slug/{username}/{slug}'; +}; + +export type PublicGetPublicShareBySlugErrors = { + /** + * The public share does not exist. + */ + 404: OpenShockProblem; +}; + +export type PublicGetPublicShareBySlugError = + PublicGetPublicShareBySlugErrors[keyof PublicGetPublicShareBySlugErrors]; + +export type PublicGetPublicShareBySlugResponses = { + /** + * The public share information was successfully retrieved. + */ + 200: LegacyDataResponseOfPublicShareResponse; +}; + +export type PublicGetPublicShareBySlugResponse = + PublicGetPublicShareBySlugResponses[keyof PublicGetPublicShareBySlugResponses]; + +export type PublicUnlockPublicShareData = { + body: PublicShareUnlock; + path: { + publicShareId: string; + }; + query?: never; + url: '/1/public/shares/links/{publicShareId}/unlock'; +}; + +export type PublicUnlockPublicShareErrors = { + /** + * The public share has no password. + */ + 400: OpenShockProblem; + /** + * The password was incorrect. + */ + 401: OpenShockProblem; + /** + * The public share does not exist. + */ + 404: OpenShockProblem; + /** + * Too many incorrect passwords were entered for this public share. + */ + 429: OpenShockProblem; +}; + +export type PublicUnlockPublicShareError = + PublicUnlockPublicShareErrors[keyof PublicUnlockPublicShareErrors]; + +export type PublicUnlockPublicShareResponses = { + /** + * The password was correct. + */ + 200: PublicShareUnlockResponse; +}; + +export type PublicUnlockPublicShareResponse = + PublicUnlockPublicShareResponses[keyof PublicUnlockPublicShareResponses]; + export type IntegrationsGetControlStatChangesData = { body: ControlStatChangesRequest; path?: never; @@ -3060,6 +3365,85 @@ export type IntegrationsGetControlStatChangesResponses = { export type IntegrationsGetControlStatChangesResponse = IntegrationsGetControlStatChangesResponses[keyof IntegrationsGetControlStatChangesResponses]; +export type DeviceGetLiveControlGatewayV2Data = { + body?: never; + path?: never; + query?: { + version?: number; + }; + url: '/2/device/assignLCG'; +}; + +export type DeviceGetLiveControlGatewayV2Errors = { + /** + * Bad Request + */ + 400: OpenShockProblem; + /** + * Unable to find suitable LCG node + */ + 503: OpenShockProblem; +}; + +export type DeviceGetLiveControlGatewayV2Error = + DeviceGetLiveControlGatewayV2Errors[keyof DeviceGetLiveControlGatewayV2Errors]; + +export type DeviceGetLiveControlGatewayV2Responses = { + /** + * Successfully assigned LCG node + */ + 200: LcgNodeResponseV2; +}; + +export type DeviceGetLiveControlGatewayV2Response = + DeviceGetLiveControlGatewayV2Responses[keyof DeviceGetLiveControlGatewayV2Responses]; + +export type DeviceGetSelfData = { + body?: never; + path?: never; + query?: never; + url: '/1/device/self'; +}; + +export type DeviceGetSelfResponses = { + /** + * The device information was successfully retrieved. + */ + 200: LegacyDataResponseOfDeviceSelfResponse; +}; + +export type DeviceGetSelfResponse = DeviceGetSelfResponses[keyof DeviceGetSelfResponses]; + +export type DevicePairData = { + body?: never; + path: { + /** + * The pair code to pair with. + */ + pairCode: string; + }; + query?: never; + url: '/1/device/pair/{pairCode}'; +}; + +export type DevicePairErrors = { + /** + * No such pair code exists + */ + 404: OpenShockProblem; +}; + +export type DevicePairError = DevicePairErrors[keyof DevicePairErrors]; + +export type DevicePairResponses = { + /** + * Successfully assigned LCG node + */ + 200: LegacyDataResponseOfstring; +}; + +export type DevicePairResponse = DevicePairResponses[keyof DevicePairResponses]; + export type DevicesOtaGetOtaUpdateHistoryData = { body?: never; path: { @@ -3332,85 +3716,6 @@ export type DevicesGetShockersResponses = { export type DevicesGetShockersResponse = DevicesGetShockersResponses[keyof DevicesGetShockersResponses]; -export type DeviceGetLiveControlGatewayV2Data = { - body?: never; - path?: never; - query?: { - version?: number; - }; - url: '/2/device/assignLCG'; -}; - -export type DeviceGetLiveControlGatewayV2Errors = { - /** - * Bad Request - */ - 400: OpenShockProblem; - /** - * Unable to find suitable LCG node - */ - 503: OpenShockProblem; -}; - -export type DeviceGetLiveControlGatewayV2Error = - DeviceGetLiveControlGatewayV2Errors[keyof DeviceGetLiveControlGatewayV2Errors]; - -export type DeviceGetLiveControlGatewayV2Responses = { - /** - * Successfully assigned LCG node - */ - 200: LcgNodeResponseV2; -}; - -export type DeviceGetLiveControlGatewayV2Response = - DeviceGetLiveControlGatewayV2Responses[keyof DeviceGetLiveControlGatewayV2Responses]; - -export type DeviceGetSelfData = { - body?: never; - path?: never; - query?: never; - url: '/1/device/self'; -}; - -export type DeviceGetSelfResponses = { - /** - * The device information was successfully retrieved. - */ - 200: LegacyDataResponseOfDeviceSelfResponse; -}; - -export type DeviceGetSelfResponse = DeviceGetSelfResponses[keyof DeviceGetSelfResponses]; - -export type DevicePairData = { - body?: never; - path: { - /** - * The pair code to pair with. - */ - pairCode: string; - }; - query?: never; - url: '/1/device/pair/{pairCode}'; -}; - -export type DevicePairErrors = { - /** - * No such pair code exists - */ - 404: OpenShockProblem; -}; - -export type DevicePairError = DevicePairErrors[keyof DevicePairErrors]; - -export type DevicePairResponses = { - /** - * Successfully assigned LCG node - */ - 200: LegacyDataResponseOfstring; -}; - -export type DevicePairResponse = DevicePairResponses[keyof DevicePairResponses]; - export type AdminListAutomationTokensData = { body?: never; path?: never; @@ -5033,3 +5338,47 @@ export type AuthenticatedAccountListOAuthConnectionsResponses = { export type AuthenticatedAccountListOAuthConnectionsResponse = AuthenticatedAccountListOAuthConnectionsResponses[keyof AuthenticatedAccountListOAuthConnectionsResponses]; + +export type AuthenticatedAccountGetProfileData = { + body?: never; + path?: never; + query?: never; + url: '/1/account/profile'; +}; + +export type AuthenticatedAccountGetProfileResponses = { + /** + * The profile settings, defaults when the profile was never set up + */ + 200: OwnUserProfileResponse; +}; + +export type AuthenticatedAccountGetProfileResponse = + AuthenticatedAccountGetProfileResponses[keyof AuthenticatedAccountGetProfileResponses]; + +export type AuthenticatedAccountUpdateProfileData = { + body: UserProfileUpdate; + path?: never; + query?: never; + url: '/1/account/profile'; +}; + +export type AuthenticatedAccountUpdateProfileErrors = { + /** + * Invalid social or default public share + */ + 400: OpenShockProblem; +}; + +export type AuthenticatedAccountUpdateProfileError = + AuthenticatedAccountUpdateProfileErrors[keyof AuthenticatedAccountUpdateProfileErrors]; + +export type AuthenticatedAccountUpdateProfileResponses = { + /** + * The updated profile settings + */ + 200: OwnUserProfileResponse; +}; + +export type AuthenticatedAccountUpdateProfileResponse = + AuthenticatedAccountUpdateProfileResponses[keyof AuthenticatedAccountUpdateProfileResponses]; diff --git a/src/lib/components/public-share/AuthorProfileCard.svelte b/src/lib/components/public-share/AuthorProfileCard.svelte new file mode 100644 index 00000000..f06b192e --- /dev/null +++ b/src/lib/components/public-share/AuthorProfileCard.svelte @@ -0,0 +1,84 @@ + + + + +
+ + + {user.name.charAt(0)} + +
+ {#if href} + + {user.name} + {:else} + {user.name} + {/if} + {#if pronouns} + {pronouns} + {/if} +
+
+ + {#if bio} +

{bio}

+ {/if} + + {#if socials.length > 0} +
    + {#each socials as social, i (i)} + {@const url = socialUrl(social)} + {@const display = socialDisplayValue(social)} +
  • + {#if url} + + + {socialPlatformLabel(social.platform)} + {display} + + + + {:else} + + {/if} +
  • + {/each} +
+ {/if} +
+
diff --git a/src/routes/shares/public/[shareId=guid]/ControlView.svelte b/src/lib/components/public-share/ControlView.svelte similarity index 77% rename from src/routes/shares/public/[shareId=guid]/ControlView.svelte rename to src/lib/components/public-share/ControlView.svelte index 453af704..725ac980 100644 --- a/src/routes/shares/public/[shareId=guid]/ControlView.svelte +++ b/src/lib/components/public-share/ControlView.svelte @@ -18,9 +18,8 @@ registerHubShockers, } from '#lib/state/live-control-state.svelte.js'; import { onMount, untrack } from 'svelte'; - import { page } from '$app/state'; import ShareLinkInput from '#lib/components/ShareLinkInput.svelte'; - import { encodeShortGuid } from '#lib/utils/short-guid.js'; + import { profilePath, publicSharePath } from '#lib/utils/public-share.js'; import { Button } from '@openshock/svelte-core/components/ui/button'; import { Pencil } from '@lucide/svelte'; import { userState } from '#lib/state/user-state.svelte.js'; @@ -29,11 +28,15 @@ interface Props { shareLinkRoot: PublicShareResponse; guestName: string | null; + unlockToken?: string | null; + onConnectionLost?: () => void; } - const { shareLinkRoot, guestName }: Props = $props(); + const { shareLinkRoot, guestName, unlockToken = null, onConnectionLost }: Props = $props(); - const shareLinkSignalr = untrack(() => new ShareLinkSignalr(shareLinkRoot.id, guestName)); + const shareLinkSignalr = untrack( + () => new ShareLinkSignalr(shareLinkRoot.id, guestName, unlockToken, onConnectionLost) + ); onMount(() => { shareLinkSignalr.initializeSignalR(); @@ -56,9 +59,10 @@ }); } - const shareId = $derived(page.params.shareId); - - let editUrl = $derived(resolve(`shares/public/${shareId}/edit`)); + let editUrl = $derived(resolve(`shares/public/${shareLinkRoot.id}/edit`)); + let profileUrl = $derived( + shareLinkRoot.author.profile ? resolve(profilePath(shareLinkRoot.author.name)) : undefined + ); // Flatten devices+shockers while keeping the deviceId const flatShockers = $derived( @@ -91,7 +95,9 @@
-

Public Share: {shareLinkRoot.name}

+

+ {m.public_share_edit_title({ name: shareLinkRoot.name })} +

- {#if shareId} - - {/if} +
@@ -114,8 +118,13 @@ - @@ -123,8 +132,15 @@ {shareLinkRoot.author.name.charAt(0)} -

{shareLinkRoot.author.name}

-
+ + {shareLinkRoot.author.name} + {#if shareLinkRoot.author.profile?.pronouns} + + {shareLinkRoot.author.profile.pronouns} + + {/if} + +

{m.common_shared_by()}

diff --git a/src/lib/components/public-share/PublicShareView.svelte b/src/lib/components/public-share/PublicShareView.svelte new file mode 100644 index 00000000..07448057 --- /dev/null +++ b/src/lib/components/public-share/PublicShareView.svelte @@ -0,0 +1,186 @@ + + +{#if checkingStoredToken} + +{:else if entered} + +{:else} +
+ {#if showAuthorProfile && current.author.profile} + + {/if} + + +

{current.name}

+ + {current.passwordRequired ? m.public_share_password_desc() : m.public_share_view_desc()} + +
+ + {#if current.passwordRequired} + {#if accessLost} +

+ {m.public_share_password_changed()} +

+ {/if} +
+ + {#if passwordError} +

{passwordError}

+ {/if} + +
+ {:else if enterAsGuestClicked} + + + + + + + {:else} + + + + {/if} +
+
+
+{/if} diff --git a/src/lib/components/public-share/SlugInput.svelte b/src/lib/components/public-share/SlugInput.svelte new file mode 100644 index 00000000..8640c547 --- /dev/null +++ b/src/lib/components/public-share/SlugInput.svelte @@ -0,0 +1,43 @@ + + + diff --git a/src/lib/errorhandling/problemMessages.ts b/src/lib/errorhandling/problemMessages.ts index 63103ee3..46926bbb 100644 --- a/src/lib/errorhandling/problemMessages.ts +++ b/src/lib/errorhandling/problemMessages.ts @@ -66,6 +66,9 @@ export const ProblemMessages: { description: m.problem_account_username_recently_changed_desc, }, 'Account.Username.Taken': { title: m.problem_account_username_taken_title }, + 'Admin.EmailProviderBlacklist.InvalidDomains': { + title: m.problem_admin_email_provider_blacklist_invalid_domains_title, + }, 'Admin.User.Deactivated': { title: m.problem_admin_user_deactivated_title }, 'Admin.User.NotActivated': { title: m.problem_admin_user_not_activated_title }, 'ApiToken.CanOnlyDeleteSelf': { title: m.problem_api_token_can_only_delete_self_title }, @@ -172,6 +175,10 @@ export const ProblemMessages: { description: m.problem_share_request_create_shocker_not_found_desc, }, 'Share.Request.NotFound': { title: m.problem_share_request_not_found_title }, + 'Share.ShockerShareLimitReached': { + title: m.problem_share_shocker_share_limit_reached_title, + description: m.problem_share_shocker_share_limit_reached_desc, + }, 'Share.User.NotFound': { title: m.problem_share_user_not_found_title }, 'ShareCode.AlreadyLinked': { title: m.problem_share_code_already_linked_title }, 'ShareCode.CantLinkOwnShareCode': { title: m.problem_share_code_cant_link_own_share_code_title }, @@ -184,6 +191,21 @@ export const ProblemMessages: { 'ShareLink.ShockerNotInShareLink': { title: m.problem_share_link_shocker_not_in_share_link_title, }, + 'ShareLink.SlugInvalid': { + title: m.problem_share_link_slug_invalid_title, + description: m.problem_share_link_slug_invalid_desc, + }, + 'ShareLink.SlugTaken': { title: m.problem_share_link_slug_taken_title }, + 'ShareLink.TooManyShareLinks': { + title: m.problem_share_link_too_many_share_links_title, + description: m.problem_share_link_too_many_share_links_desc, + }, + 'ShareLink.NotPasswordProtected': { title: m.problem_share_link_not_password_protected_title }, + 'ShareLink.PasswordIncorrect': { title: m.problem_share_link_password_incorrect_title }, + 'ShareLink.TooManyPasswordAttempts': { + title: m.problem_share_link_too_many_password_attempts_title, + description: m.problem_share_link_too_many_password_attempts_desc, + }, 'Shocker.Control.NoPermission': { title: m.problem_shocker_control_no_permission_title }, 'Shocker.Control.NotFound': { title: m.problem_shocker_control_not_found_title }, 'Shocker.Control.Paused': { title: m.problem_shocker_control_paused_title }, @@ -196,6 +218,15 @@ export const ProblemMessages: { }, 'User.NotFound': { title: m.problem_user_not_found_title }, 'User.Privileged.DeleteDenied': { title: m.problem_user_privileged_delete_denied_title }, + 'UserProfile.DefaultPublicShareNotFound': { + title: m.problem_user_profile_default_public_share_not_found_title, + description: m.problem_user_profile_default_public_share_not_found_desc, + }, + 'UserProfile.NotFound': { title: m.problem_user_profile_not_found_title }, + 'UserProfile.SocialInvalid': { + title: m.problem_user_profile_social_invalid_title, + description: m.problem_user_profile_social_invalid_desc, + }, 'Validation.Error': { title: m.problem_validation_error_title }, 'Webhook.NotFound': { title: m.problem_webhook_not_found_title }, 'Webhook.Unsupported': { diff --git a/src/lib/errorhandling/problemTypes.ts b/src/lib/errorhandling/problemTypes.ts index d7dcde6e..d6ba0ef4 100644 --- a/src/lib/errorhandling/problemTypes.ts +++ b/src/lib/errorhandling/problemTypes.ts @@ -60,6 +60,9 @@ export const ProblemTypes = { 'Account.Username.Taken': { title: 'That username is already taken' }, // Admin + 'Admin.EmailProviderBlacklist.InvalidDomains': { + title: 'One or more entries are not valid domains, nothing was added', + }, 'Admin.User.Deactivated': { title: 'This user is deactivated' }, 'Admin.User.NotActivated': { title: 'This user has not been activated yet' }, @@ -186,6 +189,10 @@ export const ProblemTypes = { description: 'They may have been removed or do not belong to you.', }, 'Share.Request.NotFound': { title: 'Share invite not found' }, + 'Share.ShockerShareLimitReached': { + title: 'Shocker has too many shares', + description: 'A shocker can be shared with at most 100 users.', + }, 'Share.User.NotFound': { title: 'Share not found' }, // Legacy share codes @@ -198,6 +205,23 @@ export const ProblemTypes = { 'ShareLink.NotFound': { title: 'Public share not found' }, 'ShareLink.ShockerAlreadyInShareLink': { title: 'Shocker is already in this public share' }, 'ShareLink.ShockerNotInShareLink': { title: 'Shocker is not in this public share' }, + 'ShareLink.SlugInvalid': { + title: 'Invalid custom URL', + description: + 'Use 2-32 lowercase letters, numbers and single hyphens, not starting or ending with a hyphen.', + }, + 'ShareLink.SlugTaken': { title: 'You already have a public share with this custom URL' }, + 'ShareLink.TooManyShareLinks': { + title: 'You have too many public shares', + description: 'You have reached the maximum of 500 public shares.', + }, + 'ShareLink.NotPasswordProtected': { title: 'This public share has no password' }, + 'ShareLink.PasswordIncorrect': { title: 'Incorrect password' }, + 'ShareLink.TooManyPasswordAttempts': { + title: 'Too many incorrect passwords', + description: + 'Too many incorrect passwords were entered for this public share. Try again in a few minutes.', + }, // Shockers 'Shocker.Control.NoPermission': { title: 'You do not have permission to control this shocker' }, @@ -217,6 +241,17 @@ export const ProblemTypes = { 'User.NotFound': { title: 'User not found' }, 'User.Privileged.DeleteDenied': { title: 'Privileged users cannot be deleted' }, + // User profiles + 'UserProfile.DefaultPublicShareNotFound': { + title: 'Default public share not found', + description: 'It may have expired or been deleted.', + }, + 'UserProfile.NotFound': { title: 'Profile not found' }, + 'UserProfile.SocialInvalid': { + title: 'Invalid social', + description: 'Websites need a full https:// URL, other socials just your username.', + }, + 'Validation.Error': { title: 'Some fields are invalid' }, // Admin webhooks diff --git a/src/lib/signalr/sharelink.svelte.ts b/src/lib/signalr/sharelink.svelte.ts index 22a68682..86945bfb 100644 --- a/src/lib/signalr/sharelink.svelte.ts +++ b/src/lib/signalr/sharelink.svelte.ts @@ -5,25 +5,45 @@ import { type HubConnection, HubConnectionState } from '@microsoft/signalr'; import { toast } from 'svelte-sonner'; import { BuildSignalrConnection } from './utils/connection-builder'; -function GetShareLinkURL(shareLinkId: string, customName: string | null) { +function GetShareLinkURL( + shareLinkId: string, + customName: string | null, + unlockToken: string | null +) { const url = getBackendURL(`1/hubs/share/link/${encodeURIComponent(shareLinkId)}`); if (customName !== null) { url.searchParams.set('name', customName || ''); } + if (unlockToken) { + url.searchParams.set('unlockToken', unlockToken); + } return url.href; } export class ShareLinkSignalr { readonly shareLinkId: string; readonly customName: string | null; + readonly unlockToken: string | null; + readonly onConnectionLost: (() => void) | undefined; #connection: HubConnection | null = null; private signalr_state = $state(HubConnectionState.Disconnected); - constructor(shareLinkId: string, customName: string | null) { + /** + * @param onConnectionLost Called when the server drops the connection, e.g. because the share's password + * was changed, so the page can check whether it still has access. + */ + constructor( + shareLinkId: string, + customName: string | null, + unlockToken: string | null = null, + onConnectionLost?: () => void + ) { this.shareLinkId = shareLinkId; this.customName = customName; + this.unlockToken = unlockToken; + this.onConnectionLost = onConnectionLost; } public async initializeSignalR() { @@ -33,14 +53,18 @@ export class ShareLinkSignalr { console.debug('Initializing Public Share SignalR connection...'); - const connection = BuildSignalrConnection(GetShareLinkURL(this.shareLinkId, this.customName)); + const connection = BuildSignalrConnection( + GetShareLinkURL(this.shareLinkId, this.customName, this.unlockToken) + ); connection.onclose(() => { this.signalr_state = HubConnectionState.Disconnected; + if (this.#connection === connection) this.onConnectionLost?.(); }); connection.onreconnecting(() => { this.signalr_state = HubConnectionState.Reconnecting; + if (this.#connection === connection) this.onConnectionLost?.(); }); connection.onreconnected(() => { @@ -79,15 +103,16 @@ export class ShareLinkSignalr { console.debug('Stopping Public Share SignalR connection...'); + // Cleared first so the close this causes is not reported as a lost connection + const connection = this.#connection; + this.#connection = null; + try { - if (this.#connection) { - await this.#connection.stop(); - } + await connection.stop(); } catch (error) { console.error(error); toast.error(m.signalr_disconnect_failed()); } finally { - this.#connection = null; this.signalr_state = HubConnectionState.Disconnected; } } diff --git a/src/lib/utils/public-share-unlock.test.ts b/src/lib/utils/public-share-unlock.test.ts new file mode 100644 index 00000000..0f7ac07e --- /dev/null +++ b/src/lib/utils/public-share-unlock.test.ts @@ -0,0 +1,37 @@ +import { beforeEach, describe, expect, it } from 'vitest'; +import { + clearUnlockToken, + getUnlockToken, + isValidSharePassword, + setUnlockToken, + unlockHeaders, +} from './public-share-unlock'; + +describe('unlock tokens', () => { + beforeEach(() => sessionStorage.clear()); + + it('stores tokens per share', () => { + setUnlockToken('a', 'token-a'); + expect(getUnlockToken('a')).toBe('token-a'); + expect(getUnlockToken('b')).toBeNull(); + + clearUnlockToken('a'); + expect(getUnlockToken('a')).toBeNull(); + }); + + it('only sends the header when there is a token', () => { + expect(unlockHeaders(null)).toBeUndefined(); + expect(unlockHeaders('t')).toEqual({ OpenShockPublicShareUnlock: 't' }); + }); +}); + +describe('isValidSharePassword', () => { + it.each([ + ['abc', false], + ['abcd', true], + ['a'.repeat(128), true], + ['a'.repeat(129), false], + ])('%s -> %s', (password, expected) => { + expect(isValidSharePassword(password)).toBe(expected); + }); +}); diff --git a/src/lib/utils/public-share-unlock.ts b/src/lib/utils/public-share-unlock.ts new file mode 100644 index 00000000..f4643a28 --- /dev/null +++ b/src/lib/utils/public-share-unlock.ts @@ -0,0 +1,42 @@ +// Mirrors ApiHardLimits.PublicSharePassword*Length +export const PUBLIC_SHARE_PASSWORD_MIN_LENGTH = 4; +export const PUBLIC_SHARE_PASSWORD_MAX_LENGTH = 128; + +const storageKey = (shareId: string) => `public-share-unlock:${shareId}`; + +/** The unlock token for a password-protected public share, kept for this browser tab. */ +export function getUnlockToken(shareId: string): string | null { + try { + return sessionStorage.getItem(storageKey(shareId)); + } catch { + return null; + } +} + +export function setUnlockToken(shareId: string, token: string) { + try { + sessionStorage.setItem(storageKey(shareId), token); + } catch { + // Storage unavailable (private mode): the visitor enters the password again on reload + } +} + +export function clearUnlockToken(shareId: string) { + try { + sessionStorage.removeItem(storageKey(shareId)); + } catch { + // Nothing stored + } +} + +/** Headers for loading a public share with its unlock token, if there is one. */ +export function unlockHeaders(token: string | null) { + return token ? { OpenShockPublicShareUnlock: token } : undefined; +} + +export function isValidSharePassword(password: string) { + return ( + password.length >= PUBLIC_SHARE_PASSWORD_MIN_LENGTH && + password.length <= PUBLIC_SHARE_PASSWORD_MAX_LENGTH + ); +} diff --git a/src/lib/utils/public-share.test.ts b/src/lib/utils/public-share.test.ts new file mode 100644 index 00000000..4a9dfdf7 --- /dev/null +++ b/src/lib/utils/public-share.test.ts @@ -0,0 +1,28 @@ +import { describe, expect, it } from 'vitest'; +import { profilePath, publicSharePath } from './public-share'; +import { encodeShortGuid } from './short-guid'; + +const id = '01936b2e-6f1c-7a3e-9b2d-4c5e6f708192'; + +describe('publicSharePath', () => { + it('uses the custom URL when there is a slug', () => { + expect(publicSharePath({ id, slug: 'fun', author: { name: 'Luc' } })).toBe('u/Luc/fun'); + }); + + it('prefers the explicit owner name', () => { + expect(publicSharePath({ id, slug: 'fun' }, 'some one')).toBe('u/some%20one/fun'); + }); + + it('falls back to the short link', () => { + expect(publicSharePath({ id, slug: null, author: { name: 'Luc' } })).toBe( + `s/${encodeShortGuid(id)}` + ); + expect(publicSharePath({ id, slug: 'fun' })).toBe(`s/${encodeShortGuid(id)}`); + }); +}); + +describe('profilePath', () => { + it('encodes the username', () => { + expect(profilePath('a/b')).toBe('u/a%2Fb'); + }); +}); diff --git a/src/lib/utils/public-share.ts b/src/lib/utils/public-share.ts new file mode 100644 index 00000000..c08844a1 --- /dev/null +++ b/src/lib/utils/public-share.ts @@ -0,0 +1,15 @@ +import { encodeShortGuid } from './short-guid'; + +/** Path of a public share: the custom URL when it has a slug, the short GUID link otherwise. */ +export function publicSharePath( + share: { id: string; slug?: string | null; author?: { name: string } }, + ownerName?: string +): `u/${string}/${string}` | `s/${string}` { + const owner = ownerName ?? share.author?.name; + if (share.slug && owner) return `u/${encodeURIComponent(owner)}/${share.slug}`; + return `s/${encodeShortGuid(share.id)}`; +} + +export function profilePath(username: string): `u/${string}` { + return `u/${encodeURIComponent(username)}`; +} diff --git a/src/lib/utils/slug.test.ts b/src/lib/utils/slug.test.ts new file mode 100644 index 00000000..990e49d8 --- /dev/null +++ b/src/lib/utils/slug.test.ts @@ -0,0 +1,21 @@ +import { describe, expect, it } from 'vitest'; +import { isValidSlug, normalizeSlug } from './slug'; + +describe('isValidSlug', () => { + it.each(['ab', 'fun', 'fun-times', 'a1-b2-c3', 'x'.repeat(32)])('accepts %s', (slug) => { + expect(isValidSlug(slug)).toBe(true); + }); + + it.each(['', 'a', '-ab', 'ab-', 'a--b', 'Ab', 'with space', 'émoji', 'x'.repeat(33)])( + 'rejects %s', + (slug) => { + expect(isValidSlug(slug)).toBe(false); + } + ); +}); + +describe('normalizeSlug', () => { + it('trims and lowercases', () => { + expect(normalizeSlug(' Fun-Times ')).toBe('fun-times'); + }); +}); diff --git a/src/lib/utils/slug.ts b/src/lib/utils/slug.ts new file mode 100644 index 00000000..84506988 --- /dev/null +++ b/src/lib/utils/slug.ts @@ -0,0 +1,15 @@ +// Mirrors the backend's SlugValidator and ApiHardLimits.PublicShareSlug*Length. +export const SLUG_MIN_LENGTH = 2; +export const SLUG_MAX_LENGTH = 32; + +const SLUG_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/; + +export function normalizeSlug(value: string): string { + return value.trim().toLowerCase(); +} + +export function isValidSlug(slug: string): boolean { + return ( + slug.length >= SLUG_MIN_LENGTH && slug.length <= SLUG_MAX_LENGTH && SLUG_PATTERN.test(slug) + ); +} diff --git a/src/lib/utils/socials.test.ts b/src/lib/utils/socials.test.ts new file mode 100644 index 00000000..62d05ab2 --- /dev/null +++ b/src/lib/utils/socials.test.ts @@ -0,0 +1,81 @@ +import { SocialPlatform } from '#lib/api/index.js'; +import { describe, expect, it } from 'vitest'; +import { isValidSocialValue, normalizeSocialValue, socialDisplayValue, socialUrl } from './socials'; + +describe('socialUrl', () => { + it.each([ + [SocialPlatform.X, '@someone', 'https://x.com/someone'], + [SocialPlatform.Bluesky, 'someone.bsky.social', 'https://bsky.app/profile/someone.bsky.social'], + [SocialPlatform.YouTube, '@channel', 'https://www.youtube.com/@channel'], + [SocialPlatform.Reddit, 'u/someone', 'https://www.reddit.com/user/someone'], + [SocialPlatform.TikTok, 'someone', 'https://www.tiktok.com/@someone'], + [SocialPlatform.Mastodon, '@user@mastodon.social', 'https://mastodon.social/@user'], + [SocialPlatform.Website, 'https://example.org/me', 'https://example.org/me'], + ])('%s %s -> %s', (platform, value, expected) => { + expect(socialUrl({ platform, value })).toBe(expected); + }); + + it('has no link for platforms without handle URLs', () => { + expect(socialUrl({ platform: SocialPlatform.Discord, value: 'someone' })).toBeNull(); + expect(socialUrl({ platform: SocialPlatform.FetLife, value: 'someone' })).toBeNull(); + }); + + it('never links non-http websites', () => { + expect( + socialUrl({ platform: SocialPlatform.Website, value: 'javascript:alert(1)' }) + ).toBeNull(); + }); + + it('encodes handles', () => { + expect(socialUrl({ platform: SocialPlatform.GitHub, value: 'a?b#c' })).toBe( + 'https://github.com/a%3Fb%23c' + ); + }); + + it('rejects malformed mastodon handles', () => { + expect(socialUrl({ platform: SocialPlatform.Mastodon, value: 'justuser' })).toBeNull(); + }); +}); + +describe('socialDisplayValue', () => { + it('prefixes handles with @ once', () => { + expect(socialDisplayValue({ platform: SocialPlatform.X, value: '@someone' })).toBe('@someone'); + expect(socialDisplayValue({ platform: SocialPlatform.X, value: 'someone' })).toBe('@someone'); + }); + + it('shows websites without the scheme', () => { + expect( + socialDisplayValue({ platform: SocialPlatform.Website, value: 'https://example.org/me/' }) + ).toBe('example.org/me'); + }); +}); + +describe('isValidSocialValue', () => { + it.each([ + [SocialPlatform.Website, 'https://example.org', true], + [SocialPlatform.Website, 'example.org', false], + [SocialPlatform.Website, 'javascript:alert(1)', false], + [SocialPlatform.Discord, 'someone', true], + [SocialPlatform.Discord, 'has space', false], + [SocialPlatform.X, 'https://x.com/someone', false], + [SocialPlatform.Mastodon, '@user@mastodon.social', true], + [SocialPlatform.Mastodon, 'justuser', false], + [SocialPlatform.Reddit, 'u/someone', true], + [SocialPlatform.Reddit, 'someone', true], + [SocialPlatform.X, 'a/b', false], + [SocialPlatform.X, '', false], + ])('%s %s -> %s', (platform, value, expected) => { + expect(isValidSocialValue(platform, value)).toBe(expected); + }); +}); + +describe('normalizeSocialValue', () => { + it('strips the reddit u/ prefix', () => { + expect(normalizeSocialValue(SocialPlatform.Reddit, ' u/someone ')).toBe('someone'); + expect(normalizeSocialValue(SocialPlatform.Reddit, '/u/someone')).toBe('someone'); + }); + + it('only trims other platforms', () => { + expect(normalizeSocialValue(SocialPlatform.X, ' @someone ')).toBe('@someone'); + }); +}); diff --git a/src/lib/utils/socials.ts b/src/lib/utils/socials.ts new file mode 100644 index 00000000..415f3464 --- /dev/null +++ b/src/lib/utils/socials.ts @@ -0,0 +1,132 @@ +import { SocialPlatform, type UserProfileSocial } from '#lib/api/index.js'; +import { m } from '#lib/paraglide/messages.js'; + +export const MAX_SOCIALS = 10; +export const SOCIAL_VALUE_MAX_LENGTH = 256; + +export const socialPlatforms = Object.values(SocialPlatform) as SocialPlatform[]; + +const brandNames: Record, string> = { + Discord: 'Discord', + X: 'X', + Bluesky: 'Bluesky', + Mastodon: 'Mastodon', + Twitch: 'Twitch', + YouTube: 'YouTube', + Kick: 'Kick', + Reddit: 'Reddit', + Instagram: 'Instagram', + TikTok: 'TikTok', + GitHub: 'GitHub', + Telegram: 'Telegram', + FetLife: 'FetLife', +}; + +export function socialPlatformLabel(platform: SocialPlatform): string { + return platform === SocialPlatform.Website ? m.profile_social_website() : brandNames[platform]; +} + +export const socialPlaceholders: Record = { + Website: 'https://example.com', + Discord: 'username', + X: 'username', + Bluesky: 'name.bsky.social', + Mastodon: '@user@instance.social', + Twitch: 'username', + YouTube: '@channel', + Kick: 'username', + Reddit: 'username', + Instagram: 'username', + TikTok: 'username', + GitHub: 'username', + Telegram: 'username', + FetLife: 'username', +}; + +const handleProfileUrls: Partial string>> = { + X: (h) => `https://x.com/${h}`, + Bluesky: (h) => `https://bsky.app/profile/${h}`, + Twitch: (h) => `https://www.twitch.tv/${h}`, + YouTube: (h) => `https://www.youtube.com/@${h}`, + Kick: (h) => `https://kick.com/${h}`, + Reddit: (h) => `https://www.reddit.com/user/${h}`, + Instagram: (h) => `https://www.instagram.com/${h}`, + TikTok: (h) => `https://www.tiktok.com/@${h}`, + GitHub: (h) => `https://github.com/${h}`, + Telegram: (h) => `https://t.me/${h}`, +}; + +const MASTODON_HANDLE = /^@?([^@\s/]+)@([a-z0-9-]+(?:\.[a-z0-9-]+)+)$/i; + +/** Trims the value and strips Reddit's `u/` prefix, which the API does not accept. */ +export function normalizeSocialValue(platform: SocialPlatform, value: string): string { + const trimmed = value.trim(); + return platform === SocialPlatform.Reddit ? trimmed.replace(/^\/?u\//i, '') : trimmed; +} + +/** Strips a leading `@`, and Reddit's `u/` prefix. */ +function cleanHandle(platform: SocialPlatform, value: string): string { + let handle = value.trim().replace(/^@/, ''); + if (platform === SocialPlatform.Reddit) handle = handle.replace(/^\/?u\//i, ''); + return handle; +} + +/** The text shown for a social, e.g. `@name` for handles or the host for websites. */ +export function socialDisplayValue(social: UserProfileSocial): string { + if (social.platform === SocialPlatform.Website) { + try { + const url = new URL(social.value); + return url.host + url.pathname.replace(/\/+$/, ''); + } catch { + return social.value; + } + } + if (social.platform === SocialPlatform.Mastodon) return social.value; + return `@${cleanHandle(social.platform, social.value)}`; +} + +/** + * The profile URL for a social, or null when the platform has no stable handle-based URL + * (Discord, FetLife) or the value is not usable. Only ever returns http(s) URLs. + */ +export function socialUrl(social: UserProfileSocial): string | null { + if (social.platform === SocialPlatform.Website) { + try { + const url = new URL(social.value); + return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : null; + } catch { + return null; + } + } + + if (social.platform === SocialPlatform.Mastodon) { + const match = MASTODON_HANDLE.exec(social.value.trim()); + if (!match) return null; + return `https://${match[2]}/@${encodeURIComponent(match[1])}`; + } + + const build = handleProfileUrls[social.platform]; + const handle = cleanHandle(social.platform, social.value); + if (!build || !handle) return null; + return build(encodeURIComponent(handle)); +} + +/** Mirrors the backend's SocialValidator, checked against the normalized value. */ +export function isValidSocialValue(platform: SocialPlatform, rawValue: string): boolean { + const value = normalizeSocialValue(platform, rawValue); + if (!value || value.length > SOCIAL_VALUE_MAX_LENGTH) return false; + if (/[\s\p{Cc}]/u.test(value)) return false; + + if (platform === SocialPlatform.Website) { + try { + const url = new URL(value); + return url.protocol === 'https:' || url.protocol === 'http:'; + } catch { + return false; + } + } + + if (platform === SocialPlatform.Mastodon) return MASTODON_HANDLE.test(value); + + return !value.includes('://') && !value.includes('/') && !value.includes('\\'); +} diff --git a/src/routes/(app)/profile/+page.svelte b/src/routes/(app)/profile/+page.svelte index e356b2cf..8f4054cc 100644 --- a/src/routes/(app)/profile/+page.svelte +++ b/src/routes/(app)/profile/+page.svelte @@ -1,17 +1,369 @@ - - + + {#if self && saved?.isPublic} + + {/if} + + + {#if loading || !self} + + {:else if loadFailed} + + + + {:else} +
+
+ + + {m.profile_public_title()} + {m.profile_public_desc()} + + + + {#if form.isPublic} + + {/if} + + + + + + {m.profile_about_title()} + {m.profile_about_desc()} + + + + +
+ +