Subversion Repositories SmartDukaan

Rev

Rev 37429 | Rev 37432 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37429 Rev 37431
Line 249... Line 249...
249
              + "    return F.apply(this, arguments).then(function(r){"
249
              + "    return F.apply(this, arguments).then(function(r){"
250
              + "      try { if (u.indexOf('getDeviceInfo') !== -1) { r.clone().text().then(function(t){ window.__oppoResp = t; }); } } catch(e){}"
250
              + "      try { if (u.indexOf('getDeviceInfo') !== -1) { r.clone().text().then(function(t){ window.__oppoResp = t; }); } } catch(e){}"
251
              + "      return r;"
251
              + "      return r;"
252
              + "    });"
252
              + "    });"
253
              + "  }; }"
253
              + "  }; }"
-
 
254
              // A window.fetch wrapper only catches clients that resolve fetch at call
-
 
255
              // time. Anything that captured globalThis.fetch when its bundle loaded --
-
 
256
              // Nuxt's $fetch/ofetch does exactly this, and it is what hid realme's
-
 
257
              // lookup from us -- sails straight past it. Response.prototype is resolved
-
 
258
              // per call, so it catches every client regardless.
-
 
259
              // Read the clone with the ORIGINAL reader; the patched one recurses forever.
-
 
260
              + "  ['json','text'].forEach(function(name){"
-
 
261
              + "    var orig = Response.prototype[name];"
-
 
262
              + "    if (!orig) return;"
-
 
263
              + "    Response.prototype[name] = function(){"
-
 
264
              + "      try { var u = this.url || '';"
-
 
265
              + "        if (u.indexOf('getDeviceInfo') !== -1 && !this.__oppoSeenBody) {"
-
 
266
              + "          var c = this.clone(); c.__oppoSeenBody = 1;"
-
 
267
              + "          orig.call(c).then(function(t){ window.__oppoResp = (typeof t === 'string') ? t : JSON.stringify(t); });"
-
 
268
              + "        } } catch(e){}"
-
 
269
              + "      return orig.apply(this, arguments);"
-
 
270
              + "    };"
-
 
271
              + "  });"
254
              + "}");
272
              + "}");
255
        } catch (Exception e) {
273
        } catch (Exception e) {
256
            LOGGER.warn("Could not install the response capture hook: " + e.getMessage());
274
            LOGGER.warn("Could not install the response capture hook: " + e.getMessage());
257
        }
275
        }
258
    }
276
    }