fix: fallback to unicode btoa
This commit is contained in:
15
script.js
15
script.js
@@ -309,6 +309,10 @@ function urlWithSlash(url) {
|
|||||||
return url.toString().slice(-1) === '/' ? url : (url + '/');
|
return url.toString().slice(-1) === '/' ? url : (url + '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function utoa(data) {
|
||||||
|
return btoa(unescape(encodeURIComponent(data)));
|
||||||
|
}
|
||||||
|
|
||||||
function installIpa(idx) {
|
function installIpa(idx) {
|
||||||
if (!plistGeneratorUrl) {
|
if (!plistGeneratorUrl) {
|
||||||
document.getElementById('overlay').hidden = false;
|
document.getElementById('overlay').hidden = false;
|
||||||
@@ -316,16 +320,23 @@ function installIpa(idx) {
|
|||||||
}
|
}
|
||||||
const thisServerUrl = location.href.replace(location.hash, '');
|
const thisServerUrl = location.href.replace(location.hash, '');
|
||||||
const entry = entriesToDict(DB[idx]);
|
const entry = entriesToDict(DB[idx]);
|
||||||
var b64 = btoa(JSON.stringify({
|
const json = JSON.stringify({
|
||||||
u: validUrl(entry.ipa_url),
|
u: validUrl(entry.ipa_url),
|
||||||
n: entry.title,
|
n: entry.title,
|
||||||
b: entry.bundleId,
|
b: entry.bundleId,
|
||||||
v: entry.version.split(' ')[0],
|
v: entry.version.split(' ')[0],
|
||||||
i: urlWithSlash(thisServerUrl) + entry.img_url,
|
i: urlWithSlash(thisServerUrl) + entry.img_url,
|
||||||
}, null, 0));
|
}, null, 0)
|
||||||
|
var b64 = '';
|
||||||
|
try {
|
||||||
|
b64 = btoa(json);
|
||||||
|
} catch (error) {
|
||||||
|
b64 = utoa(json);
|
||||||
|
}
|
||||||
while (b64.slice(-1) === '=') {
|
while (b64.slice(-1) === '=') {
|
||||||
b64 = b64.slice(0, -1);
|
b64 = b64.slice(0, -1);
|
||||||
}
|
}
|
||||||
|
// window.open(plistGeneratorUrl + '?d=' + b64);
|
||||||
const plistUrl = plistGeneratorUrl + '%3Fd%3D' + b64; // url encoded "?d="
|
const plistUrl = plistGeneratorUrl + '%3Fd%3D' + b64; // url encoded "?d="
|
||||||
window.open('itms-services://?action=download-manifest&url=' + plistUrl);
|
window.open('itms-services://?action=download-manifest&url=' + plistUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ class PlistServer(BaseHTTPRequestHandler):
|
|||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
try:
|
try:
|
||||||
b64 = self.path.split('?d=')[-1] + '=='
|
b64 = self.path.split('?d=')[-1] + '=='
|
||||||
print(b64decode(b64))
|
|
||||||
data = json.loads(b64decode(b64)) # type: dict
|
data = json.loads(b64decode(b64)) # type: dict
|
||||||
rv = generatePlist(data)
|
rv = generatePlist(data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user