mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 05:54:19 +01:00
feat: complete domain transferring
removed domain transferring related codes.
This commit is contained in:
17
index.html
17
index.html
@@ -8,28 +8,19 @@
|
||||
<meta name="twitter:creator" content="@syusui-s" />
|
||||
<meta
|
||||
name="twitter:image"
|
||||
content="https://syusui-s.github.io/rabbit/images/rabbit_app_1280.png"
|
||||
content="https://rabbit.syusui.net/images/rabbit_app_1280.png"
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://syusui-s.github.io/rabbit/" />
|
||||
<meta property="og:url" content="https://rabbit.syusui.net/" />
|
||||
<meta property="og:title" content="🐰rabbit" />
|
||||
<meta property="og:description" content="Nostr Client" />
|
||||
<meta property="og:description" content="A nostr client supports multi-columns." />
|
||||
<meta
|
||||
property="og:image"
|
||||
content="https://syusui-s.github.io/rabbit/images/rabbit_app_1280.png"
|
||||
content="https://rabbit.syusui.net/images/rabbit_app_1280.png"
|
||||
/>
|
||||
<meta property="og:locale" content="ja_JP" />
|
||||
<link rel="manifest" href="manifest.json" />
|
||||
<link rel="shortcut icon" type="image/png" href="./images/rabbit_256.png" />
|
||||
<script>
|
||||
/*
|
||||
if (location.hostname === 'syusui-s.github.io' && location.pathname.startsWith('/rabbit/')) {
|
||||
const url = new URL('https://rabbit.syusui.net/');
|
||||
url.pathname = location.pathname.replace(/^\/rabbit/, '');
|
||||
location.href = url.href;
|
||||
}
|
||||
*/
|
||||
</script>
|
||||
<title>Rabbit</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
15
src/App.tsx
15
src/App.tsx
@@ -6,7 +6,6 @@ import { persistQueryClient } from '@tanstack/query-persist-client-core';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';
|
||||
import { get as getItem, set as setItem, del as removeItem } from 'idb-keyval';
|
||||
|
||||
import DomainTransferInfo from '@/components/DomainTransferInfo';
|
||||
import useColorTheme from '@/hooks/useColorTheme';
|
||||
import usePersistStatus from '@/hooks/usePersistStatus';
|
||||
import i18nextInstance from '@/i18n/i18n';
|
||||
@@ -64,14 +63,12 @@ const App: Component = () => {
|
||||
return (
|
||||
<I18NextProvider i18next={i18next}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<DomainTransferInfo>
|
||||
<HashRouter>
|
||||
<Route path="/hello" component={() => <Navigate href="/" />} />
|
||||
<Route path="/" component={() => <EntryPoint />} />
|
||||
<Route path="/:id" component={() => <Permalink />} matchFilters={permalinkFilters} />
|
||||
<Route path="/*" component={() => <NotFound />} />
|
||||
</HashRouter>
|
||||
</DomainTransferInfo>
|
||||
<HashRouter>
|
||||
<Route path="/hello" component={() => <Navigate href="/" />} />
|
||||
<Route path="/" component={() => <EntryPoint />} />
|
||||
<Route path="/:id" component={() => <Permalink />} matchFilters={permalinkFilters} />
|
||||
<Route path="/*" component={() => <NotFound />} />
|
||||
</HashRouter>
|
||||
</QueryClientProvider>
|
||||
</I18NextProvider>
|
||||
);
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
import { createSignal, Show, type Component, type JSX } from 'solid-js';
|
||||
|
||||
import XMark from 'heroicons/24/outline/x-mark.svg';
|
||||
|
||||
import SafeLink from '@/components/utils/SafeLink';
|
||||
import { useTranslation } from '@/i18n/useTranslation';
|
||||
|
||||
const isPermittedDomain = (url: URL | Location) =>
|
||||
url.host === 'rabbit.syusui.net' || url.host.startsWith('localhost');
|
||||
|
||||
const DomainTransferInfo: Component<{ children: JSX.Element }> = (props) => {
|
||||
const i18n = useTranslation();
|
||||
const [showContent, setShowContent] = createSignal(false);
|
||||
|
||||
return (
|
||||
<Show
|
||||
when={isPermittedDomain(window.location) || showContent()}
|
||||
fallback={
|
||||
<div class="flex h-svh w-screen shrink-0 flex-col items-center justify-center border-b border-border bg-bg-tertiary text-fg">
|
||||
<h3 class="text-2xl font-bold">{i18n.t('domainTransfer.announcementHead')}</h3>
|
||||
<div>{i18n.t('domainTransfer.announcementDescription')}</div>
|
||||
<SafeLink class="text-lg text-link underline" href="https://rabbit.syusui.net/" />
|
||||
<SafeLink
|
||||
class="mt-4 text-sm text-link underline"
|
||||
href="https://scrapbox.io/nostr/Rabbit#659be5fa1246d700005facb8"
|
||||
>
|
||||
{i18n.t('domainTransfer.howToMigrateSettings')}
|
||||
</SafeLink>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-4 flex items-center text-fg-secondary"
|
||||
onClick={() => setShowContent(true)}
|
||||
>
|
||||
<span class="inline-block size-5">
|
||||
<XMark />
|
||||
</span>
|
||||
{i18n.t('domainTransfer.close')}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{props.children}
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
export default DomainTransferInfo;
|
||||
@@ -634,7 +634,6 @@ const OtherConfig = () => {
|
||||
const ConfigUI = (props: ConfigProps) => {
|
||||
const i18n = useTranslation();
|
||||
const [menuIndex, setMenuIndex] = createSignal<number | null>(null);
|
||||
const { config, setConfig } = useConfig();
|
||||
|
||||
const menu = [
|
||||
{
|
||||
@@ -691,41 +690,6 @@ const ConfigUI = (props: ConfigProps) => {
|
||||
fallback={
|
||||
<>
|
||||
<h2 class="flex-1 text-center text-lg font-bold">{i18n.t('config.config')}</h2>
|
||||
<div class="flex gap-1">
|
||||
<Show when={window.location.host === 'syusui-s.github.io'}>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded bg-primary p-2 text-primary-fg"
|
||||
onClick={() => {
|
||||
navigator.clipboard
|
||||
.writeText(JSON.stringify(config(), null, 2))
|
||||
.then(() => window.alert('OK'))
|
||||
.catch(() => window.alert('failed to copy'));
|
||||
}}
|
||||
>
|
||||
{i18n.t('config.copyToClipboard')}
|
||||
</button>
|
||||
</Show>
|
||||
<Show when={window.location.host === 'rabbit.syusui.net'}>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded bg-primary p-2 text-primary-fg"
|
||||
onClick={() => {
|
||||
const text = window.prompt('Paste config') ?? '';
|
||||
if (text.length === 0) {
|
||||
window.alert('empty');
|
||||
return;
|
||||
}
|
||||
const json = JSON.parse(text) as ReturnType<typeof config>;
|
||||
if (window.confirm(`import?:\n${text}`)) {
|
||||
setConfig(json);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{i18n.t('config.importFromClipboard')}
|
||||
</button>
|
||||
</Show>
|
||||
</div>
|
||||
<ul class="flex flex-col">
|
||||
<For each={menu}>
|
||||
{(menuItem, i) => (
|
||||
|
||||
Reference in New Issue
Block a user