add group user with the same subscription id to all inbounds (#1650)

This commit is contained in:
Ali Rahimi
2024-01-21 15:26:19 +01:00
committed by GitHub
parent e7ce8c8ddb
commit 5c695ca652
13 changed files with 196 additions and 48 deletions

View File

@@ -83,6 +83,41 @@ class HttpUtil {
}
return msg;
}
static async jsonPost(url, data) {
let msg;
try {
const requestOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
};
const resp = await fetch(url, requestOptions);
const response = await resp.json();
msg = this._respToMsg({data : response});
} catch (e) {
msg = new Msg(false, e.toString());
}
this._handleMsg(msg);
return msg;
}
static async postWithModalJson(url, data, modal) {
if (modal) {
modal.loading(true);
}
const msg = await this.jsonPost(url, data);
if (modal) {
modal.loading(false);
if (msg instanceof Msg && msg.success) {
modal.close();
}
}
return msg;
}
}
class PromiseUtil {