Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: Restore default permission on desktop build

Vanalitea62852f38414
diff --git a/package.json b/package.json
index d191e9f44..cf3767e66 100644
--- a/package.json
+++ b/package.json
@@ -66,7 +66,9 @@
"hoistingLimits": "workspaces"
},
"resolutions": {
- "yallist": "4.0.0"
+ "yallist": "4.0.0",
+ "@types/react": "19.1.2",
+ "@types/react-dom": "19.1.2"
},
"packageManager": "[email protected]"
}
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 90e87b824..f559d79cc 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -40,6 +40,7 @@
}
],
"security": {
+ "capabilities": ["default"],
"csp": {
"default-src": "'self' customprotocol: asset: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*",
"connect-src": "ipc: http://ipc.localhost http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:* https: http:",
diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json
index 55c11b1f8..85f39ba50 100644
--- a/src-tauri/tauri.linux.conf.json
+++ b/src-tauri/tauri.linux.conf.json
@@ -1,7 +1,7 @@
{
"app": {
"security": {
- "capabilities": ["default", "system-monitor-window"]
+ "capabilities": ["desktop", "system-monitor-window"]
}
},
"bundle": {
diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json
index 79f165df7..2113bd0fa 100644
--- a/src-tauri/tauri.macos.conf.json
+++ b/src-tauri/tauri.macos.conf.json
@@ -1,7 +1,7 @@
{
"app": {
"security": {
- "capabilities": ["default", "system-monitor-window"]
+ "capabilities": ["desktop", "system-monitor-window"]
}
},
"bundle": {
diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json
index a1438c385..91e2eb374 100644
--- a/src-tauri/tauri.windows.conf.json
+++ b/src-tauri/tauri.windows.conf.json
@@ -1,7 +1,7 @@
{
"app": {
"security": {
- "capabilities": ["default"]
+ "capabilities": ["desktop"]
}
},
diff --git a/web-app/src/containers/RenderMarkdown.tsx b/web-app/src/containers/RenderMarkdown.tsx
index 2b6807eba..31d08cf10 100644
--- a/web-app/src/containers/RenderMarkdown.tsx
+++ b/web-app/src/containers/RenderMarkdown.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable react-hooks/exhaustive-deps */
import ReactMarkdown, { Components } from 'react-markdown'
import remarkGfm from 'remark-gfm'
import remarkEmoji from 'remark-emoji'
@@ -6,7 +7,7 @@ import remarkBreaks from 'remark-breaks'
import rehypeKatex from 'rehype-katex'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import * as prismStyles from 'react-syntax-highlighter/dist/cjs/styles/prism'
-import React, { memo, useState, useMemo, useCallback } from 'react'
+import { memo, useState, useMemo, useCallback } from 'react'
import { getReadableLanguageName } from '@/lib/utils'
import { cn } from '@/lib/utils'
import { useCodeblock } from '@/hooks/useCodeblock'
@@ -153,8 +154,8 @@ const CodeComponent = memo(
)}
</button>
</div>
- {React.createElement(SyntaxHighlighter as React.ComponentType<Record<string, unknown>>, {
- style:
+ <SyntaxHighlighter
+ style={
prismStyles[
codeBlockStyle
.split('-')
@@ -164,27 +165,31 @@ const CodeComponent = memo(
: part.charAt(0).toUpperCase() + part.slice(1)
)
.join('') as keyof typeof prismStyles
- ] || prismStyles.oneLight,
- language,
- showLineNumbers,
- wrapLines: true,
- lineProps: isWrapping
- ? {
- style: { wordBreak: 'break-all', whiteSpace: 'pre-wrap' },
- }
- : {},
- customStyle: {
+ ] || prismStyles.oneLight
+ }
+ language={language}
+ showLineNumbers={showLineNumbers}
+ wrapLines={true}
+ lineProps={
+ isWrapping
+ ? {
+ style: { wordBreak: 'break-all', whiteSpace: 'pre-wrap' },
+ }
+ : {}
+ }
+ customStyle={{
margin: 0,
padding: '8px',
borderRadius: '0 0 4px 4px',
overflow: 'auto',
border: 'none',
- },
- PreTag: 'div',
- CodeTag: 'code',
- ...props,
- children: code
- })}
+ }}
+ PreTag="div"
+ CodeTag={'code'}
+ {...props}
+ >
+ {code}
+ </SyntaxHighlighter>
</div>
)
}
diff --git a/web-app/src/hooks/useAuth.ts b/web-app/src/hooks/useAuth.ts
index 47cc4a69e..7bca3b8f2 100644
--- a/web-app/src/hooks/useAuth.ts
+++ b/web-app/src/hooks/useAuth.ts
@@ -7,18 +7,6 @@ import {
import { PlatformFeature } from '@/lib/platform/types'
import { PlatformFeatures } from '@/lib/platform/const'
-// Type definition for the auth service from extensions-web
-interface AuthServiceInterface {
- getAllProviders: () => string[]
- loginWithProvider: (providerId: ProviderType) => Promise<void>
- handleProviderCallback: (providerId: ProviderType, code: string, state?: string) => Promise<void>
- isAuthenticatedWithProvider: (providerId: ProviderType) => boolean
- logout: () => Promise<void>
- getCurrentUser: (forceRefresh?: boolean) => Promise<User | null>
- isAuthenticated: () => boolean
- onAuthEvent: (callback: (event: MessageEvent) => void) => () => void
-}
-
interface AuthState {
// Auth service
authService: JanAuthService | null
@@ -81,7 +69,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
if (!authService) {
return []
}
- return (authService as AuthServiceInterface).getAllProviders()
+ return authService.getAllProviders()
},
loginWithProvider: async (providerId: ProviderType) => {
@@ -90,7 +78,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
throw new Error('Authentication not available on this platform')
}
- await (authService as AuthServiceInterface).loginWithProvider(providerId)
+ await authService.loginWithProvider(providerId)
},
handleProviderCallback: async (
@@ -103,7 +91,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
throw new Error('Authentication not available on this platform')
}
- await (authService as AuthServiceInterface).handleProviderCallback(providerId, code, state)
+ await authService.handleProviderCallback(providerId, code, state)
// Reload auth state after successful callback
await loadAuthState()
},
@@ -114,7 +102,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
return false
}
- return (authService as AuthServiceInterface).isAuthenticatedWithProvider(providerId)
+ return authService.isAuthenticatedWithProvider(providerId)
},
logout: async () => {
@@ -145,7 +133,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
}
try {
- const profile = await (authService as AuthServiceInterface).getCurrentUser(forceRefresh)
+ const profile = await authService.getCurrentUser(forceRefresh)
set({
user: profile,
isAuthenticated: profile !== null,
@@ -168,11 +156,11 @@ const useAuthStore = create<AuthState>()((set, get) => ({
set({ isLoading: true })
// Check if user is authenticated with any provider
- const isAuth = (authService as AuthServiceInterface).isAuthenticated()
+ const isAuth = authService.isAuthenticated()
// Load user profile if authenticated
if (isAuth) {
- const profile = await (authService as AuthServiceInterface).getCurrentUser(forceRefresh)
+ const profile = await authService.getCurrentUser(forceRefresh)
set({
user: profile,
isAuthenticated: profile !== null,
@@ -196,12 +184,12 @@ const useAuthStore = create<AuthState>()((set, get) => ({
subscribeToAuthEvents: (callback: (event: MessageEvent) => void) => {
const { authService } = get()
- if (!authService || typeof (authService as AuthServiceInterface).onAuthEvent !== 'function') {
+ if (!authService || typeof authService.onAuthEvent !== 'function') {
return () => {} // Return no-op cleanup
}
try {
- return (authService as AuthServiceInterface).onAuthEvent(callback)
+ return authService.onAuthEvent(callback)
} catch (error) {
console.warn('Failed to subscribe to auth events:', error)
return () => {}
diff --git a/yarn.lock b/yarn.lock
index 602a6c1e7..23608118e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7818,15 +7818,6 @@ __metadata:
languageName: node
linkType: hard
-"@types/react@npm:*":
- version: 19.1.13
- resolution: "@types/react@npm:19.1.13"
- dependencies:
- csstype: "npm:^3.0.2"
- checksum: 10c0/75e35b54883f5ed07d3b5cb16a4711b6dbb7ec6b74301bcb9bfa697c9d9fff022ec508e1719e7b2c69e2e8b042faac1125be7717b5e5e084f816a2c88e136920
- languageName: node
- linkType: hard
-
"@types/react@npm:19.1.2":
version: 19.1.2
resolution: "@types/react@npm:19.1.2"