π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix web settings links on tauri
Prateek Sunaldd401de66bee
diff --git a/web/apps/ensu/src/components/chat/ChatDialogs.tsx b/web/apps/ensu/src/components/chat/ChatDialogs.tsxindex abb3da6d9f..0a2b394040 100644--- a/web/apps/ensu/src/components/chat/ChatDialogs.tsx+++ b/web/apps/ensu/src/components/chat/ChatDialogs.tsx@@ -170,595 +170,620 @@ export const ChatDialogs = memo(showDevSettings,closeDevSettings,modelGateStatus,- }: ChatDialogsProps) => (- <>- <Dialog- open={showSettingsModal}- onClose={closeSettingsModal}- maxWidth="xs"- fullWidth- slotProps={{- paper: {- sx: [- dialogPaperSx,+ }: ChatDialogsProps) => {+ const openExternalUrl = async (url: string) => {+ if (isTauriRuntime) {+ try {+ const { open } = await import("@tauri-apps/api/shell");+ await open(url);+ return;+ } catch {+ // fall through to browser open+ }+ }++ if (typeof window !== "undefined") {+ window.open(url, "_blank", "noopener,noreferrer");+ }+ };++ return (+ <>+ <Dialog+ open={showSettingsModal}+ onClose={closeSettingsModal}+ maxWidth="xs"+ fullWidth+ slotProps={{+ paper: {+ sx: [+ dialogPaperSx,+ {+ maxHeight:+ "min(500px, calc(var(--ensu-viewport-height, 100svh) - 32px))",+ display: "flex",+ flexDirection: "column",+ },+ ],+ },+ }}+ >+ <DialogTitle+ sx={[+ dialogTitleSx,{- maxHeight:- "min(500px, calc(var(--ensu-viewport-height, 100svh) - 32px))",display: "flex",- flexDirection: "column",+ alignItems: "center",+ justifyContent: "space-between",+ gap: 1,+ pr: 1,},- ],- },- }}- >- <DialogTitle- sx={[- dialogTitleSx,- {- display: "flex",- alignItems: "center",- justifyContent: "space-between",- gap: 1,- pr: 1,- },- ]}- >- <Box component="span">Settings</Box>- <IconButton- aria-label="Close settings"- onClick={closeSettingsModal}- sx={actionButtonSx}+ ]}>- <HugeiconsIcon- icon={Cancel01Icon}- {...smallIconProps}- />- </IconButton>- </DialogTitle>- <DialogContent sx={{ flex: 1, overflowY: "auto" }}>- <Stack sx={{ gap: 2 }}>- {isLoggedIn && (- <Box- sx={{- px: 2,- py: 1.5,- borderRadius: 2,- border: "1px solid",- borderColor: "divider",- bgcolor: "background.default",- }}- >- <Typography- variant="mini"- sx={{ color: "text.muted" }}+ <Box component="span">Settings</Box>+ <IconButton+ aria-label="Close settings"+ onClick={closeSettingsModal}+ sx={actionButtonSx}+ >+ <HugeiconsIcon+ icon={Cancel01Icon}+ {...smallIconProps}+ />+ </IconButton>+ </DialogTitle>+ <DialogContent sx={{ flex: 1, overflowY: "auto" }}>+ <Stack sx={{ gap: 2 }}>+ {isLoggedIn && (+ <Box+ sx={{+ px: 2,+ py: 1.5,+ borderRadius: 2,+ border: "1px solid",+ borderColor: "divider",+ bgcolor: "background.default",+ }}>- Signed in as- </Typography>- <Typography variant="small">- {signedInEmail ?? ""}- </Typography>- </Box>- )}+ <Typography+ variant="mini"+ sx={{ color: "text.muted" }}+ >+ Signed in as+ </Typography>+ <Typography variant="small">+ {signedInEmail ?? ""}+ </Typography>+ </Box>+ )}- <Stack sx={{ gap: 1 }}>- <ListItemButton- onClick={() => {- closeSettingsModal();- if (typeof window !== "undefined") {- window.open(+ <Stack sx={{ gap: 1 }}>+ <ListItemButton+ onClick={() => {+ closeSettingsModal();+ void openExternalUrl("https://ente.io/blog/ensu/",- "_blank",- "noopener,noreferrer",- );- }- }}- sx={settingsItemSx}- >- <HugeiconsIcon- icon={InformationCircleIcon}- {...compactIconProps}- />- <Typography variant="small" sx={{ flex: 1 }}>- About- </Typography>- <HugeiconsIcon- icon={ArrowRight01Icon}- {...smallIconProps}- />- </ListItemButton>-- <ListItemButton- onClick={() => {- closeSettingsModal();- if (typeof window !== "undefined") {- window.open(- "https://ente.io/privacy",- "_blank",- "noopener,noreferrer",- );- }- }}- sx={settingsItemSx}- >- <HugeiconsIcon- icon={Shield02Icon}- {...compactIconProps}- />- <Typography variant="small" sx={{ flex: 1 }}>- Privacy Policy- </Typography>- <HugeiconsIcon- icon={ArrowRight01Icon}- {...smallIconProps}- />- </ListItemButton>-- <ListItemButton- onClick={() => {- closeSettingsModal();- if (typeof window !== "undefined") {- window.open(- "https://ente.io/terms",- "_blank",- "noopener,noreferrer",);- }- }}- sx={settingsItemSx}- >- <HugeiconsIcon- icon={LegalDocument01Icon}- {...compactIconProps}- />- <Typography variant="small" sx={{ flex: 1 }}>- Terms of Service- </Typography>- <HugeiconsIcon- icon={ArrowRight01Icon}- {...smallIconProps}- />- </ListItemButton>-- <ListItemButton- onClick={() => {- closeSettingsModal();- void saveLogs();- }}- sx={settingsItemSx}- >- <HugeiconsIcon- icon={Bug01Icon}- {...compactIconProps}- />- <Typography variant="small" sx={{ flex: 1 }}>- Save logs- </Typography>- <HugeiconsIcon- icon={ArrowRight01Icon}- {...smallIconProps}- />- </ListItemButton>+ }}+ sx={settingsItemSx}+ >+ <HugeiconsIcon+ icon={InformationCircleIcon}+ {...compactIconProps}+ />+ <Typography+ variant="small"+ sx={{ flex: 1 }}+ >+ About+ </Typography>+ <HugeiconsIcon+ icon={ArrowRight01Icon}+ {...smallIconProps}+ />+ </ListItemButton>- {isLoggedIn && (<ListItemButtononClick={() => {closeSettingsModal();- openPasskeysFromChat();+ void saveLogs();}}sx={settingsItemSx}><HugeiconsIcon- icon={Key01Icon}+ icon={Bug01Icon}{...compactIconProps}/><Typographyvariant="small"sx={{ flex: 1 }}>- Passkeys+ Save logs</Typography><HugeiconsIconicon={ArrowRight01Icon}{...smallIconProps}/></ListItemButton>- )}- {!isLoggedIn && (+ {isLoggedIn && (+ <ListItemButton+ onClick={() => {+ closeSettingsModal();+ openPasskeysFromChat();+ }}+ sx={settingsItemSx}+ >+ <HugeiconsIcon+ icon={Key01Icon}+ {...compactIconProps}+ />+ <Typography+ variant="small"+ sx={{ flex: 1 }}+ >+ Passkeys+ </Typography>+ <HugeiconsIcon+ icon={ArrowRight01Icon}+ {...smallIconProps}+ />+ </ListItemButton>+ )}++ {!isLoggedIn && (+ <ListItemButton+ onClick={() => {+ closeSettingsModal();+ openLoginFromChat();+ }}+ sx={settingsItemSx}+ >+ <HugeiconsIcon+ icon={Login01Icon}+ {...compactIconProps}+ />+ <Typography+ variant="small"+ sx={{ flex: 1, fontWeight: 600 }}+ >+ Sign In to Backup+ </Typography>+ <HugeiconsIcon+ icon={ArrowRight01Icon}+ {...smallIconProps}+ />+ </ListItemButton>+ )}++ {isLoggedIn && (+ <ListItemButton+ onClick={() => {+ closeSettingsModal();+ handleLogout();+ }}+ sx={[+ settingsItemSx,+ { color: "critical.main" },+ ]}+ >+ <HugeiconsIcon+ icon={Logout01Icon}+ {...compactIconProps}+ />+ <Typography+ variant="small"+ sx={{ flex: 1, fontWeight: 600 }}+ >+ Sign Out+ </Typography>+ <HugeiconsIcon+ icon={ArrowRight01Icon}+ {...smallIconProps}+ />+ </ListItemButton>+ )}+<ListItemButtononClick={() => {closeSettingsModal();- openLoginFromChat();+ void openExternalUrl(+ "https://ente.io/privacy",+ );}}sx={settingsItemSx}><HugeiconsIcon- icon={Login01Icon}+ icon={Shield02Icon}{...compactIconProps}/><Typographyvariant="small"- sx={{ flex: 1, fontWeight: 600 }}+ sx={{ flex: 1 }}>- Sign In to Backup+ Privacy Policy</Typography><HugeiconsIconicon={ArrowRight01Icon}{...smallIconProps}/></ListItemButton>- )}- {isLoggedIn && (<ListItemButtononClick={() => {closeSettingsModal();- handleLogout();+ void openExternalUrl(+ "https://ente.io/terms",+ );}}- sx={[- settingsItemSx,- { color: "critical.main" },- ]}+ sx={settingsItemSx}><HugeiconsIcon- icon={Logout01Icon}+ icon={LegalDocument01Icon}{...compactIconProps}/><Typographyvariant="small"- sx={{ flex: 1, fontWeight: 600 }}+ sx={{ flex: 1 }}>- Sign Out+ Terms of Service</Typography><HugeiconsIconicon={ArrowRight01Icon}{...smallIconProps}/></ListItemButton>- )}+ </Stack></Stack>- </Stack>- </DialogContent>- </Dialog>+ </DialogContent>+ </Dialog>- {developerSettingsEnabled && modelSettingsEnabled && (- <Dialog- open={showDeveloperMenu}- onClose={closeDeveloperMenu}- fullScreen={isSmall}- maxWidth="xs"- fullWidth- slotProps={{ paper: { sx: dialogPaperSx } }}- >- <DialogTitle sx={dialogTitleSx}>- Developer Settings- </DialogTitle>- <DialogContent>- <Stack sx={{ gap: 1 }}>- {modelSettingsEnabled && (+ {developerSettingsEnabled && modelSettingsEnabled && (+ <Dialog+ open={showDeveloperMenu}+ onClose={closeDeveloperMenu}+ fullScreen={isSmall}+ maxWidth="xs"+ fullWidth+ slotProps={{ paper: { sx: dialogPaperSx } }}+ >+ <DialogTitle sx={dialogTitleSx}>+ Developer Settings+ </DialogTitle>+ <DialogContent>+ <Stack sx={{ gap: 1 }}>+ {modelSettingsEnabled && (+ <ListItemButton+ onClick={() => {+ closeDeveloperMenu();+ openModelSettings();+ }}+ sx={settingsItemSx}+ >+ <HugeiconsIcon+ icon={Settings01Icon}+ {...compactIconProps}+ />+ <Typography+ variant="small"+ sx={{ flex: 1 }}+ >+ Model settings+ </Typography>+ <HugeiconsIcon+ icon={ArrowRight01Icon}+ {...smallIconProps}+ />+ </ListItemButton>+ )}<ListItemButtononClick={() => {closeDeveloperMenu();- openModelSettings();+ openDevSettings();}}sx={settingsItemSx}><HugeiconsIcon- icon={Settings01Icon}+ icon={SlidersHorizontalIcon}{...compactIconProps}/><Typographyvariant="small"sx={{ flex: 1 }}>- Model settings+ Server endpoint</Typography><HugeiconsIconicon={ArrowRight01Icon}{...smallIconProps}/></ListItemButton>- )}- <ListItemButton- onClick={() => {- closeDeveloperMenu();- openDevSettings();- }}- sx={settingsItemSx}+ </Stack>+ </DialogContent>+ <DialogActions sx={{ px: 3, pb: 3 }}>+ <Button+ onClick={closeDeveloperMenu}+ color="secondary"+ fullWidth>- <HugeiconsIcon- icon={SlidersHorizontalIcon}- {...compactIconProps}- />- <Typography variant="small" sx={{ flex: 1 }}>- Server endpoint- </Typography>- <HugeiconsIcon- icon={ArrowRight01Icon}- {...smallIconProps}- />- </ListItemButton>- </Stack>+ Close+ </Button>+ </DialogActions>+ </Dialog>+ )}++ <Dialog+ open={Boolean(deleteSessionId)}+ onClose={handleCancelDeleteSession}+ fullScreen={isSmall}+ maxWidth="xs"+ fullWidth+ slotProps={{ paper: { sx: dialogPaperSx } }}+ >+ <DialogTitle sx={dialogTitleSx}>Delete chat?</DialogTitle>+ <DialogContent>+ <Typography variant="body" sx={{ color: "text.muted" }}>+ Delete {deleteSessionLabel}? This cannot be undone.+ </Typography></DialogContent><DialogActions sx={{ px: 3, pb: 3 }}><Button- onClick={closeDeveloperMenu}+ onClick={handleCancelDeleteSession}color="secondary"- fullWidth>- Close+ Cancel+ </Button>+ <Button+ variant="contained"+ color="critical"+ onClick={() => void handleConfirmDeleteSession()}+ >+ Delete</Button></DialogActions></Dialog>- )}- <Dialog- open={Boolean(deleteSessionId)}- onClose={handleCancelDeleteSession}- fullScreen={isSmall}- maxWidth="xs"- fullWidth- slotProps={{ paper: { sx: dialogPaperSx } }}- >- <DialogTitle sx={dialogTitleSx}>Delete chat?</DialogTitle>- <DialogContent>- <Typography variant="body" sx={{ color: "text.muted" }}>- Delete {deleteSessionLabel}? This cannot be undone.- </Typography>- </DialogContent>- <DialogActions sx={{ px: 3, pb: 3 }}>- <Button- onClick={handleCancelDeleteSession}- color="secondary"- >- Cancel- </Button>- <Button- variant="contained"- color="critical"- onClick={() => void handleConfirmDeleteSession()}+ {modelSettingsEnabled && (+ <Dialog+ open={showModelSettings}+ onClose={closeModelSettings}+ fullScreen={isSmall}+ maxWidth="sm"+ fullWidth+ slotProps={{ paper: { sx: dialogPaperSx } }}>- Delete- </Button>- </DialogActions>- </Dialog>-- {modelSettingsEnabled && (- <Dialog- open={showModelSettings}- onClose={closeModelSettings}- fullScreen={isSmall}- maxWidth="sm"- fullWidth- slotProps={{ paper: { sx: dialogPaperSx } }}- >- <DialogTitle sx={dialogTitleSx}>Model Settings</DialogTitle>- <DialogContent>- <Stack sx={{ gap: 3 }}>- <Stack sx={{ gap: 0.5 }}>- <Typography- variant="small"- sx={{ color: "text.muted" }}- >- Selected model- </Typography>- <Typography variant="body">- {useCustomModel- ? "Custom model"- : defaultModelName}- </Typography>- <Typography- variant="mini"- sx={{- color: loadedModelName- ? "success.main"- : "text.muted",- }}- >- {loadedModelName- ? `Loaded: ${loadedModelName}`- : "Not loaded"}- </Typography>- </Stack>+ <DialogTitle sx={dialogTitleSx}>+ Model Settings+ </DialogTitle>+ <DialogContent>+ <Stack sx={{ gap: 3 }}>+ <Stack sx={{ gap: 0.5 }}>+ <Typography+ variant="small"+ sx={{ color: "text.muted" }}+ >+ Selected model+ </Typography>+ <Typography variant="body">+ {useCustomModel+ ? "Custom model"+ : defaultModelName}+ </Typography>+ <Typography+ variant="mini"+ sx={{+ color: loadedModelName+ ? "success.main"+ : "text.muted",+ }}+ >+ {loadedModelName+ ? `Loaded: ${loadedModelName}`+ : "Not loaded"}+ </Typography>+ </Stack>- <Divider />+ <Divider />- <Stack sx={{ gap: 1.5 }}>- <Typography variant="small">- Custom Hugging Face model- </Typography>- <TextField- fullWidth- label="Direct .gguf file URL"- placeholder="https://huggingface.co/..."- value={modelUrl}- onChange={(event) =>- setModelUrl(event.target.value)- }- error={!!modelUrlError}- helperText={modelUrlError ?? " "}- />- {allowMmproj && (+ <Stack sx={{ gap: 1.5 }}>+ <Typography variant="small">+ Custom Hugging Face model+ </Typography><TextFieldfullWidth- label="mmproj .gguf file URL"- placeholder="(optional for multimodal)"- value={mmprojUrl}+ label="Direct .gguf file URL"+ placeholder="https://huggingface.co/..."+ value={modelUrl}onChange={(event) =>- setMmprojUrl(event.target.value)+ setModelUrl(event.target.value)}- error={!!mmprojError}- helperText={mmprojError ?? " "}+ error={!!modelUrlError}+ helperText={modelUrlError ?? " "}/>- )}- <Typography- variant="mini"- sx={{ color: "text.muted" }}- >- Suggested models:- </Typography>- <Stack sx={{ gap: 1 }}>- {suggestedModels.map((model) => (- <Box- key={model.name}- sx={{- border: "1px solid",- borderColor: "divider",- borderRadius: 2,- p: 1.5,- }}- >- <Stack- direction="row"+ {allowMmproj && (+ <TextField+ fullWidth+ label="mmproj .gguf file URL"+ placeholder="(optional for multimodal)"+ value={mmprojUrl}+ onChange={(event) =>+ setMmprojUrl(event.target.value)+ }+ error={!!mmprojError}+ helperText={mmprojError ?? " "}+ />+ )}+ <Typography+ variant="mini"+ sx={{ color: "text.muted" }}+ >+ Suggested models:+ </Typography>+ <Stack sx={{ gap: 1 }}>+ {suggestedModels.map((model) => (+ <Box+ key={model.name}sx={{- gap: 1,- alignItems: "center",+ border: "1px solid",+ borderColor: "divider",+ borderRadius: 2,+ p: 1.5,}}>- <Box sx={{ flex: 1 }}>- <Typography variant="small">- {model.name}- </Typography>- <Typography- variant="mini"- sx={{- color: "text.muted",- }}- >- {isTauriRuntime &&- model.mmproj- ? "+ mmproj"- : ""}- </Typography>- </Box>- <Button- size="small"- onClick={() =>- handleFillSuggestion(- model.url,- model.mmproj,- )- }+ <Stack+ direction="row"+ sx={{+ gap: 1,+ alignItems: "center",+ }}>- Fill- </Button>- </Stack>- </Box>- ))}+ <Box sx={{ flex: 1 }}>+ <Typography variant="small">+ {model.name}+ </Typography>+ <Typography+ variant="mini"+ sx={{+ color: "text.muted",+ }}+ >+ {isTauriRuntime &&+ model.mmproj+ ? "+ mmproj"+ : ""}+ </Typography>+ </Box>+ <Button+ size="small"+ onClick={() =>+ handleFillSuggestion(+ model.url,+ model.mmproj,+ )+ }+ >+ Fill+ </Button>+ </Stack>+ </Box>+ ))}+ </Stack></Stack>- </Stack>- <Divider />+ <Divider />- <Stack sx={{ gap: 1.5 }}>- <Typography variant="small">- Custom limits (optional)- </Typography>- <Stack direction="row" sx={{ gap: 1.5 }}>- <TextField- fullWidth- label="Context length"- placeholder="8192"- value={contextLength}- onChange={(event) =>- setContextLength(event.target.value)- }- error={!!contextError}- helperText={contextError ?? " "}- />- <TextField- fullWidth- label="Max output"- placeholder="2048"- value={maxTokens}- onChange={(event) =>- setMaxTokens(event.target.value)- }- error={!!maxTokensError}- helperText={maxTokensError ?? " "}- />+ <Stack sx={{ gap: 1.5 }}>+ <Typography variant="small">+ Custom limits (optional)+ </Typography>+ <Stack direction="row" sx={{ gap: 1.5 }}>+ <TextField+ fullWidth+ label="Context length"+ placeholder="8192"+ value={contextLength}+ onChange={(event) =>+ setContextLength(+ event.target.value,+ )+ }+ error={!!contextError}+ helperText={contextError ?? " "}+ />+ <TextField+ fullWidth+ label="Max output"+ placeholder="2048"+ value={maxTokens}+ onChange={(event) =>+ setMaxTokens(event.target.value)+ }+ error={!!maxTokensError}+ helperText={maxTokensError ?? " "}+ />+ </Stack>+ <Typography+ variant="mini"+ sx={{ color: "text.muted" }}+ >+ Leave blank to use model defaults+ </Typography></Stack>+ </Stack>+ </DialogContent>+ <DialogActions sx={{ px: 3, pb: 3 }}>+ <Stack sx={{ width: "100%", gap: 1.5 }}>+ <Button+ variant="contained"+ color="accent"+ disabled={+ isSavingModel ||+ modelGateStatus === "downloading"+ }+ onClick={handleSaveModel}+ >+ Use Custom Model+ </Button>+ <Button+ onClick={handleUseDefaultModel}+ color="secondary"+ >+ Use Default Model+ </Button><Typographyvariant="mini"- sx={{ color: "text.muted" }}+ sx={{+ color: "text.muted",+ textAlign: "center",+ }}>- Leave blank to use model defaults+ Changes require re-downloading the model.</Typography></Stack>- </Stack>- </DialogContent>- <DialogActions sx={{ px: 3, pb: 3 }}>- <Stack sx={{ width: "100%", gap: 1.5 }}>- <Button- variant="contained"- color="accent"- disabled={- isSavingModel ||- modelGateStatus === "downloading"- }- onClick={handleSaveModel}- >- Use Custom Model- </Button>- <Button- onClick={handleUseDefaultModel}- color="secondary"- >- Use Default Model- </Button>- <Typography- variant="mini"- sx={{- color: "text.muted",- textAlign: "center",- }}- >- Changes require re-downloading the model.- </Typography>- </Stack>- </DialogActions>- </Dialog>- )}+ </DialogActions>+ </Dialog>+ )}- <Notification- open={syncNotificationOpen}- onClose={() => setSyncNotificationOpen(false)}- attributes={syncNotification}- horizontal={isSmall ? "left" : "right"}- vertical="bottom"- sx={{- width: "fit-content",- maxWidth: "min(360px, 100vw)",- backgroundColor: "transparent",- boxShadow: "none",- bottom: { xs: 96, md: 24 },- "& .MuiButtonBase-root": {- padding: "4px 8px",- borderRadius: "999px",- minHeight: 0,- bgcolor: "background.paper",- color: "text.base",+ <Notification+ open={syncNotificationOpen}+ onClose={() => setSyncNotificationOpen(false)}+ attributes={syncNotification}+ horizontal={isSmall ? "left" : "right"}+ vertical="bottom"+ sx={{+ width: "fit-content",+ maxWidth: "min(360px, 100vw)",+ backgroundColor: "transparent",boxShadow: "none",- },- "& .MuiStack-root": { gap: 1 },- "& .MuiStack-root svg": { fontSize: "18px" },- "& .MuiTypography-root": {- fontSize: "13px",- lineHeight: "18px",- },- "& .MuiIconButton-root": {- padding: 0,- bgcolor: "transparent",- },- }}- />-- {developerSettingsEnabled && (- <DevSettings- open={showDevSettings}- onClose={closeDevSettings}+ bottom: { xs: 96, md: 24 },+ "& .MuiButtonBase-root": {+ padding: "4px 8px",+ borderRadius: "999px",+ minHeight: 0,+ bgcolor: "background.paper",+ color: "text.base",+ boxShadow: "none",+ },+ "& .MuiStack-root": { gap: 1 },+ "& .MuiStack-root svg": { fontSize: "18px" },+ "& .MuiTypography-root": {+ fontSize: "13px",+ lineHeight: "18px",+ },+ "& .MuiIconButton-root": {+ padding: 0,+ bgcolor: "transparent",+ },+ }}/>- )}- </>- ),++ {developerSettingsEnabled && (+ <DevSettings+ open={showDevSettings}+ onClose={closeDevSettings}+ />+ )}+ </>+ );+ },);