chore: refactor app settings (#2)

# Changelog

### Added

- [x] Add `Auth Mode` setting.
- [x] Add `Room Config` setting.

### Changed

- [x] Rename `media server` setting to `file server`

### Removed

- [x] Remove `proxy` setting. Coop is no longer depend on any 3rd party services.
- [x] Remove `contact bypass` settings. All chat requests from known contacts will be bypass by default.

**Note:**
- The Settings UI has been removed. It will be re-added in a separate PR.

Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
2026-01-14 09:48:15 +08:00
parent 75c3783522
commit ac9afb1790
11 changed files with 171 additions and 310 deletions

View File

@@ -10,7 +10,7 @@ use gpui::{
Subscription, Task, Window,
};
use nostr_sdk::prelude::*;
use settings::AppSettings;
use settings::{AppSettings, AuthMode};
use smallvec::{smallvec, SmallVec};
use state::{tracker, NostrRegistry};
use theme::ActiveTheme;
@@ -93,12 +93,12 @@ impl RelayAuth {
// Observe the current state
cx.observe_in(&entity, window, |this, _, window, cx| {
let settings = AppSettings::global(cx);
let auto_auth = AppSettings::get_auto_auth(cx);
let mode = AppSettings::get_auth_mode(cx);
for req in this.requests.clone().into_iter() {
let is_authenticated = settings.read(cx).is_authenticated(&req.url);
let is_trusted_relay = settings.read(cx).is_trusted_relay(&req.url, cx);
if auto_auth && is_authenticated {
if is_trusted_relay && mode == AuthMode::Auto {
// Automatically authenticate if the relay is authenticated before
this.response(req, window, cx);
} else {
@@ -250,7 +250,7 @@ impl RelayAuth {
// Save the authenticated relay to automatically authenticate future requests
settings.update(cx, |this, cx| {
this.push_relay(&url, cx);
this.add_trusted_relay(url, cx);
});
// Remove the challenge from the list of pending authentications