@@ -46,6 +46,8 @@ export function Workspace() {
4646 const workspaceCreateTemplateInput = useRef ( )
4747 const intl = useIntl ( )
4848 const cloneUrlRef = useRef < HTMLInputElement > ( )
49+ const config = global . plugin . registry . get ( 'config' ) . api
50+ const corsproxyUrlRef = useRef < HTMLInputElement > ( )
4951 const initGitRepoRef = useRef < HTMLInputElement > ( )
5052 const filteredBranches = selectedWorkspace ? ( selectedWorkspace . branches || [ ] ) . filter ( ( branch ) => branch . name . includes ( branchFilter ) && branch . name !== 'HEAD' ) . slice ( 0 , 20 ) : [ ]
5153 const currentBranch = selectedWorkspace ? selectedWorkspace . currentBranch : null
@@ -554,6 +556,11 @@ export function Workspace() {
554556
555557 const handleTypingUrl = ( ) => {
556558 const url = cloneUrlRef . current . value
559+ const corsproxy = corsproxyUrlRef . current . value
560+
561+ if ( corsproxy ) {
562+ config . set ( 'corsproxy' , corsproxy )
563+ }
557564
558565 if ( url ) {
559566 global . dispatchCloneRepository ( url )
@@ -1041,6 +1048,7 @@ export function Workspace() {
10411048 const cloneModalMessage = ( ) => {
10421049 return (
10431050 < >
1051+ < div > < FormattedMessage id = "filePanel.workspace.gitRepoUrl" /> </ div >
10441052 < input
10451053 type = "text"
10461054 data-id = "modalDialogCustomPromptTextClone"
@@ -1050,6 +1058,43 @@ export function Workspace() {
10501058 ref = { cloneUrlRef }
10511059 className = "form-control"
10521060 />
1061+ < div className = "pt-4" > < FormattedMessage id = "filePanel.workspace.corsProxyUrl" /> </ div >
1062+ < input
1063+ type = "text"
1064+ data-id = "modalDialogCustomPromptTextCorsproxy"
1065+ placeholder = { intl . formatMessage ( {
1066+ id : 'filePanel.workspace.enterCorsproxyUrl'
1067+ } ) }
1068+ ref = { corsproxyUrlRef }
1069+ defaultValue = { config . get ( 'corsproxy' ) }
1070+ className = "form-control"
1071+ />
1072+ < div className = "pt-2" >
1073+ < FormattedMessage id = "filePanel.workspace.corsproxyText1" />
1074+ < div className = "p-1 pl-3" >
1075+ < b > npm install -g @drafish/cors-proxy</ b >
1076+ </ div >
1077+ < div className = "p-1 pl-3" >
1078+ < b > cors-proxy start</ b >
1079+ </ div >
1080+ < div className = "pt-2" >
1081+ < FormattedMessage
1082+ id = "filePanel.workspace.corsproxyText2"
1083+ />
1084+ </ div >
1085+ < div className = "pt-2" >
1086+ < FormattedMessage
1087+ id = "filePanel.workspace.corsproxyText3"
1088+ values = { {
1089+ a : ( chunks ) => (
1090+ < a href = "https://github.com/drafish/cors-proxy" target = "_blank" >
1091+ { chunks }
1092+ </ a >
1093+ )
1094+ } }
1095+ />
1096+ </ div >
1097+ </ div >
10531098 </ >
10541099 )
10551100 }
0 commit comments