Skip to content

Commit

Permalink
fix: bunch of small day 1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Dec 31, 2023
1 parent 1dc8454 commit 76bedcb
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Quickies
- [ ] feat(menu): add keymapping for tp to waypoint (PR #886)
- [ ] fix the tsc build
- [ ] do i need to add a input type hidden with the username in the add master and account modal so vaults can save it both?
- [x] do i need to add a input type hidden with the username in the add master and account modal so vaults can save it both?
- [ ] put in server name in the login page, to help lost admins notice they are in the wrong txAdmin
- [ ] talk to r* and make sure the new build process wipes the old cache
- [ ] make sure some user input based fields are truncated (server name, player name)
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
author 'Tabarra'
description 'Remotely Manage & Monitor your GTA5 FiveM Server'
repository 'https://github.com/tabarra/txAdmin'
version '7.0.0-beta2-dev'
version '7.0.0-beta2'
ui_label 'txAdmin'

rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
Expand Down
1 change: 1 addition & 0 deletions panel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<meta property="og:title" content="{{ogTitle}}">
<meta property="og:description" content="{{ogDescripttion}}">
<meta property="og:image" content="https://i.imgur.com/Z3S9q6J.png">
<meta name="robots" content="noindex, nofollow">
<!-- {{txConstsInjection}} -->
<!-- {{devModules}} -->
</head>
Expand Down
12 changes: 6 additions & 6 deletions panel/src/hooks/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ export const useAuthedFetcher = () => {

return async (fetchUrl: string, fetchOpts: FetcherOpts = {}, abortController?: AbortController) => {
if (!csrfToken) throw new Error('CSRF token not set');
const obligatoryPrefix = window.txConsts.isWebInterface ? '/' : WEBPIPE_PATH;
if (!fetchUrl.startsWith(obligatoryPrefix)) {
throw new Error(`[useAuthedFetcher] fetchUrl MUST start with '${obligatoryPrefix}', got '${fetchUrl}'.`);
//Enforce single slash at the start of the path to prevent CSRF token leak
if (fetchUrl[0] !== '/' || fetchUrl[1] === '/') {
throw new Error(`[useAuthedFetcher] fetchUrl MUST start with a single '/', got '${fetchUrl}'.`);
}
if (fetchUrl.startsWith('//')) {
throw new Error(`[useAuthedFetcher] fetchUrl MUST NOT start with '//', got '${fetchUrl}'.`);
if(!window.txConsts.isWebInterface){
fetchUrl = WEBPIPE_PATH + fetchUrl;
}

fetchOpts.method ??= 'GET';
Expand Down Expand Up @@ -147,7 +147,7 @@ export const useBackendApi = <

return async (opts: ApiCallOpts<RespType, ReqType>) => {
//Processing URL
let fetchUrl = window.txConsts.isWebInterface ? hookOpts.path : WEBPIPE_PATH + hookOpts.path;
let fetchUrl = hookOpts.path;
if (opts.pathParams) {
for (const [key, val] of Object.entries(opts.pathParams)) {
fetchUrl = fetchUrl.replace(`/:${key}/`, `/${val.toString()}/`);
Expand Down
4 changes: 2 additions & 2 deletions panel/src/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ export function Header() {
<div className="flex flex-row items-center flex-grow gap-5 mr-5">
<div className="w-sidebar hidden xl:flex justify-center">
<NavLink href="/">
<LogoFullSquareGreen className="h-9 hover:scale-105" />
<LogoFullSquareGreen className="h-9 hover:scale-105 hover:brightness-110" />
</NavLink>
</div>
<NavLink href="/">
<LogoSquareGreen className="h-8 w-8 lg:h-10 lg:w-10 hidden sm:max-xl:block hover:scale-105" />
<LogoSquareGreen className="h-8 w-8 lg:h-10 lg:w-10 hidden sm:max-xl:block hover:scale-105 hover:brightness-110" />
</NavLink>

<div className="lg:hidden">
Expand Down
2 changes: 1 addition & 1 deletion panel/src/layout/MainSheets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function GlobalMenuSheet() {
<SheetHeader>
<SheetTitle>
<NavLink href="/">
<LogoFullSquareGreen className="h-9 hover:scale-105" />
<LogoFullSquareGreen className="h-9 hover:scale-105 hover:brightness-110" />
</NavLink>
</SheetTitle>
</SheetHeader>
Expand Down
3 changes: 2 additions & 1 deletion panel/src/pages/Iframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ type Props = {

export default function Iframe({ legacyUrl }: Props) {
const searchParams = location.search ?? '';
const hashParams = location.hash ?? '';
return (
<iframe id="legacyPageiframe"
src={`./legacy/${legacyUrl}${searchParams}`}
src={`./legacy/${legacyUrl}${searchParams}${hashParams}`}
className="w-full"
></iframe>
);
Expand Down
4 changes: 3 additions & 1 deletion panel/src/pages/auth/AddMasterCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function RegisterForm({ fivemId, fivemName, profilePicture }: ApiAddMasterCallba
setErrorMessage(data.error);
} else {
//Hacky override to prevent logout from rendering this page again
window.txConsts.hasMasterAccount = true;
window.txConsts.hasMasterAccount = true;
setAuthData(data);
}
},
Expand Down Expand Up @@ -122,6 +122,8 @@ function RegisterForm({ fivemId, fivemName, profilePicture }: ApiAddMasterCallba
</div>
</div>
</div>
{/* This is so password managers save the username */}
<input type="text" name="frm-username" className="hidden" value={fivemName} readOnly />
<div className="grid gap-2">
<div className="flex flex-row justify-between items-center">
<Label htmlFor="frm-discord">Discord ID</Label>
Expand Down
2 changes: 1 addition & 1 deletion web/public/js/txadmin/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
align: 'center',
},
offset: {
y: 64,
y: 8,
},
});
}
Expand Down

0 comments on commit 76bedcb

Please sign in to comment.