Skip to content

Commit

Permalink
fix: error msges from 225, and small peer improvement (#22)
Browse files Browse the repository at this point in the history
* fix: error msges from 225

* don't need to keep prompt open for peers (just host)

* add note for prod build, hot-reloading doesn't handle many files too well

* note

* fix gzip on viewer.html

* undo error change

* change errors to logs
  • Loading branch information
lesleyrs authored Aug 1, 2024
1 parent bf004a8 commit 0350823
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ http://localhost/client?world=0&detail=high&method=0 (Java)
A web worker server will start when loading world 999. This works as a no install, offline, singleplayer version of the server. You will need to self host in order to load saves.

How to use:
1. Run `npm run build` and then `npm run bundle` in the server, this copies all required files to `../Client2/public`.
1. Run `npm run build` and then `npm run bundle` in the server, this copies all required files to `../Client2/public`. Start client with `npm run prod`.
2. A save dialog will open on logout, you should save to `/public/data/players`.
3. Optional: To host on github uncomment the lines starting with `!/public` in the [.gitignore](.gitignore).

Expand Down
13 changes: 7 additions & 6 deletions src/js/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,13 @@ export abstract class Client extends GameShell {
return;
}

let offer: string | null;
try {
while ((offer = prompt('Paste offer here, answer will be copied to clipboard')) === null);
await this.peer.handleOffer(offer);
} catch (e) {
console.error(e);
const offer: string | null = prompt('Paste offer here, answer will be copied to clipboard');
if (offer) {
try {
await this.peer.handleOffer(offer);
} catch (e) {
console.error(e);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/jagex2/config/IdkType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class IdkType extends ConfigType {
} else if (code >= 60 && code < 70) {
this.heads[code - 60] = dat.g2;
} else {
throw new Error(`Unrecognized idk config code: ${code}`);
console.log('Error unrecognised config code: ', code);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/jagex2/config/MesAnimType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class MesAnimType extends ConfigType {
} else if (code === 250) {
this.debugname = dat.gjstr;
} else {
throw new Error(`Unrecognized mesanim config code: ${code}`);
console.log('Error unrecognised mesanim config code: ', code);
}
}
}
2 changes: 1 addition & 1 deletion src/js/jagex2/config/SeqType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class SeqType extends ConfigType {
} else if (code === 8) {
this.replaycount = dat.g1;
} else {
throw new Error(`Unrecognized seq config code: ${code}`);
console.log('Error unrecognised seq config code: ', code);
}
}
}
2 changes: 1 addition & 1 deletion src/js/jagex2/config/SpotAnimType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class SpotAnimType extends ConfigType {
} else if (code >= 50 && code < 60) {
this.recol_d[code - 50] = dat.g2;
} else {
throw new Error(`Unrecognized spotanim config code: ${code}`);
console.log('Error unrecognised spotanim config code: ', code);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/jagex2/config/VarpType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class VarpType extends ConfigType {
} else if (code === 10) {
this.debugname = dat.gjstr;
} else {
throw new Error(`Error unrecognised config code: ${code}`);
console.log('Error unrecognised config code: ', code);
}
}
}
7 changes: 7 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ module.exports = () => {
'grow',
'iceServers',
'urls',
'malloc_u8',
'free_u8',
'gzip_decompress',
'gzip_compress',
'error_message',
'error_message_len',
'deallocate_buffer',
]
}
},
Expand Down

0 comments on commit 0350823

Please sign in to comment.