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"
|
"hoistingLimits": "workspaces"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"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"
|
"packageManager": "yarn@4.5.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
|
"capabilities": ["default"],
|
||||||
"csp": {
|
"csp": {
|
||||||
"default-src": "'self' customprotocol: asset: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*",
|
"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:",
|
"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": {
|
"app": {
|
||||||
"security": {
|
"security": {
|
||||||
"capabilities": ["default", "system-monitor-window"]
|
"capabilities": ["desktop", "system-monitor-window"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"app": {
|
"app": {
|
||||||
"security": {
|
"security": {
|
||||||
"capabilities": ["default", "system-monitor-window"]
|
"capabilities": ["desktop", "system-monitor-window"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"app": {
|
"app": {
|
||||||
"security": {
|
"security": {
|
||||||
"capabilities": ["default"]
|
"capabilities": ["desktop"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import ReactMarkdown, { Components } from 'react-markdown'
|
import ReactMarkdown, { Components } from 'react-markdown'
|
||||||
import remarkGfm from 'remark-gfm'
|
import remarkGfm from 'remark-gfm'
|
||||||
import remarkEmoji from 'remark-emoji'
|
import remarkEmoji from 'remark-emoji'
|
||||||
@ -6,7 +7,7 @@ import remarkBreaks from 'remark-breaks'
|
|||||||
import rehypeKatex from 'rehype-katex'
|
import rehypeKatex from 'rehype-katex'
|
||||||
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
|
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
|
||||||
import * as prismStyles from 'react-syntax-highlighter/dist/cjs/styles/prism'
|
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 { getReadableLanguageName } from '@/lib/utils'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { useCodeblock } from '@/hooks/useCodeblock'
|
import { useCodeblock } from '@/hooks/useCodeblock'
|
||||||
@ -153,8 +154,8 @@ const CodeComponent = memo(
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{React.createElement(SyntaxHighlighter as React.ComponentType<Record<string, unknown>>, {
|
<SyntaxHighlighter
|
||||||
style:
|
style={
|
||||||
prismStyles[
|
prismStyles[
|
||||||
codeBlockStyle
|
codeBlockStyle
|
||||||
.split('-')
|
.split('-')
|
||||||
@ -164,27 +165,31 @@ const CodeComponent = memo(
|
|||||||
: part.charAt(0).toUpperCase() + part.slice(1)
|
: part.charAt(0).toUpperCase() + part.slice(1)
|
||||||
)
|
)
|
||||||
.join('') as keyof typeof prismStyles
|
.join('') as keyof typeof prismStyles
|
||||||
] || prismStyles.oneLight,
|
] || prismStyles.oneLight
|
||||||
language,
|
}
|
||||||
showLineNumbers,
|
language={language}
|
||||||
wrapLines: true,
|
showLineNumbers={showLineNumbers}
|
||||||
lineProps: isWrapping
|
wrapLines={true}
|
||||||
|
lineProps={
|
||||||
|
isWrapping
|
||||||
? {
|
? {
|
||||||
style: { wordBreak: 'break-all', whiteSpace: 'pre-wrap' },
|
style: { wordBreak: 'break-all', whiteSpace: 'pre-wrap' },
|
||||||
}
|
}
|
||||||
: {},
|
: {}
|
||||||
customStyle: {
|
}
|
||||||
|
customStyle={{
|
||||||
margin: 0,
|
margin: 0,
|
||||||
padding: '8px',
|
padding: '8px',
|
||||||
borderRadius: '0 0 4px 4px',
|
borderRadius: '0 0 4px 4px',
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
border: 'none',
|
border: 'none',
|
||||||
},
|
}}
|
||||||
PreTag: 'div',
|
PreTag="div"
|
||||||
CodeTag: 'code',
|
CodeTag={'code'}
|
||||||
...props,
|
{...props}
|
||||||
children: code
|
>
|
||||||
})}
|
{code}
|
||||||
|
</SyntaxHighlighter>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,18 +7,6 @@ import {
|
|||||||
import { PlatformFeature } from '@/lib/platform/types'
|
import { PlatformFeature } from '@/lib/platform/types'
|
||||||
import { PlatformFeatures } from '@/lib/platform/const'
|
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 {
|
interface AuthState {
|
||||||
// Auth service
|
// Auth service
|
||||||
authService: JanAuthService | null
|
authService: JanAuthService | null
|
||||||
@ -81,7 +69,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
|
|||||||
if (!authService) {
|
if (!authService) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return (authService as AuthServiceInterface).getAllProviders()
|
return authService.getAllProviders()
|
||||||
},
|
},
|
||||||
|
|
||||||
loginWithProvider: async (providerId: ProviderType) => {
|
loginWithProvider: async (providerId: ProviderType) => {
|
||||||
@ -90,7 +78,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
|
|||||||
throw new Error('Authentication not available on this platform')
|
throw new Error('Authentication not available on this platform')
|
||||||
}
|
}
|
||||||
|
|
||||||
await (authService as AuthServiceInterface).loginWithProvider(providerId)
|
await authService.loginWithProvider(providerId)
|
||||||
},
|
},
|
||||||
|
|
||||||
handleProviderCallback: async (
|
handleProviderCallback: async (
|
||||||
@ -103,7 +91,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
|
|||||||
throw new Error('Authentication not available on this platform')
|
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
|
// Reload auth state after successful callback
|
||||||
await loadAuthState()
|
await loadAuthState()
|
||||||
},
|
},
|
||||||
@ -114,7 +102,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return (authService as AuthServiceInterface).isAuthenticatedWithProvider(providerId)
|
return authService.isAuthenticatedWithProvider(providerId)
|
||||||
},
|
},
|
||||||
|
|
||||||
logout: async () => {
|
logout: async () => {
|
||||||
@ -145,7 +133,7 @@ const useAuthStore = create<AuthState>()((set, get) => ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const profile = await (authService as AuthServiceInterface).getCurrentUser(forceRefresh)
|
const profile = await authService.getCurrentUser(forceRefresh)
|
||||||
set({
|
set({
|
||||||
user: profile,
|
user: profile,
|
||||||
isAuthenticated: profile !== null,
|
isAuthenticated: profile !== null,
|
||||||
@ -168,11 +156,11 @@ const useAuthStore = create<AuthState>()((set, get) => ({
|
|||||||
set({ isLoading: true })
|
set({ isLoading: true })
|
||||||
|
|
||||||
// Check if user is authenticated with any provider
|
// Check if user is authenticated with any provider
|
||||||
const isAuth = (authService as AuthServiceInterface).isAuthenticated()
|
const isAuth = authService.isAuthenticated()
|
||||||
|
|
||||||
// Load user profile if authenticated
|
// Load user profile if authenticated
|
||||||
if (isAuth) {
|
if (isAuth) {
|
||||||
const profile = await (authService as AuthServiceInterface).getCurrentUser(forceRefresh)
|
const profile = await authService.getCurrentUser(forceRefresh)
|
||||||
set({
|
set({
|
||||||
user: profile,
|
user: profile,
|
||||||
isAuthenticated: profile !== null,
|
isAuthenticated: profile !== null,
|
||||||
@ -196,12 +184,12 @@ const useAuthStore = create<AuthState>()((set, get) => ({
|
|||||||
|
|
||||||
subscribeToAuthEvents: (callback: (event: MessageEvent) => void) => {
|
subscribeToAuthEvents: (callback: (event: MessageEvent) => void) => {
|
||||||
const { authService } = get()
|
const { authService } = get()
|
||||||
if (!authService || typeof (authService as AuthServiceInterface).onAuthEvent !== 'function') {
|
if (!authService || typeof authService.onAuthEvent !== 'function') {
|
||||||
return () => {} // Return no-op cleanup
|
return () => {} // Return no-op cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return (authService as AuthServiceInterface).onAuthEvent(callback)
|
return authService.onAuthEvent(callback)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Failed to subscribe to auth events:', error)
|
console.warn('Failed to subscribe to auth events:', error)
|
||||||
return () => {}
|
return () => {}
|
||||||
|
|||||||
@ -7818,15 +7818,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"@types/react@npm:19.1.2":
|
||||||
version: 19.1.2
|
version: 19.1.2
|
||||||
resolution: "@types/react@npm:19.1.2"
|
resolution: "@types/react@npm:19.1.2"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user