1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 10:45:56 +00:00

simplify internal authentication code and bump default algo to SSHA-512

This commit is contained in:
Andrew Dolgov
2021-03-01 15:24:18 +03:00
parent 320503dd39
commit 6359259dbb
10 changed files with 152 additions and 169 deletions

View File

@@ -154,7 +154,7 @@ String.prototype.stripTags = function() {
/* exported xhr */
const xhr = {
post: function(url, params = {}, complete = undefined) {
post: function(url, params = {}, complete = undefined, failed = undefined) {
console.log('xhr.post', '>>>', params);
return new Promise((resolve, reject) => {
@@ -165,6 +165,9 @@ const xhr = {
postData: dojo.objectToQuery(params),
handleAs: "text",
error: function(error) {
if (failed != undefined)
failed(error);
reject(error);
},
load: function(data, ioargs) {
@@ -178,7 +181,7 @@ const xhr = {
);
});
},
json: function(url, params = {}, complete = undefined) {
json: function(url, params = {}, complete = undefined, failed = undefined) {
return new Promise((resolve, reject) =>
this.post(url, params).then((data) => {
let obj = null;
@@ -187,6 +190,10 @@ const xhr = {
obj = JSON.parse(data);
} catch (e) {
console.error("xhr.json", e, xhr);
if (failed != undefined)
failed(e);
reject(e);
}
@@ -194,6 +201,10 @@ const xhr = {
if (obj && typeof App != "undefined")
if (!App.handleRpcJson(obj)) {
if (failed != undefined)
failed(obj);
reject(obj);
return;
}