Refactor settings menu, add Nostr settings
Adds a setting to control if photos should be uploaded only to the main/default server, or all known servers of a user. Only upload to the main server by default, to speed up adding photos.
This commit is contained in:
@@ -21,10 +21,17 @@ function getBlossomUrl(serverUrl, path) {
|
||||
export default class BlossomService extends Service {
|
||||
@service nostrAuth;
|
||||
@service nostrData;
|
||||
@service settings;
|
||||
|
||||
get servers() {
|
||||
const servers = this.nostrData.blossomServers;
|
||||
return servers.length ? servers : [DEFAULT_BLOSSOM_SERVER];
|
||||
const allServers = servers.length ? servers : [DEFAULT_BLOSSOM_SERVER];
|
||||
|
||||
if (!this.settings.nostrPhotoFallbackUploads) {
|
||||
return [allServers[0]];
|
||||
}
|
||||
|
||||
return allServers;
|
||||
}
|
||||
|
||||
async _getAuthHeader(action, hash, serverUrl) {
|
||||
|
||||
@@ -6,6 +6,7 @@ export default class SettingsService extends Service {
|
||||
@tracked mapKinetic = true;
|
||||
@tracked photonApi = 'https://photon.komoot.io/api/';
|
||||
@tracked showQuickSearchButtons = true;
|
||||
@tracked nostrPhotoFallbackUploads = false;
|
||||
|
||||
overpassApis = [
|
||||
{
|
||||
@@ -64,6 +65,14 @@ export default class SettingsService extends Service {
|
||||
if (savedShowQuickSearch !== null) {
|
||||
this.showQuickSearchButtons = savedShowQuickSearch === 'true';
|
||||
}
|
||||
|
||||
const savedNostrPhotoFallbackUploads = localStorage.getItem(
|
||||
'marco:nostr-photo-fallback-uploads'
|
||||
);
|
||||
if (savedNostrPhotoFallbackUploads !== null) {
|
||||
this.nostrPhotoFallbackUploads =
|
||||
savedNostrPhotoFallbackUploads === 'true';
|
||||
}
|
||||
}
|
||||
|
||||
updateOverpassApi(url) {
|
||||
@@ -84,4 +93,9 @@ export default class SettingsService extends Service {
|
||||
updatePhotonApi(url) {
|
||||
this.photonApi = url;
|
||||
}
|
||||
|
||||
updateNostrPhotoFallbackUploads(enabled) {
|
||||
this.nostrPhotoFallbackUploads = enabled;
|
||||
localStorage.setItem('marco:nostr-photo-fallback-uploads', String(enabled));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user