wip: basic support multi windows
This commit is contained in:
@@ -1,46 +1,49 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "desktop-capability",
|
||||
"description": "Capability for the desktop",
|
||||
"platforms": ["linux", "macOS", "windows"],
|
||||
"windows": ["main", "settings", "event-*", "user-*", "column-*"],
|
||||
"permissions": [
|
||||
"path:default",
|
||||
"event:default",
|
||||
"window:default",
|
||||
"app:default",
|
||||
"resources:default",
|
||||
"menu:default",
|
||||
"tray:default",
|
||||
"theme:allow-set-theme",
|
||||
"theme:allow-get-theme",
|
||||
"notification:allow-is-permission-granted",
|
||||
"notification:allow-request-permission",
|
||||
"notification:default",
|
||||
"os:allow-locale",
|
||||
"os:allow-platform",
|
||||
"updater:allow-check",
|
||||
"updater:default",
|
||||
"window:allow-start-dragging",
|
||||
"store:allow-get",
|
||||
{
|
||||
"identifier": "http:default",
|
||||
"allow": [
|
||||
{
|
||||
"url": "http://**/"
|
||||
},
|
||||
{
|
||||
"url": "https://**/"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-read-text-file",
|
||||
"allow": [
|
||||
{
|
||||
"path": "$RESOURCE/locales/*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "desktop-capability",
|
||||
"description": "Capability for the desktop",
|
||||
"platforms": ["linux", "macOS", "windows"],
|
||||
"windows": ["main", "settings", "event-*", "user-*", "column-*"],
|
||||
"permissions": [
|
||||
"path:default",
|
||||
"event:default",
|
||||
"window:default",
|
||||
"app:default",
|
||||
"resources:default",
|
||||
"menu:default",
|
||||
"tray:default",
|
||||
"theme:allow-set-theme",
|
||||
"theme:allow-get-theme",
|
||||
"notification:allow-is-permission-granted",
|
||||
"notification:allow-request-permission",
|
||||
"notification:default",
|
||||
"os:allow-locale",
|
||||
"os:allow-platform",
|
||||
"updater:allow-check",
|
||||
"updater:default",
|
||||
"window:allow-start-dragging",
|
||||
"store:allow-get",
|
||||
"clipboard-manager:allow-write",
|
||||
"clipboard-manager:allow-read",
|
||||
"webview:allow-create-webview-window",
|
||||
{
|
||||
"identifier": "http:default",
|
||||
"allow": [
|
||||
{
|
||||
"url": "http://**/"
|
||||
},
|
||||
{
|
||||
"url": "https://**/"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-read-text-file",
|
||||
"allow": [
|
||||
{
|
||||
"path": "$RESOURCE/locales/*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","context":"local","windows":["main","settings","event-*","user-*","column-*"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","theme:allow-set-theme","theme:allow-get-theme","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","updater:allow-check","updater:default","window:allow-start-dragging","store:allow-get",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"}]}],"platforms":["linux","macOS","windows"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","context":"local","windows":["main","settings","event-*","user-*","column-*"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","theme:allow-set-theme","theme:allow-get-theme","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","updater:allow-check","updater:default","window:allow-start-dragging","store:allow-get","clipboard-manager:allow-write","clipboard-manager:allow-read","webview:allow-create-webview-window",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"}]}],"platforms":["linux","macOS","windows"]}}
|
||||
@@ -6,15 +6,14 @@ use tauri::State;
|
||||
#[tauri::command(async)]
|
||||
pub async fn get_event(id: &str, nostr: State<'_, Nostr>) -> Result<String, String> {
|
||||
let client = &nostr.client;
|
||||
let event_id;
|
||||
|
||||
if id.starts_with("note") {
|
||||
event_id = EventId::from_bech32(id).unwrap();
|
||||
} else if id.starts_with("nevent") {
|
||||
event_id = Nip19Event::from_bech32(id).unwrap().event_id;
|
||||
} else {
|
||||
event_id = EventId::from_hex(id).unwrap();
|
||||
}
|
||||
let event_id: EventId = match Nip19::from_bech32(id) {
|
||||
Ok(val) => match val {
|
||||
Nip19::EventId(id) => id,
|
||||
Nip19::Event(event) => event.event_id,
|
||||
_ => panic!("not nip19"),
|
||||
},
|
||||
Err(_) => EventId::from_hex(id).unwrap(),
|
||||
};
|
||||
|
||||
let filter = Filter::new().id(event_id);
|
||||
let events = client
|
||||
|
||||
@@ -6,15 +6,14 @@ use tauri::State;
|
||||
#[tauri::command(async)]
|
||||
pub async fn get_profile(id: &str, nostr: State<'_, Nostr>) -> Result<Metadata, ()> {
|
||||
let client = &nostr.client;
|
||||
let public_key;
|
||||
|
||||
if id.starts_with("nprofile1") {
|
||||
public_key = XOnlyPublicKey::from_bech32(id).unwrap();
|
||||
} else if id.starts_with("npub1") {
|
||||
public_key = XOnlyPublicKey::from_bech32(id).unwrap();
|
||||
} else {
|
||||
public_key = XOnlyPublicKey::from_str(id).unwrap();
|
||||
}
|
||||
let public_key: XOnlyPublicKey = match Nip19::from_bech32(id) {
|
||||
Ok(val) => match val {
|
||||
Nip19::Pubkey(pubkey) => pubkey,
|
||||
Nip19::Profile(profile) => profile.public_key,
|
||||
_ => panic!("not nip19"),
|
||||
},
|
||||
Err(_) => XOnlyPublicKey::from_str(id).unwrap(),
|
||||
};
|
||||
|
||||
let filter = Filter::new()
|
||||
.author(public_key)
|
||||
|
||||
Reference in New Issue
Block a user