fix: Restore default permission on desktop build
Restore desktop capabilities Restore linter correctness Restore different capabilities on each platform
This commit is contained in:
parent
4718203960
commit
a62852f384
@ -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": "yarn@4.5.3"
|
||||
}
|
||||
|
||||
@ -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:",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"app": {
|
||||
"security": {
|
||||
"capabilities": ["default", "system-monitor-window"]
|
||||
"capabilities": ["desktop", "system-monitor-window"]
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"app": {
|
||||
"security": {
|
||||
"capabilities": ["default", "system-monitor-window"]
|
||||
"capabilities": ["desktop", "system-monitor-window"]
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"app": {
|
||||
"security": {
|
||||
"capabilities": ["default"]
|
||||
"capabilities": ["desktop"]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
@ -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 () => {}
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user