@@ -49,6 +49,8 @@ export function Workspace() {
4949 const workspaceCreateTemplateInput = useRef ( )
5050 const intl = useIntl ( )
5151 const cloneUrlRef = useRef < HTMLInputElement > ( )
52+ const config = global . plugin . registry . get ( 'config' ) . api
53+ const corsproxyUrlRef = useRef < HTMLInputElement > ( )
5254 const initGitRepoRef = useRef < HTMLInputElement > ( )
5355 const filteredBranches = selectedWorkspace ? ( selectedWorkspace . branches || [ ] ) . filter ( ( branch ) => branch . name . includes ( branchFilter ) && branch . name !== 'HEAD' ) . slice ( 0 , 20 ) : [ ]
5456 const currentBranch = selectedWorkspace ? selectedWorkspace . currentBranch : null
@@ -423,6 +425,11 @@ export function Workspace() {
423425
424426 const handleTypingUrl = ( ) => {
425427 const url = cloneUrlRef . current . value
428+ const corsproxy = corsproxyUrlRef . current . value
429+
430+ if ( corsproxy ) {
431+ config . set ( 'corsproxy' , corsproxy )
432+ }
426433
427434 if ( url ) {
428435 global . dispatchCloneRepository ( url )
@@ -910,6 +917,7 @@ export function Workspace() {
910917 const cloneModalMessage = ( ) => {
911918 return (
912919 < >
920+ < div > < FormattedMessage id = "filePanel.workspace.gitRepoUrl" /> </ div >
913921 < input
914922 type = "text"
915923 data-id = "modalDialogCustomPromptTextClone"
@@ -919,6 +927,43 @@ export function Workspace() {
919927 ref = { cloneUrlRef }
920928 className = "form-control"
921929 />
930+ < div className = "pt-4" > < FormattedMessage id = "filePanel.workspace.corsProxyUrl" /> </ div >
931+ < input
932+ type = "text"
933+ data-id = "modalDialogCustomPromptTextCorsproxy"
934+ placeholder = { intl . formatMessage ( {
935+ id : 'filePanel.workspace.enterCorsproxyUrl'
936+ } ) }
937+ ref = { corsproxyUrlRef }
938+ defaultValue = { config . get ( 'corsproxy' ) }
939+ className = "form-control"
940+ />
941+ < div className = "pt-2" >
942+ < FormattedMessage id = "filePanel.workspace.corsproxyText1" />
943+ < div className = "p-1 pl-3" >
944+ < b > npm install -g @drafish/cors-proxy</ b >
945+ </ div >
946+ < div className = "p-1 pl-3" >
947+ < b > cors-proxy start</ b >
948+ </ div >
949+ < div className = "pt-2" >
950+ < FormattedMessage
951+ id = "filePanel.workspace.corsproxyText2"
952+ />
953+ </ div >
954+ < div className = "pt-2" >
955+ < FormattedMessage
956+ id = "filePanel.workspace.corsproxyText3"
957+ values = { {
958+ a : ( chunks ) => (
959+ < a href = "https://github.com/drafish/cors-proxy" target = "_blank" >
960+ { chunks }
961+ </ a >
962+ )
963+ } }
964+ />
965+ </ div >
966+ </ div >
922967 </ >
923968 )
924969 }
0 commit comments