Skip to content

Commit

Permalink
Transition to real server and some bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomgcd committed Jun 23, 2021
1 parent 9af2c8d commit d91cf92
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion appdashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export class AppDashboard extends App{
}
try{
await doIt();
}catch(error){
}catch(error){
await ControlDialogOk.showAndWait({title:"Error Loading Join Desktop",text:`Couldn't load the app. (${error}). Please check your connection and try again.`,timeout:30000})
}
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Join</title>
<script>
// self.joinServer = "http://localhost:8080/";
self.joinServer = "https://testsjoaomgcd.appspot.com/";
self.joinServer = "https://joinjoaomgcd.appspot.com/";
</script>
<meta charset="utf-8"/>
<meta name="description" content="Bring your devices together">
Expand Down
2 changes: 2 additions & 0 deletions v2/api/apiserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const deleteAutorization = async (endpoint,parameters) => await del(`${JOIN_BASE
export class ApiServer{
static async getDevices(){
const result = await getRegistration("listDevices");
if(!result.success) throw Error(result.errorMessage);

return result.records;
// const result = await gapi.client.registration.listDevices();
// const devicesRaw = result.result.records;
Expand Down
2 changes: 1 addition & 1 deletion v2/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ export class App{
return;
}
if(!this.myDeviceName){
const confirmed = confirm("Do you want to register this browser as a Join device so you can interact with it remotely?\n\nPlease note that this is a beta feature and may not fully work yet.")
const confirmed = confirm("Do you want to register this browser as a Join device so you can interact with it remotely?")
this.alreadyAskedRegistration = true;
if(!confirmed) return;

Expand Down
44 changes: 28 additions & 16 deletions v2/device/apphelperdevices.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,37 @@ export class AppHelperDevices extends AppHelperBase{
await app.updateDevice(device);
}
async loadDevicesFromServer(){

app.controlTop.loading = true;
await app.loadJoinApis();
const devices = new Devices(await ApiServer.getDevices());
const existing = await this.getDevices();
if(existing){
existing.transferSockets(devices);
}
await this.refreshDevices(devices);
await this.updateDBDevices(devices);
if(devices.length > 0){
UtilDOM.show(this.controlCommands);
}
await devices.testLocalNetworkDevices({allowUnsecureContent:app.allowUnsecureContent,token:await app.getAuthToken()});
await this.refreshDevices(devices);
app.controlTop.loading = false;
try{
const devicesFromServer = await ApiServer.getDevices();
const devices = new Devices(devicesFromServer);
const existing = await this.getDevices();
if(existing){
existing.transferSockets(devices);
}
await this.refreshDevices(devices);
await this.updateDBDevices(devices);
if(devices.length > 0){
UtilDOM.show(this.controlCommands);
}
await devices.testLocalNetworkDevices({allowUnsecureContent:app.allowUnsecureContent,token:await app.getAuthToken()});
await this.refreshDevices(devices);
app.controlTop.loading = false;

// await app.checkConnectedClients();
EventBus.post(devices);
return devices;

// await app.checkConnectedClients();
EventBus.post(devices);
return devices;
}catch(error){

const {ControlDialogOk} = await import("../dialog/controldialog.js");
await ControlDialogOk.showAndWait({title:"Error Loading Join Desktop",text:`Seems like your user is no longer authenticated. Will now sign out so you can sign in again.`,timeout:30000})
const googleAccount = await app.googleAccount;
await googleAccount.signOut();
return new Devices();
}
}
async onConnectViaLocalNetworkSuccess(){
await this.refreshDevices();
Expand Down

0 comments on commit d91cf92

Please sign in to comment.