fix: JSON url, iterate non_subscriptions, do not define $request and $response

This commit is contained in:
PorridgePi
2023-10-23 01:06:57 +08:00
parent 2f0b6c4e90
commit 419c06ed90

View File

@@ -1,4 +1,4 @@
const storageKeyName = "rc_rewrite_ddata";
const storageKeyName = "rc_rewrite_data";
const jobTitle = "update_rc";
const notificationTitle = "Update RevenueCat JSON"
@@ -7,7 +7,7 @@ let URL = "";
// URL = "https://stackoverflow.com/questions/38708550/difference-between-return-await-promise-and-return-promise"
// URL = "http://localhost:8000/rc_rewrite_data.json";
// URL = "https://api.jsonbin.io/v3/qs/651be8b30574da7622b3b246";
URL = "https://git.ykz.app/PorridgePi/json/raw/branch/main/rc_rewrite_data.json";
URL = "https://git.ykz.app/PorridgePi/qx/raw/branch/main/rc_rewrite_data.json";
// URL = "https://porridgepi.github.io/json/rc_rewrite_data.json"
requestOpts = {
@@ -205,7 +205,7 @@ async function onResponse(context, url, request, response) {
"purchase_date": "2020-01-01T00:00:00Z"
}
}
for (const i of rewriteItem.new_other_purchases) {
for (const i of rewriteItem.new_non_subscriptions) {
body.subscriber.other_purchases[i] = {
purchase_date: "2020-01-01T00:00:00Z"
}
@@ -225,7 +225,7 @@ async function onResponse(context, url, request, response) {
response.statusCode = 200;
response.statusPhrase = "OK";
response.headers["Content-Type"] = "application/json";
console.log(response.body);
console.log(JSON.stringify(response.body));
break;
}
@@ -233,9 +233,6 @@ async function onResponse(context, url, request, response) {
return response;
}
var $request, $response;
async function main() {
console.log("Starting...");
if (isSurge || isQuanX) {