@@ -45,6 +45,24 @@ export async function resetAuth() {
4545 }
4646}
4747
48+ export async function openDefaultFolder ( ) {
49+ console . log ( "opening defauilt" ) ;
50+ let uriValue = "https://dav.puter.com/" + await fetch ( "/syscall/getUsername" ) . then ( r => r . text ( ) ) ;
51+ let name = uriValue . split ( "/" ) . pop ( )
52+ let webdavUri = vscode . Uri . parse ( uriValue . trim ( ) . replace ( / ^ h t t p / i, 'webdav' ) ) ;
53+
54+
55+ await configureAuthForUri ( toBaseUri ( webdavUri ) ) ;
56+
57+ vscode . workspace . updateWorkspaceFolders (
58+ 0 , 0 ,
59+ {
60+ uri : webdavUri ,
61+ name : name ?. trim ( ) ?? webdavUri . authority ,
62+ } ,
63+ ) ;
64+ }
65+
4866export async function openWebdav ( ) {
4967 let uriValue = await fetch ( "/syscall/getFolderPicker" ) . then ( r => r . text ( ) ) ;
5068
@@ -76,6 +94,7 @@ export async function openWebdav() {
7694}
7795
7896export async function activate ( context : vscode . ExtensionContext ) {
97+ console . log ( "registering webdav workspace" )
7998 context . subscriptions . push (
8099 outputChannel = vscode . window . createOutputChannel ( 'WebDAV Workspaces' )
81100 ) ;
@@ -91,13 +110,15 @@ export async function activate(context: vscode.ExtensionContext) {
91110 vscode . workspace . registerFileSystemProvider ( scheme , new WebDAVFileSystemProvider ( ) , { isCaseSensitive : true } )
92111 ) ;
93112 }
113+ console . log ( "registering commands" )
94114
95115 log ( `Register extension.remote.webdav.resetAuth command... ` ) ;
96116 context . subscriptions . push ( vscode . commands . registerCommand ( 'extension.remote.webdav.resetAuth' , resetAuth ) ) ;
97117
98118 log ( `Register extension.remote.webdav.open command... ` ) ;
99119 context . subscriptions . push ( vscode . commands . registerCommand ( 'extension.remote.webdav.open' , openWebdav ) ) ;
100-
120+ console . log ( "doing the default folder" )
121+ openDefaultFolder ( ) ;
101122 outputChannel . appendLine ( 'Extension has been initialized.' ) ;
102123}
103124
0 commit comments