feat: support non-rooted device
This commit is contained in:
31
userscripts/ferdium/vencord.user.js
Normal file
31
userscripts/ferdium/vencord.user.js
Normal file
@ -0,0 +1,31 @@
|
||||
// Vencord polyfills for loading in Ferdium
|
||||
|
||||
function GM_xmlhttpRequest(details) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open(details.method, details.url, true, details.password);
|
||||
xhr.responseType = details.responseType || 'text';
|
||||
xhr.timeout = details.timeout || 0;
|
||||
if (details.headers) {
|
||||
for (const [name, value] of Object.entries(details.headers)) {
|
||||
xhr.setRequestHeader(name, value);
|
||||
}
|
||||
}
|
||||
// Events
|
||||
xhr.onabort = details.onabort;
|
||||
xhr.onerror = details.onerror;
|
||||
xhr.onload = details.onload;
|
||||
xhr.onloadend = details.onloadend;
|
||||
xhr.onloadstart = details.onloadstart;
|
||||
xhr.onprogress = details.onprogress;
|
||||
xhr.onreadystatechange = details.onreadystatechange;
|
||||
xhr.ontimeout = details.ontimeout;
|
||||
// Missing fields: anonymous
|
||||
xhr.send(details.data);
|
||||
return {
|
||||
abort: () => xhr.abort(),
|
||||
}
|
||||
}
|
||||
window.GM_xmlhttpRequest = GM_xmlhttpRequest;
|
||||
window.unsafeWindow = window;
|
||||
document.head.innerHTML += `<meta http-equiv="Content-Security-Policy" content="default-src * self blob: data: gap:; style-src * self 'unsafe-inline' blob: data: gap:; script-src * 'self' 'unsafe-eval' 'unsafe-inline' blob: data: gap:; object-src * 'self' blob: data: gap:; img-src * self 'unsafe-inline' blob: data: gap:; connect-src self * 'unsafe-inline' blob: data: gap:; frame-src * self blob: data: gap:;">`;
|
||||
eval(await (await fetch("https://raw.githubusercontent.com/Vencord/builds/main/Vencord.user.js")).text());
|
||||
Reference in New Issue
Block a user