Skip to content

Commit

Permalink
make CORS proxy optional
Browse files Browse the repository at this point in the history
  • Loading branch information
CuddleBunny committed Aug 5, 2024
1 parent 178deaa commit 1992757
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
15 changes: 8 additions & 7 deletions scripts/app-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/app-bundle.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/models/settings-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export class SettingsModel {
}

// Misc
useCorsProxy: boolean = true;

chatEnabled: boolean = false;

gameOverText: string = "Game Over";
Expand Down
7 changes: 7 additions & 0 deletions src/pages/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ <h2>Gameplay</h2>
<input type="number" min="0" max="1" step="0.1" value.bind="settings.gameOverOpacity | number" />
</div>

<h2>Misc</h2>

<div class="input">
<label>Use CORS Proxy</label>
<input type="checkbox" checked.bind="settings.useCorsProxy" />
</div>

<button click.delegate="saveSettings()">Save</button>
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/scenes/cyberball.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ export class CyberballScene extends Phaser.Scene {
this.load.multiatlas('player', `${this.settings.baseUrl}/player.json`, 'assets');

if(this.settings.player.portrait)
this.load.image('playerPortrait', 'https://proxy.cors.sh/' + this.settings.player.portrait);
this.load.image('playerPortrait', (this.settings.useCorsProxy ? 'https://proxy.cors.sh/' : '') + this.settings.player.portrait);

this.settings.computerPlayers.forEach((cpu, i) => {
if(cpu.portrait)
this.load.image('cpuPortrait' + i, 'https://proxy.cors.sh/' + cpu.portrait);
this.load.image('cpuPortrait' + i, (this.settings.useCorsProxy ? 'https://proxy.cors.sh/' : '') + cpu.portrait);
});
}

Expand Down

0 comments on commit 1992757

Please sign in to comment.