shawenguan пре 2 година
родитељ
комит
d907b968cc
1 измењених фајлова са 34 додато и 24 уклоњено
  1. 34 24
      Scripts/nicegram/nicegram.js

+ 34 - 24
Scripts/nicegram/nicegram.js

@@ -6,35 +6,45 @@
 
 [rewrite_local]
 
-https?:\/\/restore-access\.indream\.app\/restoreAccess\?id=\d{5,10} url echo-response text/json echo-response https://git.jojo21.cf/shawenguan/Quantumult-X/raw/master/Scripts/nicegram/nicegram.js
+https?:\/\/nicegram\.cloud\/api\/v6\/user\/info url script-response-body https://git.jojo21.cf/shawenguan/Quantumult-X/raw/master/Scripts/nicegram/nicegram.js
 
 [MITM]
 
-hostname=restore-access.indream.app
+hostname=nicegram.cloud
 
 ********************************/
-
-const isTaskDefined = typeof $task !== 'undefined';
-const isHttpClientDefined = typeof $httpClient !== 'undefined';
-
-function logAndUnlockPremium() {
+# {
+#   "status" : 200,
+#   "data" : {
+#     "user" : {
+#       "id" : 1307515,
+#       "last_ads_view" : 0,
+#       "next_daily_reward_claim_time" : 1703807999,
+#       "last_getting_daily_reward" : 1,
+#       "telegramAuthToken" : "638ccd5e9070e3753dc09a51273161c8087d042429cd030f111604e5f028cb79",
+#       "referral_link" : "https://t.me/NicegramConnectBot?start=e758eb7ea54e3b591c6a0a22506566ba1be7d4ce22990898ed9cc40928ef4654",
+#       "store_subscription" : false,
+#       "user_name" : null,
+#       "first_name" : "Ai",
+#       "gems_balance" : 9,
+#       "subscription" : false,
+#       "server_time" : 1703744374,
+#       "last_name" : "Yo",
+#       "lifetime_subscription" : false
+#     }
+#   },
+#   "message" : ""
+# }
+
+function doUnlockPremium() {
     console.log('Nicegram Premium已解锁😎');
-    const responseBody = { data: { premiumAccess: true } };
-    const response = {
-        status: 'HTTP/1.1 200 OK',
-        body: JSON.stringify(responseBody),
-        headers: { 'Content-Type': 'application/json' }
-    };
-
-    if (isHttpClientDefined) {
-        // For Surge
-        $done({ response: { status: 200, body: JSON.stringify(responseBody) } });
-    } else if (isTaskDefined) {
-        // For Quantumult X
-        $done(response);
-    } else {
-        // Other environments, fallback to a simple response
-        $done({ status: 200, body: JSON.stringify(responseBody) });
+    const data = JSON.parse(typeof $response != "undefined" && $response.body || null);
+    if(data.status == 200 && data.data){
+        const user = data.data.user;
+        user['subscription'] =  true;
+        user['store_subscription'] =  true;
+        user['lifetime_subscription'] =  true;
     }
+    $done({ body: JSON.stringify(data) });
 }
-logAndUnlockPremium();
+doUnlockPremium();