Skip to content

Commit

Permalink
chore: small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Feb 23, 2024
1 parent f63c123 commit cd46991
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 33 deletions.
2 changes: 1 addition & 1 deletion core/components/WebServer/authLogic.ts
Expand Up @@ -259,7 +259,7 @@ export const nuiAuthLogic = (
const vaultAdmin = txAdmin.adminVault.getAdminByIdentifiers(identifiers);
if (!vaultAdmin) {
if(!reqHeader['x-txadmin-identifiers'].includes('license:')) {
return failResp('Unauthorized: you do not have a license identifier, which means the server propably has sv_lan enabled. Please disable sv_lan and restart the server to use the in-game menu.');
return failResp('Unauthorized: you do not have a license identifier, which means the server probably has sv_lan enabled. Please disable sv_lan and restart the server to use the in-game menu.');
} else {
//this one is handled differently in resource/menu/client/cl_base.lua
return failResp('admin_not_found');
Expand Down
6 changes: 3 additions & 3 deletions docs/dev_notes.md
Expand Up @@ -14,11 +14,11 @@
- [x] live console bookmarks

- assorted changes
- [ ] FIXME: apparently pressing enter on the text form of the license key when setting up the server using tx doenst work?
- [x] add snapshot and gc to advanced actions
- [x] FIXME: apparently pressing enter on the text form of the license key when setting up the server using tx doenst work?
seems like it just refreshes the page
- [ ] can I remove `/nui/resetSession`? I think we don't even use cookies anymore
- [x] can I remove `/nui/resetSession`? I think we don't even use cookies anymore
- add txadmin v8 heap to diagnostics
- add snapshot and gc to advanced actions
- fix disallowed intents message

- rtl issue
Expand Down
3 changes: 0 additions & 3 deletions nui/src/hooks/useNuiListenersService.tsx
Expand Up @@ -26,7 +26,4 @@ export const useNuiListenerService = () => {
useNuiEvent<ResolvablePermission[]>("setPermissions", setPermsState);
useNuiEvent<ServerCtx>("setServerCtx", setServerCtxState);
useNuiEvent<txAdminMenuPage>("setMenuPage", setMenuPage);
useNuiEvent("resetSession", ()=>{
fetchWebPipe<string>("/nui/resetSession").catch();
});
};
1 change: 0 additions & 1 deletion resource/menu/client/cl_base.lua
Expand Up @@ -104,7 +104,6 @@ local function retryAuthentication()
debugPrint("^5[AUTH] Retrying menu authentication.")
menuIsAccessible = false
menuPermissions = {}
sendMenuMessage('resetSession')
sendMenuMessage('setPermissions', menuPermissions)
TriggerServerEvent('txsv:checkIfAdmin')
end
Expand Down
25 changes: 0 additions & 25 deletions resource/menu/client/cl_webpipe.lua
Expand Up @@ -46,31 +46,6 @@ RegisterRawNuiCallback('WebPipe', function(req, cb)
return
end

-- Cookie wiper to prevent sticky cookie sessions after reauth
-- FIXME: deprecate this path?!
if path == '/nui/resetSession' then
if type(headers['Cookie']) ~= 'string' then
return cb({
status = 200,
body = '{}',
})
else
local cookies = {}
for cookie in headers['Cookie']:gmatch('(tx:[^=]+)') do
cookies[#cookies + 1] = cookie .. "=deleted; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; httponly; SameSite=None; Secure"
end
return cb({
status = 200,
body = '{}',
headers = {
['Connection'] = "close",
['Content-Type'] = "text/plain",
['Set-Cookie'] = cookies
}
})
end
end

local id = pipeCallbackCounter
pipeReturnCallbacks[id] = { cb = cb, path = path }
pipeCallbackCounter = pipeCallbackCounter + 1
Expand Down
6 changes: 6 additions & 0 deletions web/standalone/deployer.ejs
Expand Up @@ -403,6 +403,12 @@
});
}
if(step2elements.form){
step2elements.form.addEventListener('submit', (e) => {
e.preventDefault();
step2Action();
});
}
function step2Action(){
if(!step2elements.form.reportValidity()) return;
Expand Down

0 comments on commit cd46991

Please sign in to comment.