mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-24 20:07:51 +00:00
fixes
This commit is contained in:
parent
24b2f35e63
commit
852bb13a71
@ -249,11 +249,12 @@ export class ElectronCapacitorApp {
|
||||
export function setupContentSecurityPolicy(customScheme: string): void {
|
||||
session.defaultSession.webRequest.onHeadersReceived((details: any, callback) => {
|
||||
const allowedSources = ["'self'", customScheme, ...domainHolder.allowedDomains];
|
||||
const connectSources = [...allowedSources];
|
||||
const frameSources = [
|
||||
"'self'",
|
||||
'http://localhost:*',
|
||||
'https://localhost:*',
|
||||
'ws://localhost:*',
|
||||
'ws://127.0.0.1:*',
|
||||
'http://127.0.0.1:*',
|
||||
'https://127.0.0.1:*',
|
||||
...allowedSources,
|
||||
@ -261,13 +262,13 @@ export function setupContentSecurityPolicy(customScheme: string): void {
|
||||
|
||||
// Create the Content Security Policy (CSP) string
|
||||
const csp = `
|
||||
default-src 'self' ${allowedSources.join(' ')};
|
||||
default-src 'self' ${frameSources.join(' ')};
|
||||
frame-src ${frameSources.join(' ')};
|
||||
script-src 'self' 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' ${allowedSources.join(' ')};
|
||||
script-src 'self' 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' ${frameSources.join(' ')};
|
||||
object-src 'self';
|
||||
connect-src 'self' blob: ${connectSources.join(' ')};
|
||||
img-src 'self' data: blob: ${allowedSources.join(' ')};
|
||||
media-src 'self' blob: ${allowedSources.join(' ')};
|
||||
connect-src 'self' blob: ${frameSources.join(' ')};
|
||||
img-src 'self' data: blob: ${frameSources.join(' ')};
|
||||
media-src 'self' blob: ${frameSources.join(' ')};
|
||||
style-src 'self' 'unsafe-inline';
|
||||
font-src 'self' data:;
|
||||
`.replace(/\s+/g, ' ').trim();
|
||||
|
@ -1443,7 +1443,7 @@ function App() {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<MainAvatar myName={userInfo?.name} />
|
||||
<MainAvatar setOpenSnack={setOpenSnack} setInfoSnack={setInfoSnack} myName={userInfo?.name} balance={balance} />
|
||||
<Spacer height="32px" />
|
||||
<TextP
|
||||
sx={{
|
||||
@ -3294,7 +3294,7 @@ function App() {
|
||||
aria-labelledby="alert-dialog-title"
|
||||
aria-describedby="alert-dialog-description"
|
||||
>
|
||||
<DialogTitle id="alert-dialog-title">{"Warning"}</DialogTitle>
|
||||
<DialogTitle id="alert-dialog-title">{"LOGOUT"}</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText id="alert-dialog-description">
|
||||
{messageUnsavedChanges.message}
|
||||
@ -3336,7 +3336,6 @@ function App() {
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
minHeight: "400px",
|
||||
maxHeight: "90vh",
|
||||
overflow: "auto",
|
||||
}}
|
||||
|
@ -941,7 +941,7 @@ export async function getBalanceInfo() {
|
||||
const validApi = await getBaseApi();
|
||||
const response = await fetch(validApi + "/addresses/balance/" + address);
|
||||
|
||||
if (!response?.ok) throw new Error("Cannot fetch balance");
|
||||
if (!response?.ok) throw new Error("0 QORT in your balance");
|
||||
const data = await response.json();
|
||||
return data;
|
||||
}
|
||||
@ -1101,7 +1101,7 @@ export const getLastRef = async () => {
|
||||
const response = await fetch(
|
||||
validApi + "/addresses/lastreference/" + address
|
||||
);
|
||||
if (!response?.ok) throw new Error("Cannot fetch balance");
|
||||
if (!response?.ok) throw new Error("0 QORT in your balance");
|
||||
const data = await response.text();
|
||||
return data;
|
||||
};
|
||||
|
@ -809,6 +809,7 @@ export const ListOfGroupPromotions = () => {
|
||||
value={selectedGroup}
|
||||
label="Groups where you are an admin"
|
||||
onChange={(e) => setSelectedGroup(e.target.value)}
|
||||
variant="outlined"
|
||||
>
|
||||
{myGroupsWhereIAmAdmin?.map((group) => {
|
||||
return (
|
||||
|
@ -7,8 +7,9 @@ import ImageUploader from "../common/ImageUploader";
|
||||
import { getFee } from "../background";
|
||||
import { fileToBase64 } from "../utils/fileReading";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import ErrorIcon from '@mui/icons-material/Error';
|
||||
|
||||
export const MainAvatar = ({ myName }) => {
|
||||
export const MainAvatar = ({ myName, balance, setOpenSnack, setInfoSnack }) => {
|
||||
const [hasAvatar, setHasAvatar] = useState(false);
|
||||
const [avatarFile, setAvatarFile] = useState(null);
|
||||
const [tempAvatar, setTempAvatar] = useState(null)
|
||||
@ -52,10 +53,11 @@ const [isLoading, setIsLoading] = useState(false)
|
||||
checkIfAvatarExists();
|
||||
}, [myName]);
|
||||
|
||||
|
||||
const publishAvatar = async ()=> {
|
||||
try {
|
||||
const fee = await getFee('ARBITRARY')
|
||||
|
||||
if(+balance < +fee.fee) throw new Error(`Publishing an Avatar requires ${fee.fee}`)
|
||||
await show({
|
||||
message: "Would you like to publish an avatar?" ,
|
||||
publishFee: fee.fee + ' QORT'
|
||||
@ -84,7 +86,13 @@ const [isLoading, setIsLoading] = useState(false)
|
||||
setTempAvatar(`data:image/webp;base64,${avatarBase64}`)
|
||||
handleClose()
|
||||
} catch (error) {
|
||||
|
||||
if (error?.message) {
|
||||
setOpenSnack(true)
|
||||
setInfoSnack({
|
||||
type: "error",
|
||||
message: error?.message,
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
@ -113,7 +121,7 @@ const [isLoading, setIsLoading] = useState(false)
|
||||
change avatar
|
||||
</Typography>
|
||||
</ButtonBase>
|
||||
<PopoverComp avatarFile={avatarFile} setAvatarFile={setAvatarFile} id={id} open={open} anchorEl={anchorEl} handleClose={handleClose} publishAvatar={publishAvatar} isLoading={isLoading} />
|
||||
<PopoverComp myName={myName} avatarFile={avatarFile} setAvatarFile={setAvatarFile} id={id} open={open} anchorEl={anchorEl} handleClose={handleClose} publishAvatar={publishAvatar} isLoading={isLoading} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -141,7 +149,7 @@ const [isLoading, setIsLoading] = useState(false)
|
||||
change avatar
|
||||
</Typography>
|
||||
</ButtonBase>
|
||||
<PopoverComp avatarFile={avatarFile} setAvatarFile={setAvatarFile} id={id} open={open} anchorEl={anchorEl} handleClose={handleClose} publishAvatar={publishAvatar} isLoading={isLoading} />
|
||||
<PopoverComp myName={myName} avatarFile={avatarFile} setAvatarFile={setAvatarFile} id={id} open={open} anchorEl={anchorEl} handleClose={handleClose} publishAvatar={publishAvatar} isLoading={isLoading} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -159,13 +167,13 @@ const [isLoading, setIsLoading] = useState(false)
|
||||
set avatar
|
||||
</Typography>
|
||||
</ButtonBase>
|
||||
<PopoverComp avatarFile={avatarFile} setAvatarFile={setAvatarFile} id={id} open={open} anchorEl={anchorEl} handleClose={handleClose} publishAvatar={publishAvatar} isLoading={isLoading} />
|
||||
<PopoverComp myName={myName} avatarFile={avatarFile} setAvatarFile={setAvatarFile} id={id} open={open} anchorEl={anchorEl} handleClose={handleClose} publishAvatar={publishAvatar} isLoading={isLoading} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
const PopoverComp = ({avatarFile, setAvatarFile, id, open, anchorEl, handleClose, publishAvatar, isLoading}) => {
|
||||
const PopoverComp = ({avatarFile, setAvatarFile, id, open, anchorEl, handleClose, publishAvatar, isLoading, myName}) => {
|
||||
return (
|
||||
<Popover
|
||||
id={id}
|
||||
@ -194,8 +202,21 @@ const PopoverComp = ({avatarFile, setAvatarFile, id, open, anchorEl, handleClose
|
||||
</ImageUploader>
|
||||
{avatarFile?.name}
|
||||
<Spacer height="25px" />
|
||||
{!myName && (
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
gap: '5px',
|
||||
alignItems: 'center'
|
||||
}}>
|
||||
<ErrorIcon sx={{
|
||||
color: 'white'
|
||||
}} />
|
||||
<Typography>A registered name is required to set an avatar</Typography>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<LoadingButton loading={isLoading} disabled={!avatarFile} onClick={publishAvatar} variant="contained">
|
||||
<Spacer height="25px" />
|
||||
<LoadingButton loading={isLoading} disabled={!avatarFile || !myName} onClick={publishAvatar} variant="contained">
|
||||
Publish avatar
|
||||
</LoadingButton>
|
||||
</Box>
|
||||
|
18
src/main.tsx
18
src/main.tsx
@ -44,6 +44,24 @@ const theme = createTheme({
|
||||
color: '#b0b0b0', // Lighter text for body2, often used for secondary text
|
||||
},
|
||||
},
|
||||
components: {
|
||||
MuiOutlinedInput: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
".MuiOutlinedInput-notchedOutline": {
|
||||
borderColor: "white", // ⚪ Default outline color
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiSelect: {
|
||||
styleOverrides: {
|
||||
icon: {
|
||||
color: "white", // ✅ Caret (dropdown arrow) color
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default theme;
|
||||
|
Loading…
x
Reference in New Issue
Block a user