Fix html elements proxying; Fix polyfills
This commit is contained in:
parent
95425df2ab
commit
fd0695e133
|
@ -14,6 +14,12 @@ var ApiStatic = {Servers: {}, Featured: {},};
|
||||||
ApiStatic.Servers[Serv] = {ServerSoftware: "Misskey"};
|
ApiStatic.Servers[Serv] = {ServerSoftware: "Misskey"};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//[ "https://pixelfed.uno",
|
||||||
|
// "https://pixelfed.social"
|
||||||
|
//].forEach(function(Serv){
|
||||||
|
// ApiStatic.Servers[Serv] = {ServerSoftware: "Pixelfed"};
|
||||||
|
//});
|
||||||
|
|
||||||
ApiStatic.Featured.Servers = [];
|
ApiStatic.Featured.Servers = [];
|
||||||
Object.keys(ApiStatic.Servers).forEach(function(Url){
|
Object.keys(ApiStatic.Servers).forEach(function(Url){
|
||||||
var Serv = ApiStatic.Servers[Url];
|
var Serv = ApiStatic.Servers[Url];
|
||||||
|
|
|
@ -15,7 +15,7 @@ var FriendicaCredentials = 'redacted:redacted';
|
||||||
var Debug = true;
|
var Debug = true;
|
||||||
var UseFakeApi = false;
|
var UseFakeApi = false;
|
||||||
|
|
||||||
var HttpProxy = /*'';*/ 'http://localhost:44380/';
|
var HttpProxy = ''; /*'http://localhost:44380/';*/
|
||||||
var ProxyStrictMode = true;
|
var ProxyStrictMode = true;
|
||||||
</script>
|
</script>
|
||||||
<script data-build-json="true">
|
<script data-build-json="true">
|
||||||
|
|
16
App/Main.js
16
App/Main.js
|
@ -117,17 +117,7 @@ function DisplayProfile(Profile) {
|
||||||
Profile = UrlObj(Profile, DisplayProfile);
|
Profile = UrlObj(Profile, DisplayProfile);
|
||||||
//if (Profile) {
|
//if (Profile) {
|
||||||
var Window = MkWindow({className: "Profile"});
|
var Window = MkWindow({className: "Profile"});
|
||||||
Window.innerHTML += `<div class="Profile" style="display: inline-block;">
|
Window.innerHTML += Templating.ViewProfile(Profile);
|
||||||
<a href="${Profile.Url}">
|
|
||||||
<div>
|
|
||||||
<img class="" src="${Profile.Banner}"/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<img class="" src="${Profile.Icon}"/>
|
|
||||||
${Profile.Name}
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>`;
|
|
||||||
// TODO: Handle fetching notes of non-standard profiles like servers timelines
|
// TODO: Handle fetching notes of non-standard profiles like servers timelines
|
||||||
DoAsync(FetchNotes, FillTimeline, Profile);
|
DoAsync(FetchNotes, FillTimeline, Profile);
|
||||||
//};
|
//};
|
||||||
|
@ -182,9 +172,9 @@ function FillHome() {
|
||||||
var Rnd = RndHtmlId();
|
var Rnd = RndHtmlId();
|
||||||
Window.querySelector('ul').innerHTML += `<li id="${Rnd}">
|
Window.querySelector('ul').innerHTML += `<li id="${Rnd}">
|
||||||
<a href="${Profile.Url}" onclick="DisplayProfile('${Profile.Url}'); return false;">
|
<a href="${Profile.Url}" onclick="DisplayProfile('${Profile.Url}'); return false;">
|
||||||
<img class="Profile Banner" data-assign="src=Banner" src="${Profile.Banner}"/>
|
<img class="Profile Banner" data-assign="src=Banner" src="${MkUrl(Profile.Banner)}"/>
|
||||||
<div>
|
<div>
|
||||||
<img class="Profile Icon" data-assign="src=Icon" src="${Profile.Icon}"/>
|
<img class="Profile Icon" data-assign="src=Icon" src="${MkUrl(Profile.Icon)}"/>
|
||||||
<span data-assign="innerHTML=Name">${Profile.Url}</span>
|
<span data-assign="innerHTML=Name">${Profile.Url}</span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -53,7 +53,7 @@ function IsHttpCodeGood(Code) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function MkUrl(Url) {
|
function MkUrl(Url) {
|
||||||
if (!Url.toLowerCase().startsWith(HttpProxy)) {
|
if (Url && !Url.toLowerCase().startsWith(HttpProxy)) {
|
||||||
Url = HttpProxy + Url;
|
Url = HttpProxy + Url;
|
||||||
};
|
};
|
||||||
return Url;
|
return Url;
|
||||||
|
|
|
@ -1,491 +0,0 @@
|
||||||
/**
|
|
||||||
* URL Polyfill
|
|
||||||
* Draft specification: https://url.spec.whatwg.org
|
|
||||||
* https://polyfill.io/
|
|
||||||
*/
|
|
||||||
(function (global) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function isSequence(o) {
|
|
||||||
if (!o) return false;
|
|
||||||
if ('Symbol' in global && 'iterator' in global.Symbol &&
|
|
||||||
typeof o[Symbol.iterator] === 'function') return true;
|
|
||||||
if (Array.isArray(o)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toArray(iter) {
|
|
||||||
return ('from' in Array) ? Array.from(iter) : Array.prototype.slice.call(iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
// Browsers may have:
|
|
||||||
// * No global URL object
|
|
||||||
// * URL with static methods only - may have a dummy constructor
|
|
||||||
// * URL with members except searchParams
|
|
||||||
// * Full URL API support
|
|
||||||
var origURL = global.URL;
|
|
||||||
var nativeURL;
|
|
||||||
try {
|
|
||||||
if (origURL) {
|
|
||||||
nativeURL = new global.URL('http://example.com');
|
|
||||||
if ('searchParams' in nativeURL) {
|
|
||||||
var url = new URL('http://example.com');
|
|
||||||
url.search = 'a=1&b=2';
|
|
||||||
if (url.href === 'http://example.com/?a=1&b=2') {
|
|
||||||
url.search = '';
|
|
||||||
if (url.href === 'http://example.com/') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!('href' in nativeURL)) {
|
|
||||||
nativeURL = undefined;
|
|
||||||
}
|
|
||||||
nativeURL = undefined;
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line no-empty
|
|
||||||
} catch (_) {}
|
|
||||||
|
|
||||||
// NOTE: Doesn't do the encoding/decoding dance
|
|
||||||
function urlencoded_serialize(pairs) {
|
|
||||||
var output = '', first = true;
|
|
||||||
pairs.forEach(function (pair) {
|
|
||||||
var name = encodeURIComponent(pair.name);
|
|
||||||
var value = encodeURIComponent(pair.value);
|
|
||||||
if (!first) output += '&';
|
|
||||||
output += name + '=' + value;
|
|
||||||
first = false;
|
|
||||||
});
|
|
||||||
return output.replace(/%20/g, '+');
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Doesn't do the encoding/decoding dance
|
|
||||||
function urlencoded_parse(input, isindex) {
|
|
||||||
var sequences = input.split('&');
|
|
||||||
if (isindex && sequences[0].indexOf('=') === -1)
|
|
||||||
sequences[0] = '=' + sequences[0];
|
|
||||||
var pairs = [];
|
|
||||||
sequences.forEach(function (bytes) {
|
|
||||||
if (bytes.length === 0) return;
|
|
||||||
var index = bytes.indexOf('=');
|
|
||||||
if (index !== -1) {
|
|
||||||
var name = bytes.substring(0, index);
|
|
||||||
var value = bytes.substring(index + 1);
|
|
||||||
} else {
|
|
||||||
name = bytes;
|
|
||||||
value = '';
|
|
||||||
}
|
|
||||||
name = name.replace(/\+/g, ' ');
|
|
||||||
value = value.replace(/\+/g, ' ');
|
|
||||||
pairs.push({ name: name, value: value });
|
|
||||||
});
|
|
||||||
var output = [];
|
|
||||||
pairs.forEach(function (pair) {
|
|
||||||
output.push({
|
|
||||||
name: decodeURIComponent(pair.name),
|
|
||||||
value: decodeURIComponent(pair.value)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
function URLUtils(url) {
|
|
||||||
if (nativeURL)
|
|
||||||
return new origURL(url);
|
|
||||||
var anchor = document.createElement('a');
|
|
||||||
anchor.href = url;
|
|
||||||
return anchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
function URLSearchParams(init) {
|
|
||||||
var $this = this;
|
|
||||||
this._list = [];
|
|
||||||
|
|
||||||
if (init === undefined || init === null) {
|
|
||||||
// no-op
|
|
||||||
} else if (init instanceof URLSearchParams) {
|
|
||||||
// In ES6 init would be a sequence, but special case for ES5.
|
|
||||||
this._list = urlencoded_parse(String(init));
|
|
||||||
} else if (typeof init === 'object' && isSequence(init)) {
|
|
||||||
toArray(init).forEach(function(e) {
|
|
||||||
if (!isSequence(e)) throw TypeError();
|
|
||||||
var nv = toArray(e);
|
|
||||||
if (nv.length !== 2) throw TypeError();
|
|
||||||
$this._list.push({name: String(nv[0]), value: String(nv[1])});
|
|
||||||
});
|
|
||||||
} else if (typeof init === 'object' && init) {
|
|
||||||
Object.keys(init).forEach(function(key) {
|
|
||||||
$this._list.push({name: String(key), value: String(init[key])});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
init = String(init);
|
|
||||||
if (init.substring(0, 1) === '?')
|
|
||||||
init = init.substring(1);
|
|
||||||
this._list = urlencoded_parse(init);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._url_object = null;
|
|
||||||
this._setList = function (list) { if (!updating) $this._list = list; };
|
|
||||||
|
|
||||||
var updating = false;
|
|
||||||
this._update_steps = function() {
|
|
||||||
if (updating) return;
|
|
||||||
updating = true;
|
|
||||||
|
|
||||||
if (!$this._url_object) return;
|
|
||||||
|
|
||||||
// Partial workaround for IE issue with 'about:'
|
|
||||||
if ($this._url_object.protocol === 'about:' &&
|
|
||||||
$this._url_object.pathname.indexOf('?') !== -1) {
|
|
||||||
$this._url_object.pathname = $this._url_object.pathname.split('?')[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this._url_object.search = urlencoded_serialize($this._list);
|
|
||||||
|
|
||||||
updating = false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Object.defineProperties(URLSearchParams.prototype, {
|
|
||||||
append: {
|
|
||||||
value: function (name, value) {
|
|
||||||
this._list.push({ name: name, value: value });
|
|
||||||
this._update_steps();
|
|
||||||
}, writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
'delete': {
|
|
||||||
value: function (name) {
|
|
||||||
for (var i = 0; i < this._list.length;) {
|
|
||||||
if (this._list[i].name === name)
|
|
||||||
this._list.splice(i, 1);
|
|
||||||
else
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
this._update_steps();
|
|
||||||
}, writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
get: {
|
|
||||||
value: function (name) {
|
|
||||||
for (var i = 0; i < this._list.length; ++i) {
|
|
||||||
if (this._list[i].name === name)
|
|
||||||
return this._list[i].value;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}, writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
getAll: {
|
|
||||||
value: function (name) {
|
|
||||||
var result = [];
|
|
||||||
for (var i = 0; i < this._list.length; ++i) {
|
|
||||||
if (this._list[i].name === name)
|
|
||||||
result.push(this._list[i].value);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}, writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
has: {
|
|
||||||
value: function (name) {
|
|
||||||
for (var i = 0; i < this._list.length; ++i) {
|
|
||||||
if (this._list[i].name === name)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}, writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
set: {
|
|
||||||
value: function (name, value) {
|
|
||||||
var found = false;
|
|
||||||
for (var i = 0; i < this._list.length;) {
|
|
||||||
if (this._list[i].name === name) {
|
|
||||||
if (!found) {
|
|
||||||
this._list[i].value = value;
|
|
||||||
found = true;
|
|
||||||
++i;
|
|
||||||
} else {
|
|
||||||
this._list.splice(i, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
this._list.push({ name: name, value: value });
|
|
||||||
|
|
||||||
this._update_steps();
|
|
||||||
}, writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
entries: {
|
|
||||||
value: function() { return new Iterator(this._list, 'key+value'); },
|
|
||||||
writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
keys: {
|
|
||||||
value: function() { return new Iterator(this._list, 'key'); },
|
|
||||||
writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
values: {
|
|
||||||
value: function() { return new Iterator(this._list, 'value'); },
|
|
||||||
writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
forEach: {
|
|
||||||
value: function(callback) {
|
|
||||||
var thisArg = (arguments.length > 1) ? arguments[1] : undefined;
|
|
||||||
this._list.forEach(function(pair) {
|
|
||||||
callback.call(thisArg, pair.value, pair.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
}, writable: true, enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
|
|
||||||
toString: {
|
|
||||||
value: function () {
|
|
||||||
return urlencoded_serialize(this._list);
|
|
||||||
}, writable: true, enumerable: false, configurable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function Iterator(source, kind) {
|
|
||||||
var index = 0;
|
|
||||||
this.next = function() {
|
|
||||||
if (index >= source.length)
|
|
||||||
return {done: true, value: undefined};
|
|
||||||
var pair = source[index++];
|
|
||||||
return {done: false, value:
|
|
||||||
kind === 'key' ? pair.name :
|
|
||||||
kind === 'value' ? pair.value :
|
|
||||||
[pair.name, pair.value]};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('Symbol' in global && 'iterator' in global.Symbol) {
|
|
||||||
Object.defineProperty(URLSearchParams.prototype, global.Symbol.iterator, {
|
|
||||||
value: URLSearchParams.prototype.entries,
|
|
||||||
writable: true, enumerable: true, configurable: true});
|
|
||||||
Object.defineProperty(Iterator.prototype, global.Symbol.iterator, {
|
|
||||||
value: function() { return this; },
|
|
||||||
writable: true, enumerable: true, configurable: true});
|
|
||||||
}
|
|
||||||
|
|
||||||
function URL(url, base) {
|
|
||||||
if (!(this instanceof global.URL))
|
|
||||||
throw new TypeError("Failed to construct 'URL': Please use the 'new' operator.");
|
|
||||||
|
|
||||||
if (base) {
|
|
||||||
url = (function () {
|
|
||||||
if (nativeURL) return new origURL(url, base).href;
|
|
||||||
var iframe;
|
|
||||||
try {
|
|
||||||
var doc;
|
|
||||||
// Use another document/base tag/anchor for relative URL resolution, if possible
|
|
||||||
if (Object.prototype.toString.call(window.operamini) === "[object OperaMini]") {
|
|
||||||
iframe = document.createElement('iframe');
|
|
||||||
iframe.style.display = 'none';
|
|
||||||
document.documentElement.appendChild(iframe);
|
|
||||||
doc = iframe.contentWindow.document;
|
|
||||||
} else if (document.implementation && document.implementation.createHTMLDocument) {
|
|
||||||
doc = document.implementation.createHTMLDocument('');
|
|
||||||
} else if (document.implementation && document.implementation.createDocument) {
|
|
||||||
doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null);
|
|
||||||
doc.documentElement.appendChild(doc.createElement('head'));
|
|
||||||
doc.documentElement.appendChild(doc.createElement('body'));
|
|
||||||
} else if (window.ActiveXObject) {
|
|
||||||
doc = new window.ActiveXObject('htmlfile');
|
|
||||||
doc.write('<head></head><body></body>');
|
|
||||||
doc.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!doc) throw Error('base not supported');
|
|
||||||
|
|
||||||
var baseTag = doc.createElement('base');
|
|
||||||
baseTag.href = base;
|
|
||||||
doc.getElementsByTagName('head')[0].appendChild(baseTag);
|
|
||||||
var anchor = doc.createElement('a');
|
|
||||||
anchor.href = url;
|
|
||||||
return anchor.href;
|
|
||||||
} finally {
|
|
||||||
if (iframe)
|
|
||||||
iframe.parentNode.removeChild(iframe);
|
|
||||||
}
|
|
||||||
}());
|
|
||||||
}
|
|
||||||
|
|
||||||
// An inner object implementing URLUtils (either a native URL
|
|
||||||
// object or an HTMLAnchorElement instance) is used to perform the
|
|
||||||
// URL algorithms. With full ES5 getter/setter support, return a
|
|
||||||
// regular object For IE8's limited getter/setter support, a
|
|
||||||
// different HTMLAnchorElement is returned with properties
|
|
||||||
// overridden
|
|
||||||
|
|
||||||
var instance = URLUtils(url || '');
|
|
||||||
|
|
||||||
// Detect for ES5 getter/setter support
|
|
||||||
// (an Object.defineProperties polyfill that doesn't support getters/setters may throw)
|
|
||||||
var ES5_GET_SET = (function() {
|
|
||||||
if (!('defineProperties' in Object)) return false;
|
|
||||||
try {
|
|
||||||
var obj = {};
|
|
||||||
Object.defineProperties(obj, { prop: { get: function () { return true; } } });
|
|
||||||
return obj.prop;
|
|
||||||
} catch (_) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}());
|
|
||||||
|
|
||||||
var self = ES5_GET_SET ? this : document.createElement('a');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var query_object = new URLSearchParams(
|
|
||||||
instance.search ? instance.search.substring(1) : null);
|
|
||||||
query_object._url_object = self;
|
|
||||||
|
|
||||||
Object.defineProperties(self, {
|
|
||||||
href: {
|
|
||||||
get: function () { return instance.href; },
|
|
||||||
set: function (v) { instance.href = v; tidy_instance(); update_steps(); },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
origin: {
|
|
||||||
get: function () {
|
|
||||||
if ('origin' in instance) return instance.origin;
|
|
||||||
return this.protocol + '//' + this.host;
|
|
||||||
},
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
protocol: {
|
|
||||||
get: function () { return instance.protocol; },
|
|
||||||
set: function (v) { instance.protocol = v; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
username: {
|
|
||||||
get: function () { return instance.username; },
|
|
||||||
set: function (v) { instance.username = v; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
password: {
|
|
||||||
get: function () { return instance.password; },
|
|
||||||
set: function (v) { instance.password = v; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
host: {
|
|
||||||
get: function () {
|
|
||||||
// IE returns default port in |host|
|
|
||||||
var re = {'http:': /:80$/, 'https:': /:443$/, 'ftp:': /:21$/}[instance.protocol];
|
|
||||||
return re ? instance.host.replace(re, '') : instance.host;
|
|
||||||
},
|
|
||||||
set: function (v) { instance.host = v; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
hostname: {
|
|
||||||
get: function () { return instance.hostname; },
|
|
||||||
set: function (v) { instance.hostname = v; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
port: {
|
|
||||||
get: function () { return instance.port; },
|
|
||||||
set: function (v) { instance.port = v; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
pathname: {
|
|
||||||
get: function () {
|
|
||||||
// IE does not include leading '/' in |pathname|
|
|
||||||
if (instance.pathname.charAt(0) !== '/') return '/' + instance.pathname;
|
|
||||||
return instance.pathname;
|
|
||||||
},
|
|
||||||
set: function (v) { instance.pathname = v; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
search: {
|
|
||||||
get: function () { return instance.search; },
|
|
||||||
set: function (v) {
|
|
||||||
if (instance.search === v) return;
|
|
||||||
instance.search = v; tidy_instance(); update_steps();
|
|
||||||
},
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
searchParams: {
|
|
||||||
get: function () { return query_object; },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
hash: {
|
|
||||||
get: function () { return instance.hash; },
|
|
||||||
set: function (v) { instance.hash = v; tidy_instance(); },
|
|
||||||
enumerable: true, configurable: true
|
|
||||||
},
|
|
||||||
toString: {
|
|
||||||
value: function() { return instance.toString(); },
|
|
||||||
enumerable: false, configurable: true
|
|
||||||
},
|
|
||||||
valueOf: {
|
|
||||||
value: function() { return instance.valueOf(); },
|
|
||||||
enumerable: false, configurable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function tidy_instance() {
|
|
||||||
var href = instance.href.replace(/#$|\?$|\?(?=#)/g, '');
|
|
||||||
if (instance.href !== href)
|
|
||||||
instance.href = href;
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_steps() {
|
|
||||||
query_object._setList(instance.search ? urlencoded_parse(instance.search.substring(1)) : []);
|
|
||||||
query_object._update_steps();
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (origURL) {
|
|
||||||
for (var i in origURL) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(origURL, i) && typeof origURL[i] === 'function')
|
|
||||||
URL[i] = origURL[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
global.URL = URL;
|
|
||||||
global.URLSearchParams = URLSearchParams;
|
|
||||||
}());
|
|
||||||
|
|
||||||
// Patch native URLSearchParams constructor to handle sequences/records
|
|
||||||
// if necessary.
|
|
||||||
(function() {
|
|
||||||
if (new global.URLSearchParams([['a', 1]]).get('a') === '1' &&
|
|
||||||
new global.URLSearchParams({a: 1}).get('a') === '1')
|
|
||||||
return;
|
|
||||||
var orig = global.URLSearchParams;
|
|
||||||
global.URLSearchParams = function(init) {
|
|
||||||
if (init && typeof init === 'object' && isSequence(init)) {
|
|
||||||
var o = new orig();
|
|
||||||
toArray(init).forEach(function(e) {
|
|
||||||
if (!isSequence(e)) throw TypeError();
|
|
||||||
var nv = toArray(e);
|
|
||||||
if (nv.length !== 2) throw TypeError();
|
|
||||||
o.append(nv[0], nv[1]);
|
|
||||||
});
|
|
||||||
return o;
|
|
||||||
} else if (init && typeof init === 'object') {
|
|
||||||
o = new orig();
|
|
||||||
Object.keys(init).forEach(function(key) {
|
|
||||||
o.set(key, init[key]);
|
|
||||||
});
|
|
||||||
return o;
|
|
||||||
} else {
|
|
||||||
return new orig(init);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}());
|
|
||||||
|
|
||||||
}(self));
|
|
|
@ -2,12 +2,25 @@ var Templating = {
|
||||||
ViewNote(Note) {
|
ViewNote(Note) {
|
||||||
return `<div class="View Note">
|
return `<div class="View Note">
|
||||||
<a href="${Note.Profile.Url}" onclick="DisplayProfile('${Note.Profile.Url}'); return false;">
|
<a href="${Note.Profile.Url}" onclick="DisplayProfile('${Note.Profile.Url}'); return false;">
|
||||||
<img class="Profile Icon" src="${Note.Profile.Icon}"/>
|
<img class="Profile Icon" src="${MkUrl(Note.Profile.Icon)}"/>
|
||||||
${Note.Profile.Name}
|
${Note.Profile.Name}
|
||||||
</a>
|
</a>
|
||||||
${Note.Content ? Note.Content : 'renoted:'}
|
<div class="Note Content">
|
||||||
${Note.Quoting ? Templating.ViewNote(Note.Quoting) : ''}
|
${Note.Content ? Note.Content : 'renoted:'}
|
||||||
|
${Note.Quoting ? Templating.ViewNote(Note.Quoting) : ''}
|
||||||
|
</div>
|
||||||
<a href="${Note.Url}" onclick="DisplayThread('${Note.Url}'); return false;">${Note.Time}</a>
|
<a href="${Note.Url}" onclick="DisplayThread('${Note.Url}'); return false;">${Note.Time}</a>
|
||||||
</div>`;
|
</div>`;
|
||||||
},
|
},
|
||||||
|
ViewProfile(Profile) {
|
||||||
|
return `<div class="View Profile" style="display: inline-block;">
|
||||||
|
<a href="${Profile.Url}">
|
||||||
|
<img class="Profile Banner" src="${MkUrl(Profile.Banner)}"/>
|
||||||
|
<div>
|
||||||
|
<img class="Profile Icon" src="${MkUrl(Profile.Icon)}"/>
|
||||||
|
${Profile.Name}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>`;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,13 +4,11 @@ const Port = 44380;
|
||||||
const Blacklist = [];
|
const Blacklist = [];
|
||||||
const Whitelist = [];
|
const Whitelist = [];
|
||||||
|
|
||||||
//const cors_proxy = require('./lib/cors-anywhere');
|
|
||||||
/*cors_proxy*/
|
|
||||||
require('./node_modules/cors-anywhere/lib/cors-anywhere').createServer({
|
require('./node_modules/cors-anywhere/lib/cors-anywhere').createServer({
|
||||||
originBlacklist: Blacklist,
|
originBlacklist: Blacklist,
|
||||||
originWhitelist: Whitelist,
|
originWhitelist: Whitelist,
|
||||||
removeHeaders: ['cookie', 'cookie2'],
|
|
||||||
redirectSameOrigin: true,
|
redirectSameOrigin: true,
|
||||||
|
httpProxyOptions: {xfwd: false},
|
||||||
}).listen(Port, Host, function() {
|
}).listen(Port, Host, function() {
|
||||||
console.log(`Running proxy on ${Host}:${Port}`);
|
console.log(`Running proxy on ${Host}:${Port}`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,5 +12,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"./App/Polyfill/1.core-js-bundle.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
"@babel/cli": "^7.21.0",
|
"@babel/cli": "^7.21.0",
|
||||||
"@babel/core": "^7.21.4",
|
"@babel/core": "^7.21.4",
|
||||||
"@babel/preset-env": "^7.21.4",
|
"@babel/preset-env": "^7.21.4",
|
||||||
"cors-anywhere": "^0.4.4"
|
"cors-anywhere": "^0.4.4",
|
||||||
|
"http-proxy": "^1.18.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
|
@ -1953,6 +1954,31 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cors-anywhere/node_modules/eventemitter3": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-DOFqA1MF46fmZl2xtzXR3MPCRsXqgoFqdXcrCVYM3JNnfUeHTm/fh/v/iU7gBFpwkuBmoJPAm5GuhdDfSEJMJA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/cors-anywhere/node_modules/http-proxy": {
|
||||||
|
"version": "1.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.11.1.tgz",
|
||||||
|
"integrity": "sha512-qz7jZarkVG3G6GMq+4VRJPSN4NkIjL4VMTNhKGd8jc25BumeJjWWvnY3A7OkCGa8W1TTxbaK3dcE0ijFalITVA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"eventemitter3": "1.x.x",
|
||||||
|
"requires-port": "0.x.x"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cors-anywhere/node_modules/requires-port": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-0.0.1.tgz",
|
||||||
|
"integrity": "sha512-AzPDCliPoWDSvEVYRQmpzuPhGGEnPrQz9YiOEvn+UdB9ixBpw+4IOZWtwctmpzySLZTy7ynpn47V14H4yaowtA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
|
@ -2004,9 +2030,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eventemitter3": {
|
"node_modules/eventemitter3": {
|
||||||
"version": "1.2.0",
|
"version": "4.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
"integrity": "sha512-DOFqA1MF46fmZl2xtzXR3MPCRsXqgoFqdXcrCVYM3JNnfUeHTm/fh/v/iU7gBFpwkuBmoJPAm5GuhdDfSEJMJA==",
|
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/fill-range": {
|
"node_modules/fill-range": {
|
||||||
|
@ -2022,6 +2048,26 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.15.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||||
|
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fs-readdir-recursive": {
|
"node_modules/fs-readdir-recursive": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz",
|
||||||
|
@ -2127,16 +2173,17 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/http-proxy": {
|
"node_modules/http-proxy": {
|
||||||
"version": "1.11.1",
|
"version": "1.18.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
||||||
"integrity": "sha512-qz7jZarkVG3G6GMq+4VRJPSN4NkIjL4VMTNhKGd8jc25BumeJjWWvnY3A7OkCGa8W1TTxbaK3dcE0ijFalITVA==",
|
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"eventemitter3": "1.x.x",
|
"eventemitter3": "^4.0.0",
|
||||||
"requires-port": "0.x.x"
|
"follow-redirects": "^1.0.0",
|
||||||
|
"requires-port": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=8.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/inflight": {
|
"node_modules/inflight": {
|
||||||
|
@ -2457,9 +2504,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/requires-port": {
|
"node_modules/requires-port": {
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||||
"integrity": "sha512-AzPDCliPoWDSvEVYRQmpzuPhGGEnPrQz9YiOEvn+UdB9ixBpw+4IOZWtwctmpzySLZTy7ynpn47V14H4yaowtA==",
|
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
|
@ -3983,6 +4030,30 @@
|
||||||
"requires": {
|
"requires": {
|
||||||
"http-proxy": "1.11.1",
|
"http-proxy": "1.11.1",
|
||||||
"proxy-from-env": "0.0.1"
|
"proxy-from-env": "0.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"eventemitter3": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-DOFqA1MF46fmZl2xtzXR3MPCRsXqgoFqdXcrCVYM3JNnfUeHTm/fh/v/iU7gBFpwkuBmoJPAm5GuhdDfSEJMJA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"http-proxy": {
|
||||||
|
"version": "1.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.11.1.tgz",
|
||||||
|
"integrity": "sha512-qz7jZarkVG3G6GMq+4VRJPSN4NkIjL4VMTNhKGd8jc25BumeJjWWvnY3A7OkCGa8W1TTxbaK3dcE0ijFalITVA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"eventemitter3": "1.x.x",
|
||||||
|
"requires-port": "0.x.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"requires-port": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-0.0.1.tgz",
|
||||||
|
"integrity": "sha512-AzPDCliPoWDSvEVYRQmpzuPhGGEnPrQz9YiOEvn+UdB9ixBpw+4IOZWtwctmpzySLZTy7ynpn47V14H4yaowtA==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
|
@ -4019,9 +4090,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eventemitter3": {
|
"eventemitter3": {
|
||||||
"version": "1.2.0",
|
"version": "4.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
"integrity": "sha512-DOFqA1MF46fmZl2xtzXR3MPCRsXqgoFqdXcrCVYM3JNnfUeHTm/fh/v/iU7gBFpwkuBmoJPAm5GuhdDfSEJMJA==",
|
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"fill-range": {
|
"fill-range": {
|
||||||
|
@ -4034,6 +4105,12 @@
|
||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.15.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||||
|
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"fs-readdir-recursive": {
|
"fs-readdir-recursive": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz",
|
||||||
|
@ -4111,13 +4188,14 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"http-proxy": {
|
"http-proxy": {
|
||||||
"version": "1.11.1",
|
"version": "1.18.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
||||||
"integrity": "sha512-qz7jZarkVG3G6GMq+4VRJPSN4NkIjL4VMTNhKGd8jc25BumeJjWWvnY3A7OkCGa8W1TTxbaK3dcE0ijFalITVA==",
|
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"eventemitter3": "1.x.x",
|
"eventemitter3": "^4.0.0",
|
||||||
"requires-port": "0.x.x"
|
"follow-redirects": "^1.0.0",
|
||||||
|
"requires-port": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"inflight": {
|
"inflight": {
|
||||||
|
@ -4376,9 +4454,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requires-port": {
|
"requires-port": {
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||||
"integrity": "sha512-AzPDCliPoWDSvEVYRQmpzuPhGGEnPrQz9YiOEvn+UdB9ixBpw+4IOZWtwctmpzySLZTy7ynpn47V14H4yaowtA==",
|
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"@babel/cli": "^7.21.0",
|
"@babel/cli": "^7.21.0",
|
||||||
"@babel/core": "^7.21.4",
|
"@babel/core": "^7.21.4",
|
||||||
"@babel/preset-env": "^7.21.4",
|
"@babel/preset-env": "^7.21.4",
|
||||||
|
"http-proxy": "^1.18.1",
|
||||||
"cors-anywhere": "^0.4.4"
|
"cors-anywhere": "^0.4.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue