diff --git a/CHANGELOG.md b/CHANGELOG.md index bd39d2f..b22cf08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,13 @@ All notable changes to this project will be documented in this file. Each batch of changes is marked by the date it was published to the repository for deployment to the PGEtinker site. It is a summary of changes that would be pertinent to the end user of the PGEtinker website. For a comprehensive history of changes made to the project, please refer to the repository's commit history. -## 20204-07-05 + +## 20204-07-07 - Fixed bug involving shared code persistence - Changed threshold for responsive navbar +- Added session guard to compile and share API +- Added session guard on language client ## 2024-06-30 diff --git a/bootstrap/app.php b/bootstrap/app.php index 8a46f47..80e6ca1 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -14,6 +14,9 @@ health: '/up', ) ->withMiddleware(function (Middleware $middleware) { + + $middleware->statefulApi(); + // $middleware->trustProxies(at: [ '0.0.0.0/0', diff --git a/resources/js/app.ts b/resources/js/app.ts index 3fed0dd..c9caecb 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -225,7 +225,7 @@ export default class PGEtinker if(!this.preCompile()) return; - + axios.post("/api/share", { code: this.editorPanel.getValue() }).then((response) => @@ -265,7 +265,7 @@ export default class PGEtinker } this.compileFailHandler("pgetinker.cpp:1:1: error: compilation failed in a way that's not being handled. please make a bug report.\n"); - }); + }); } async switchToDefaultLayout() @@ -345,7 +345,6 @@ export default class PGEtinker reject(); }); }); - } compileSuccessHandler(data: any) diff --git a/resources/js/lib/monacoConfig.js b/resources/js/lib/monacoConfig.js index 7dcc441..f14a73b 100644 --- a/resources/js/lib/monacoConfig.js +++ b/resources/js/lib/monacoConfig.js @@ -12,7 +12,6 @@ import { getStorageValue, setStorageValue } from './storage'; export const getUserConfiguration = () => { - return JSON.stringify({ "workbench.colorTheme": (getStorageValue("theme") == "dark") ? "Default Dark Modern" : "Default Light Modern", "editor.mouseWheelZoom": "on", @@ -29,7 +28,7 @@ export const createUserConfig = (workspaceRoot, code, codeUri) => { let secured = (window.location.protocol.indexOf("https") === 0); let staging = (window.location.pathname.indexOf("/staging/") == 0); - + return { languageClientConfig: { languageId: 'cpp', @@ -39,9 +38,6 @@ export const createUserConfig = (workspaceRoot, code, codeUri) => host: window.location.host, port: secured ? 443 : 80, path: staging ? "staging/clangd" : "clangd", - extraParams: { - authorization: 'UserAuth' - }, secured: secured, startOptions: { onCall: (languageClient) => {}, diff --git a/routes/api.php b/routes/api.php index 58009d2..2aaf128 100644 --- a/routes/api.php +++ b/routes/api.php @@ -5,8 +5,8 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; -Route::post("/share", [CodeController::class, "Share" ]); -Route::post("/compile", [CodeController::class, "Compile" ]); +Route::post("/share", [CodeController::class, "Share" ])->middleware("auth.session"); +Route::post("/compile", [CodeController::class, "Compile" ])->middleware("auth.session"); Route::get("/health-check", [CodeController::class, "HealthCheck" ]); Route::get("/news", function(Request $request) @@ -60,7 +60,7 @@ } return $changeLog; -}); +})->middleware("auth.session"); -Route::get("/supporters", [PatreonController::class, "get_supporters" ]); +Route::get("/supporters", [PatreonController::class, "get_supporters" ])->middleware("auth.session"); Route::post("/update-supporters", [PatreonController::class, "update" ]);