various fixes
This commit is contained in:
parent
4299e138fa
commit
1eea6cc005
9 changed files with 15 additions and 19 deletions
|
@ -99,7 +99,7 @@ class Channel {
|
||||||
const params = new URLSearchParams("");
|
const params = new URLSearchParams("");
|
||||||
params.set("instance", this.info.wellknown);
|
params.set("instance", this.info.wellknown);
|
||||||
const encoded = params.toString();
|
const encoded = params.toString();
|
||||||
text.textContent = `${window.location.protocol}//${window.location.host}/invite/${json.code}?${encoded}`;
|
text.textContent = `${location.origin}/invite/${json.code}?${encoded}`;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -131,7 +131,7 @@ class Localuser {
|
||||||
"compress": !!DecompressionStream,
|
"compress": !!DecompressionStream,
|
||||||
"presence": {
|
"presence": {
|
||||||
"status": "online",
|
"status": "online",
|
||||||
"since": new Date().getTime(),
|
"since": null, //new Date().getTime()
|
||||||
"activities": [],
|
"activities": [],
|
||||||
"afk": false
|
"afk": false
|
||||||
}
|
}
|
||||||
|
@ -1092,7 +1092,7 @@ class Localuser {
|
||||||
guild_id: guildid,
|
guild_id: guildid,
|
||||||
limit: 100,
|
limit: 100,
|
||||||
nonce,
|
nonce,
|
||||||
//presences:true
|
presences: true
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
this.fetchingmembers.set(guildid, true);
|
this.fetchingmembers.set(guildid, true);
|
||||||
|
|
|
@ -200,8 +200,8 @@ async function login(username, password, captcha) {
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const info = JSON.parse(localStorage.getItem("instanceinfo"));
|
const info = JSON.parse(localStorage.getItem("instanceinfo"));
|
||||||
const api = info.login;
|
const api = info.login + (info.login.startsWith("/") ? "/" : "");
|
||||||
return await fetch(api + '/auth/login', options).then(response => response.json())
|
return await fetch(api + 'auth/login', options).then(response => response.json())
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response, response.message);
|
console.log(response, response.message);
|
||||||
if ("Invalid Form Body" === response.message) {
|
if ("Invalid Form Body" === response.message) {
|
||||||
|
|
8
index.js
8
index.js
|
@ -50,13 +50,7 @@ async function getapiurls(str){
|
||||||
async function inviteres(req,res){
|
async function inviteres(req,res){
|
||||||
//console.log(req.rawHeaders);
|
//console.log(req.rawHeaders);
|
||||||
try{
|
try{
|
||||||
let embed=false;
|
let embed=isembed(req.get("User-Agent"));
|
||||||
for(const i in req.rawHeaders){
|
|
||||||
if(req.rawHeaders[i]==="User-Agent"){
|
|
||||||
embed=isembed(req.rawHeaders[1+ +i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!embed){return false};
|
if(!embed){return false};
|
||||||
const code=req.path.split("/")[2];
|
const code=req.path.split("/")[2];
|
||||||
let title="";
|
let title="";
|
||||||
|
|
|
@ -113,7 +113,7 @@ class Channel{
|
||||||
const params=new URLSearchParams("");
|
const params=new URLSearchParams("");
|
||||||
params.set("instance",this.info.wellknown)
|
params.set("instance",this.info.wellknown)
|
||||||
const encoded=params.toString();
|
const encoded=params.toString();
|
||||||
text.textContent=`${window.location.protocol}//${window.location.host}/invite/${json.code}?${encoded}`
|
text.textContent=`${location.origin}/invite/${json.code}?${encoded}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -137,13 +137,14 @@ class Localuser{
|
||||||
"compress": !!DecompressionStream,
|
"compress": !!DecompressionStream,
|
||||||
"presence": {
|
"presence": {
|
||||||
"status": "online",
|
"status": "online",
|
||||||
"since": new Date().getTime(),
|
"since": null,//new Date().getTime()
|
||||||
"activities": [],
|
"activities": [],
|
||||||
"afk": false
|
"afk": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
let ds:DecompressionStream;
|
let ds:DecompressionStream;
|
||||||
let w:WritableStreamDefaultWriter;
|
let w:WritableStreamDefaultWriter;
|
||||||
let r:ReadableStreamDefaultReader;
|
let r:ReadableStreamDefaultReader;
|
||||||
|
@ -1116,7 +1117,7 @@ class Localuser{
|
||||||
guild_id:guildid,
|
guild_id:guildid,
|
||||||
limit:100,
|
limit:100,
|
||||||
nonce,
|
nonce,
|
||||||
//presences:true
|
presences:true
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
this.fetchingmembers.set(guildid,true);
|
this.fetchingmembers.set(guildid,true);
|
||||||
|
|
|
@ -198,8 +198,8 @@ async function login(username:string, password:string, captcha:string){
|
||||||
}}
|
}}
|
||||||
try{
|
try{
|
||||||
const info=JSON.parse(localStorage.getItem("instanceinfo"));
|
const info=JSON.parse(localStorage.getItem("instanceinfo"));
|
||||||
const api=info.login;
|
const api=info.login+(info.login.startsWith("/")?"/":"");
|
||||||
return await fetch(api+'/auth/login',options).then(response=>response.json())
|
return await fetch(api+'auth/login',options).then(response=>response.json())
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response,response.message)
|
console.log(response,response.message)
|
||||||
if("Invalid Form Body"===response.message){
|
if("Invalid Form Body"===response.message){
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<div>
|
<div>
|
||||||
<label for="instance"><b>Instance:</b></label><br>
|
<label for="instance"><b>Instance:</b></label><br>
|
||||||
<p id="verify"></p>
|
<p id="verify"></p>
|
||||||
<input type="text" placeholder="Instance URL" id="instance" name="instance" value="https://spacebar.chat/" id="instancein" required>
|
<input type="text" placeholder="Instance URL" id="instancein" name="instance" value="https://spacebar.chat/" id="instancein" required>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="uname"><b>Email:</b></label><br>
|
<label for="uname"><b>Email:</b></label><br>
|
||||||
|
|
|
@ -58,7 +58,8 @@ class User{
|
||||||
body:JSON.stringify({"recipients":[this.id]}),
|
body:JSON.stringify({"recipients":[this.id]}),
|
||||||
headers: this.localuser.headers
|
headers: this.localuser.headers
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
static clear(){
|
static clear(){
|
||||||
this.userids={};
|
this.userids={};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue