mirror of https://github.com/ospab/ostp.git
Fix hot-reloader clearing access keys due to modular config migration
This commit is contained in:
parent
3efbfd75cc
commit
7fadc8d28d
|
|
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 0.3.9+22
|
||||
version: 0.3.10+23
|
||||
|
||||
environment:
|
||||
sdk: ^3.11.4
|
||||
|
|
|
|||
|
|
@ -2665,7 +2665,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ostp-client"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
|
|
@ -2700,7 +2700,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ostp-core"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byteorder",
|
||||
|
|
@ -2742,7 +2742,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ostp-tun"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"libc",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "ostp-gui",
|
||||
"version": "0.3.9",
|
||||
"version": "0.3.10",
|
||||
"identifier": "com.ospab.ostp",
|
||||
"build": {
|
||||
"frontendDist": "../src"
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ pub async fn run_server(
|
|||
mode: String,
|
||||
#[serde(default)]
|
||||
access_keys: Vec<ReloadUser>,
|
||||
#[serde(default)]
|
||||
inbounds: Vec<serde_json::Value>,
|
||||
}
|
||||
|
||||
let mut stripped = json_comments::StripComments::new(content.as_bytes());
|
||||
|
|
@ -181,7 +183,23 @@ pub async fn run_server(
|
|||
Ok(cfg) => {
|
||||
if cfg.mode == "server" {
|
||||
let mut new_keys = HashMap::new();
|
||||
for uc in cfg.access_keys {
|
||||
let mut all_users = cfg.access_keys;
|
||||
|
||||
for inbound in cfg.inbounds {
|
||||
if let Some(protocol) = inbound.get("protocol").and_then(|p| p.as_str()) {
|
||||
if protocol == "ostp" {
|
||||
if let Some(users) = inbound.get("users").and_then(|u| u.as_array()) {
|
||||
for u in users {
|
||||
if let Ok(ru) = serde_json::from_value::<ReloadUser>(u.clone()) {
|
||||
all_users.push(ru);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for uc in all_users {
|
||||
let (k, m) = match uc {
|
||||
ReloadUser::Detailed { access_key, name, limit_bytes } => (access_key, crate::api::UserMeta { name, limit_bytes }),
|
||||
ReloadUser::KeyOnly(k) => (k, crate::api::UserMeta { name: None, limit_bytes: None }),
|
||||
|
|
|
|||
Loading…
Reference in New Issue