@@ -33,14 +33,14 @@ isFilesystemReady().then(async () => {
3333 // );
3434} ) ;
3535
36- const query = location . search
37- . slice ( 1 )
38- . split ( '&' )
39- . reduce < Record < string , string > > ( ( obj , pair ) => {
40- const [ key , value ] = pair . split ( '=' ) ;
41- obj [ decodeURIComponent ( key ) ] = decodeURIComponent ( value || '' ) ;
42- return obj ;
43- } , { } ) ;
36+ // const query = location.search
37+ // .slice(1)
38+ // .split('&')
39+ // .reduce<Record<string, string>>((obj, pair) => {
40+ // const [key, value] = pair.split('=');
41+ // obj[decodeURIComponent(key)] = decodeURIComponent(value || '');
42+ // return obj;
43+ // }, {});
4444
4545const platformConfig = {
4646 antcode : {
@@ -70,17 +70,21 @@ const platformConfig = {
7070
7171const layoutConfig = getDefaultLayoutConfig ( ) ;
7272
73- const platform = ( Object . keys ( platformConfig ) . includes ( query . platform )
74- ? query . platform
75- : 'antcode' ) as CodeServiceConfig [ 'platform' ] ;
73+ let pathParts = location . pathname . split ( '/' ) . filter ( Boolean ) ;
74+
75+ const platform = pathParts [ 0 ] in platformConfig ? pathParts [ 0 ] : 'antcode' ;
76+
77+ // const platform = (Object.keys(platformConfig).includes(query.platform)
78+ // ? query.platform
79+ // : 'antcode') as CodeServiceConfig['platform'];
7680const { module : CodeAPIModule , ...config } = platformConfig [ platform ] ;
77- if ( query . project ) {
78- const [ owner , name ] = decodeURIComponent ( query . project ) . split ( '/' ) ;
79- Object . assign ( config , { owner, name } ) ;
81+ if ( pathParts [ 1 ] ) {
82+ config . owner = pathParts [ 1 ] ;
83+ }
84+ if ( pathParts [ 2 ] ) {
85+ config . name = pathParts [ 2 ] ;
8086}
81- delete query . platform ;
82- delete query . project ;
83- Object . assign ( config , query ) ;
87+ config . refPath = pathParts . slice ( 3 ) . join ( '/' ) ;
8488
8589if ( platform === 'github' || platform === 'gitlab' ) {
8690 layoutConfig [ SlotLocation . left ] . modules . push ( platform ) ;
@@ -96,11 +100,7 @@ const App = () => (
96100 extensionMetadata : [ css , html , json , markdown , typescript ] ,
97101 workspaceDir : `${ platform } /${ config . owner } /${ config . name } ` ,
98102 layoutConfig,
99- defaultPreferences : {
100- 'editor.readonlyFiles' : [
101- '/workspace/antcode/internal_release/ifcriskcloudus/app/plugin/tcomponent/src/main/java/com/alipay/fc/riskcloud/plugin/tcomponent/util/StrategyDrmParserUtil.java' ,
102- ] ,
103- } ,
103+ defaultPreferences : { } ,
104104 } }
105105 runtimeConfig = { {
106106 codeService : config as CodeServiceConfig ,
0 commit comments