import { component$, useStore, $ } from '@builder.io/qwik' import { getDatabase } from 'wildebeest/backend/src/database' import { action$, Form, zod$, z } from '@builder.io/qwik-city' import { addAlias } from 'wildebeest/backend/src/accounts/alias' import ResultMessage from '~/components/ResultMessage' const zodSchema = zod$({ alias: z.string().min(1), }) export const action = action$(async (data, { platform, json, request }) => { const url = new URL(request.url) const domain = url.hostname const db = await getDatabase(platform) const connectedActor = platform.data.connectedActor if (connectedActor === null) { throw json(500, { error: 'user not present in context' }) } try { await addAlias(db, data.alias, connectedActor, platform.userKEK, domain) } catch (e: unknown) { const error = e as { stack: string; cause: string } console.error(error.stack, error.cause) throw json(500, { error: 'failed to add alias' }) } return { success: true, } }, zodSchema) export default component$(() => { const state = useStore({ alias: '' }) const handleInput = $((event: Event) => { state.alias = (event.target as HTMLInputElement).value }) const saveAction = action() return (

Account Aliases

{!!saveAction.value && ( )}

If you want to move from another account to this one, here you can create an alias, which is required before you can proceed with moving followers from the old account to this one. This action by itself is harmless and reversible. The account migration is initiated from the old account.

Specify the username@domain of the account you want to move from
{/*
Handle of the old account
test
Unlink Alias
test 2
Unlink Alias
*/}
) })