mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
Add Blossom server list to app config (kind 10063)
Blossom servers now live in AppConfig alongside the NIP-65 relay list: - blossomServerMetadata (BUD-03 server list) and useAppBlossomServers flag - src/lib/appBlossom.ts provides APP_BLOSSOM_SERVERS defaults (blossom.ditto.pub, blossom.dreamith.to, blossom.primal.net), parseBlossomServerList, and getEffectiveBlossomServers - NostrSync hydrates the user's kind 10063 event on login - useUploadFile reads effective servers from config
This commit is contained in:
7 files changed
+171
-7
No files matched your search
@@ -2,9 +2,12 @@ import { useMutation } from "@tanstack/react-query";
|
||||
import { BlossomUploader } from '@nostrify/nostrify/uploaders';
|
||||
|
||||
import { useCurrentUser } from "./useCurrentUser";
|
||||
import { useAppContext } from "./useAppContext";
|
||||
import { getEffectiveBlossomServers } from "@/lib/appBlossom";
|
||||
|
||||
export function useUploadFile() {
|
||||
const { user } = useCurrentUser();
|
||||
const { config } = useAppContext();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (file: File) => {
|
||||
@@ -12,10 +15,17 @@ export function useUploadFile() {
|
||||
throw new Error('Must be logged in to upload files');
|
||||
}
|
||||
|
||||
const servers = getEffectiveBlossomServers(
|
||||
config.blossomServerMetadata,
|
||||
config.useAppBlossomServers,
|
||||
);
|
||||
|
||||
if (servers.length === 0) {
|
||||
throw new Error('No Blossom servers configured');
|
||||
}
|
||||
|
||||
const uploader = new BlossomUploader({
|
||||
servers: [
|
||||
'https://blossom.primal.net/',
|
||||
],
|
||||
servers,
|
||||
signer: user.signer,
|
||||
});
|
||||
|
||||
@@ -23,4 +33,4 @@ export function useUploadFile() {
|
||||
return tags;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user