mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-22 15:19:47 +02:00
Merge pull request #178 from greenart7c3/next
if on android use citrine url for cache relay
This commit is contained in:
48
src/views/relays/cache/index.tsx
vendored
48
src/views/relays/cache/index.tsx
vendored
@@ -138,6 +138,48 @@ function NostrRelayTray() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CitrineRelay() {
|
||||||
|
const { value: available, loading: checking } = useAsync(checkNostrRelayTray);
|
||||||
|
|
||||||
|
const enabled = localRelay?.url.startsWith(NOSTR_RELAY_TRAY_URL);
|
||||||
|
const enable = () => {
|
||||||
|
localStorage.setItem("localRelay", NOSTR_RELAY_TRAY_URL);
|
||||||
|
location.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card borderColor={enabled ? "primary.500" : undefined} variant="outline">
|
||||||
|
<CardHeader p="4" display="flex" gap="2" alignItems="center">
|
||||||
|
<Heading size="md">Citrine</Heading>
|
||||||
|
<Link color="blue.500" href="https://github.com/greenart7c3/Citrine" isExternal>
|
||||||
|
GitHub
|
||||||
|
</Link>
|
||||||
|
{available ? (
|
||||||
|
<Button size="sm" colorScheme="primary" ml="auto" isLoading={checking} onClick={enable} isDisabled={enabled}>
|
||||||
|
{enabled ? "Enabled" : "Enable"}
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
as={Link}
|
||||||
|
isExternal
|
||||||
|
href="https://github.com/greenart7c3/Citrine"
|
||||||
|
colorScheme="blue"
|
||||||
|
size="sm"
|
||||||
|
ml="auto"
|
||||||
|
>
|
||||||
|
Get the app
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</CardHeader>
|
||||||
|
<CardBody p="4" pt="0">
|
||||||
|
<Text mb="2">A cool little app that runs a local relay in your phone</Text>
|
||||||
|
<Text>Maximum capacity: Unlimited</Text>
|
||||||
|
<Text>Performance: As fast as your phone</Text>
|
||||||
|
</CardBody>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function SatelliteRelay() {
|
function SatelliteRelay() {
|
||||||
const { value: relay } = useAsync(() => window.satellite!.getLocalRelay());
|
const { value: relay } = useAsync(() => window.satellite!.getLocalRelay());
|
||||||
const { value: enabled } = useAsync(async () => localRelay?.url === relay, [localRelay?.url, relay]);
|
const { value: enabled } = useAsync(async () => localRelay?.url === relay, [localRelay?.url, relay]);
|
||||||
@@ -260,7 +302,13 @@ export default function CacheRelayView() {
|
|||||||
</Text>
|
</Text>
|
||||||
<InternalRelay />
|
<InternalRelay />
|
||||||
{WasmRelay.SUPPORTED && <WasmWorkerRelay />}
|
{WasmRelay.SUPPORTED && <WasmWorkerRelay />}
|
||||||
|
{
|
||||||
|
navigator.userAgent.includes("Android") ? (
|
||||||
|
<CitrineRelay />
|
||||||
|
) : (
|
||||||
<NostrRelayTray />
|
<NostrRelayTray />
|
||||||
|
)
|
||||||
|
}
|
||||||
{window.satellite && <SatelliteRelay />}
|
{window.satellite && <SatelliteRelay />}
|
||||||
{window.CACHE_RELAY_ENABLED && <HostedRelay />}
|
{window.CACHE_RELAY_ENABLED && <HostedRelay />}
|
||||||
<Button w="full" variant="link" p="4" onClick={showAdvanced.onToggle}>
|
<Button w="full" variant="link" p="4" onClick={showAdvanced.onToggle}>
|
||||||
|
Reference in New Issue
Block a user