@@ -44,6 +44,8 @@ export function Workspace() {
4444 const workspaceCreateTemplateInput = useRef ( )
4545 const intl = useIntl ( )
4646 const cloneUrlRef = useRef < HTMLInputElement > ( )
47+ const config = global . plugin . registry . get ( 'config' ) . api
48+ const corsproxyUrlRef = useRef < HTMLInputElement > ( )
4749 const initGitRepoRef = useRef < HTMLInputElement > ( )
4850 const filteredBranches = selectedWorkspace ? ( selectedWorkspace . branches || [ ] ) . filter ( ( branch ) => branch . name . includes ( branchFilter ) && branch . name !== 'HEAD' ) . slice ( 0 , 20 ) : [ ]
4951 const currentBranch = selectedWorkspace ? selectedWorkspace . currentBranch : null
@@ -395,6 +397,11 @@ export function Workspace() {
395397
396398 const handleTypingUrl = ( ) => {
397399 const url = cloneUrlRef . current . value
400+ const corsproxy = corsproxyUrlRef . current . value
401+
402+ if ( corsproxy ) {
403+ config . set ( 'corsproxy' , corsproxy )
404+ }
398405
399406 if ( url ) {
400407 global . dispatchCloneRepository ( url )
@@ -870,6 +877,7 @@ export function Workspace() {
870877 const cloneModalMessage = ( ) => {
871878 return (
872879 < >
880+ < div > < FormattedMessage id = "filePanel.workspace.gitRepoUrl" /> </ div >
873881 < input
874882 type = "text"
875883 data-id = "modalDialogCustomPromptTextClone"
@@ -879,6 +887,43 @@ export function Workspace() {
879887 ref = { cloneUrlRef }
880888 className = "form-control"
881889 />
890+ < div className = "pt-4" > < FormattedMessage id = "filePanel.workspace.corsProxyUrl" /> </ div >
891+ < input
892+ type = "text"
893+ data-id = "modalDialogCustomPromptTextCorsproxy"
894+ placeholder = { intl . formatMessage ( {
895+ id : 'filePanel.workspace.enterCorsproxyUrl'
896+ } ) }
897+ ref = { corsproxyUrlRef }
898+ defaultValue = { config . get ( 'corsproxy' ) }
899+ className = "form-control"
900+ />
901+ < div className = "pt-2" >
902+ < FormattedMessage id = "filePanel.workspace.corsproxyText1" />
903+ < div className = "p-1 pl-3" >
904+ < b > npm install -g @drafish/cors-proxy</ b >
905+ </ div >
906+ < div className = "p-1 pl-3" >
907+ < b > cors-proxy start</ b >
908+ </ div >
909+ < div className = "pt-2" >
910+ < FormattedMessage
911+ id = "filePanel.workspace.corsproxyText2"
912+ />
913+ </ div >
914+ < div className = "pt-2" >
915+ < FormattedMessage
916+ id = "filePanel.workspace.corsproxyText3"
917+ values = { {
918+ a : ( chunks ) => (
919+ < a href = "https://github.com/drafish/cors-proxy" target = "_blank" >
920+ { chunks }
921+ </ a >
922+ )
923+ } }
924+ />
925+ </ div >
926+ </ div >
882927 </ >
883928 )
884929 }
0 commit comments