@@ -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 )
@@ -905,6 +912,7 @@ export function Workspace() {
905912 const cloneModalMessage = ( ) => {
906913 return (
907914 < >
915+ < div > < FormattedMessage id = "filePanel.workspace.gitRepoUrl" /> </ div >
908916 < input
909917 type = "text"
910918 data-id = "modalDialogCustomPromptTextClone"
@@ -914,6 +922,43 @@ export function Workspace() {
914922 ref = { cloneUrlRef }
915923 className = "form-control"
916924 />
925+ < div className = "pt-4" > < FormattedMessage id = "filePanel.workspace.corsProxyUrl" /> </ div >
926+ < input
927+ type = "text"
928+ data-id = "modalDialogCustomPromptTextCorsproxy"
929+ placeholder = { intl . formatMessage ( {
930+ id : 'filePanel.workspace.enterCorsproxyUrl'
931+ } ) }
932+ ref = { corsproxyUrlRef }
933+ defaultValue = { config . get ( 'corsproxy' ) }
934+ className = "form-control"
935+ />
936+ < div className = "pt-2" >
937+ < FormattedMessage id = "filePanel.workspace.corsproxyText1" />
938+ < div className = "p-1 pl-3" >
939+ < b > npm install -g @drafish/cors-proxy</ b >
940+ </ div >
941+ < div className = "p-1 pl-3" >
942+ < b > cors-proxy start</ b >
943+ </ div >
944+ < div className = "pt-2" >
945+ < FormattedMessage
946+ id = "filePanel.workspace.corsproxyText2"
947+ />
948+ </ div >
949+ < div className = "pt-2" >
950+ < FormattedMessage
951+ id = "filePanel.workspace.corsproxyText3"
952+ values = { {
953+ a : ( chunks ) => (
954+ < a href = "https://github.com/drafish/cors-proxy" target = "_blank" >
955+ { chunks }
956+ </ a >
957+ )
958+ } }
959+ />
960+ </ div >
961+ </ div >
917962 </ >
918963 )
919964 }
0 commit comments