Skip to content

Commit

Permalink
refactor: Security call custom service domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
1943time committed Mar 16, 2024
1 parent 19ac693 commit 6b9d8f7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/renderer/src/server/Share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const Share = observer(() => {
setState({syncing: true})
shareStore.shareDoc(note.filePath, treeStore.root?.filePath).then(res => {
setState({refresh: !state.refresh})
shareSuccessfully$.next(`${shareStore.serviceConfig!.domain}/doc/${res.name}`)
shareSuccessfully$.next(`${shareStore.serviceConfig?.domain}/doc/${res.name}`)
}).finally(() => setState({syncing: false}))
}
}, [])
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/server/ui/BookItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const BookItem = observer((props: {
<div className={'flex items-center'}>
<IBook className={'w-4 h-4 dark:fill-gray-400 fill-gray-600'}/>
<a
href={`${shareStore.serviceConfig!.domain}/book/${b.path}`}
href={`${shareStore.serviceConfig?.domain}/book/${b.path}`}
target={'_blank'}
className={'ml-1 max-w-[330px] truncate link'}>
{b.name}
Expand All @@ -77,7 +77,7 @@ export const BookItem = observer((props: {
...b,
name: ''
}).then(() => {
shareSuccessfully$.next(`${shareStore.serviceConfig!.domain}/book/${b.path}`)
shareSuccessfully$.next(`${shareStore.serviceConfig?.domain}/book/${b.path}`)
}).finally(action(() => b.updating = false))
})}
>
Expand All @@ -95,7 +95,7 @@ export const BookItem = observer((props: {
{
label: configStore.zh ? '复制链接' : 'Copy Link', key: 'copy', icon: <CopyOutlined/>,
onClick: () => {
props.onCopy(`${shareStore.serviceConfig!.domain}/book/${b.path}`)
props.onCopy(`${shareStore.serviceConfig?.domain}/book/${b.path}`)
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/server/ui/Ebook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const EBook = observer((props: {
}
if (res) {
props.onSave(res.book)
shareSuccessfully$.next(`${shareStore.serviceConfig!.domain}/book/${res.book.path}`)
shareSuccessfully$.next(`${shareStore.serviceConfig?.domain}/book/${res.book.path}`)
close()
}
} finally {
Expand Down
12 changes: 6 additions & 6 deletions src/renderer/src/server/ui/ShareData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Sync = observer((props: {
try {
if (props.doc) {
const res = await shareStore.shareDoc(props.doc.filePath)
shareSuccessfully$.next(`${shareStore.serviceConfig!.domain}/doc/${res.name}`)
shareSuccessfully$.next(`${shareStore.serviceConfig?.domain}/doc/${res.name}`)
}
} finally {
setState({syncing: false})
Expand Down Expand Up @@ -210,7 +210,7 @@ export const ShareData = observer((props: {
<a
className={'link'}
target={'_blank'}
href={`${shareStore.serviceConfig!.domain}/doc/${v}`}
href={`${shareStore.serviceConfig?.domain}/doc/${v}`}
>{v}</a>
</>
)
Expand Down Expand Up @@ -313,7 +313,7 @@ export const ShareData = observer((props: {
<a
className={'link'}
target={'_blank'}
href={`${shareStore.serviceConfig!.domain}/book/${record.path}`}
href={`${shareStore.serviceConfig?.domain}/book/${record.path}`}
>{v}</a>
)
},
Expand Down Expand Up @@ -406,7 +406,7 @@ export const ShareData = observer((props: {
<a
className={'link'}
target={'_blank'}
href={`${shareStore.serviceConfig!.domain}/stream/${v}`}
href={`${shareStore.serviceConfig?.domain}/stream/${v}`}
>{record.filePath.includes('/') ? record.filePath.split('/').pop() : record.filePath.split('\\').pop()}</a>
)
},
Expand Down Expand Up @@ -439,7 +439,7 @@ export const ShareData = observer((props: {
{record.doc &&
<span>
<FileTextOutlined className={'mr-1 w-4'}/>
<a href={`${shareStore.serviceConfig!.domain}/doc/${record.doc.name}`}
<a href={`${shareStore.serviceConfig?.domain}/doc/${record.doc.name}`}
className={'link'} target={'_blank'}>
{record.doc.name}
</a>
Expand All @@ -449,7 +449,7 @@ export const ShareData = observer((props: {
<span className={'flex items-center'}>
<BookIcon className={'w-4 h-4 mr-1 dark:fill-gray-300'}/>
<a className={'link'}
href={`${shareStore.serviceConfig!.domain}/book/${record.book.path}`}
href={`${shareStore.serviceConfig?.domain}/book/${record.book.path}`}
target={'_blank'}>
{record.book.name}
</a>
Expand Down

0 comments on commit 6b9d8f7

Please sign in to comment.