Skip to content

Commit 055ce10

Browse files
committed
fix: update proxy
1 parent db46277 commit 055ce10

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124
proxyURL = decodeURI(tempCustomProxy);
125125
} else {
126126
console.log("Using default proxy");
127-
proxyURL = "proxy.php";
128127
}
129128

130129
// Check if the user is logged in, if not, prompt to login

scripts/requests.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
let ws;
2-
let proxyURL;
2+
let proxyURL = null;
33
let activeTripObj;
44
let numberOfRequestTries = 5;
55
let currentRequestTry = 0;
66

7+
const DEFAULT_PROXY = "https://corsproxy.afonsosousah.workers.dev/";
8+
79
async function makePostRequest(url, body, accessToken = null) {
810
// Increment current request try
911
currentRequestTry += 1;
1012

11-
const response = await fetch(proxyURL, {
13+
console.log(proxyURL ?? DEFAULT_PROXY);
14+
15+
const response = await fetch(proxyURL ?? DEFAULT_PROXY, {
1216
method: "POST",
1317
headers: {
1418
"User-Agent": "Gira/3.2.8 (Android 34)",

scripts/tokenRefresh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async function tokenRefresh() {
1313

1414
console.log("Token has not been refreshed...");
1515

16-
const response = await fetch(proxyURL, {
16+
const response = await fetch(proxyURL ?? DEFAULT_PROXY, {
1717
method: "POST",
1818
headers: {
1919
"X-Proxy-URL": "https://api-auth.emel.pt/token/refresh",

scripts/user.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ async function openUserSettings() {
176176
<div id="settingsContainer">
177177
<div id="proxy">
178178
<div>Proxy definido pelo utilizador</div>
179-
<input id="proxyUrlInput" value="${proxyURL}" placeholder="Insere aqui o URL para o proxy"/>
179+
<input id="proxyUrlInput" value="${proxyURL ?? "Padrão"}" placeholder="Insere aqui o URL para o proxy"/>
180180
<div id="resetProxyButton"><i class="bi bi-arrow-counterclockwise"></i></div>
181181
<div id="setProxyButton"><i class="bi bi-check-lg"></i></div>
182182
</div>
@@ -201,7 +201,7 @@ async function openUserSettings() {
201201

202202
document.getElementById("resetProxyButton").addEventListener("click", () => {
203203
// Delete customProxy cookie
204-
proxyURL = "proxy.php";
204+
proxyURL = null;
205205
document.cookie = 'customProxy=None;path="/";expires=Thu, 01 Jan 1970 00:00:01 GMT';
206206
// Update input
207207
document.getElementById("proxyUrlInput").value = proxyURL;
@@ -233,7 +233,7 @@ function openSetProxyPrompt() {
233233
},
234234
() => {
235235
// Delete customProxy cookie
236-
proxyURL = "proxy.php";
236+
proxyURL = null;
237237
document.cookie = 'customProxy=None;path="/";expires=Thu, 01 Jan 1970 00:00:01 GMT';
238238
openLoginMenu();
239239
},

0 commit comments

Comments
 (0)