mirror of
https://github.com/ItsVipra/ProToots
synced 2025-02-16 12:38:23 +00:00
Merge branch 'main' of https://github.com/itsvipra/protoots
This commit is contained in:
commit
74daa5d94a
1 changed files with 23 additions and 18 deletions
|
@ -14,24 +14,29 @@ const host_name = location.host;
|
|||
checkSite();
|
||||
let logging;
|
||||
|
||||
function error() {
|
||||
if (logging) console.error(arguments);
|
||||
/** @param {any[]} arguments */
|
||||
function error(...arguments) {
|
||||
if (logging) console.error(...arguments);
|
||||
}
|
||||
|
||||
function warn() {
|
||||
if (logging) console.warn(arguments);
|
||||
/** @param {any[]} arguments */
|
||||
function warn(...arguments) {
|
||||
if (logging) console.warn(...arguments);
|
||||
}
|
||||
|
||||
function log() {
|
||||
if (logging) console.log(arguments);
|
||||
/** @param {any[]} arguments */
|
||||
function log(...arguments) {
|
||||
if (logging) console.log(...arguments);
|
||||
}
|
||||
|
||||
function info() {
|
||||
if (logging) console.info(arguments);
|
||||
/** @param {any[]} arguments */
|
||||
function info(...arguments) {
|
||||
if (logging) console.info(...arguments);
|
||||
}
|
||||
|
||||
function debug() {
|
||||
if (logging) console.debug(arguments);
|
||||
/** @param {any[]} arguments */
|
||||
function debug(...arguments) {
|
||||
if (logging) console.debug(...arguments);
|
||||
}
|
||||
|
||||
// log("hey vippy, du bist cute <3")
|
||||
|
@ -41,14 +46,14 @@ function debug() {
|
|||
* If so creates an 'readystatechange' EventListener, with callback to main()
|
||||
*/
|
||||
async function checkSite() {
|
||||
await browser.storage.sync.get("logging").then(
|
||||
(res) => {
|
||||
logging = res["logging"];
|
||||
},
|
||||
() => {
|
||||
logging = true;
|
||||
},
|
||||
);
|
||||
try {
|
||||
let { logging: optionValue } = await browser.storage.sync.get("logging");
|
||||
logging = optionValue;
|
||||
} catch {
|
||||
// Enable the logging automatically if we cannot determine the user preference.
|
||||
logging = true;
|
||||
}
|
||||
|
||||
let requestDest = location.protocol + "//" + host_name + "/api/v1/instance";
|
||||
let response = await fetch(requestDest);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue