ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / code / browser / workbench / workbench.ts 630 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
import { isStandalone } from '../../../base/browser/browser.js' ;
import { addDisposableListener } from '../../../base/browser/dom.js' ;
import { mainWindow } from '../../../base/browser/window.js' ;
import { VSBuffer, decodeBase64, encodeBase64 } from '../../../base/common/buffer.js' ;
import { Emitter } from '../../../base/common/event.js' ;
import { Disposable, IDisposable } from '../../../base/common/lifecycle.js' ;
import { parse } from '../../../base/common/marshalling.js' ;
Schemas
posix
isEqual
ltrim
UriComponents
product
ISecretStorageProvider
isFolderToOpen isWorkspaceToOpen
IWorkbenchConstructionOptions IWorkspace IWorkspaceProvider
AuthenticationSessionInfo
IURLCallbackProvider
create
data
data
data
data
data
data
AESConstants
inner Error
inner message
name inner name
stack inner stack
serverKey Uint8Array
crypto subtle
authEndpoint
data
iv mainWindow crypto AESConstants
clientKeyObj mainWindow crypto subtle
name AESConstants length AESConstants
clientKey mainWindow crypto subtle clientKeyObj
key clientKey
dataUint8Array data
cipherText ArrayBuffer mainWindow crypto subtle
name AESConstants iv
key
dataUint8Array
result clientKey iv cipherText
VSBuffer result
data
dataUint8Array data
dataUint8Array byteLength
keyLength AESConstants
clientKey dataUint8Array keyLength
iv dataUint8Array keyLength keyLength AESConstants
cipherText dataUint8Array keyLength AESConstants
key clientKey buffer
decrypted mainWindow crypto subtle
name AESConstants iv iv buffer Uint8Array ArrayBuffer
key
cipherText buffer Uint8Array ArrayBuffer
decrypted
clientKey Uint8Array CryptoKey
clientKey clientKey byteLength AESConstants
serverKey
keyData AESConstants
i
id authSessionInfo id
scopes
accessToken authSessionInfo accessToken
record
key
secrets secretsPromise
secrets key
key value
secrets secretsPromise
secrets key value
secretsPromise secrets
key
secrets secretsPromise
secrets key
secretsPromise secrets
secrets secretsPromise
Object secrets
encrypted crypto secretsPromise
localStorage storageKey encrypted
err
err
_onCallback
onCallback _onCallback event
pendingCallbacks
lastTimeChecked Date
checkCallbacksTimeout Timeout
onDidChangeLocalStorageDisposable IDisposable
_callbackRoute
options Partial UriComponents
id LocalStorageURLCallbackProvider
queryParams
key LocalStorageURLCallbackProvider
value options key
value
queryParams
options authority options path
key
localStorage key
pendingCallbacks id
mainWindow location href path _callbackRoute query queryParams
onDidChangeLocalStorageDisposable
onDidChangeLocalStorageDisposable mainWindow
onDidChangeLocalStorageDisposable
onDidChangeLocalStorageDisposable
ellapsed Date lastTimeChecked
ellapsed
checkCallbacksTimeout
checkCallbacksTimeout
checkCallbacksTimeout
ellapsed
pendingCallbacks Set
id pendingCallbacks
key
result localStorage key
result
_onCallback result
error
error
pendingCallbacks pendingCallbacks pendingCallbacks
pendingCallbacks id
localStorage key
pendingCallbacks
pendingCallbacks pendingCallbacks
pendingCallbacks size
lastTimeChecked Date
override
checkCallbacksTimeout
config IWorkbenchConstructionOptions folderUri UriComponents workspaceUri UriComponents
foundWorkspace
workspace IWorkspace
payload Object
query document location href searchParams
query value key
key
WorkspaceProvider
config remoteAuthority value posix sep
workspace folderUri scheme Schemas vscodeRemote path value authority config remoteAuthority
workspace folderUri value
foundWorkspace
WorkspaceProvider
config remoteAuthority value posix sep
workspace workspaceUri scheme Schemas vscodeRemote path value authority config remoteAuthority
workspace workspaceUri value
foundWorkspace
WorkspaceProvider
workspace
foundWorkspace
WorkspaceProvider
payload value
error
error
foundWorkspace
config folderUri
workspace folderUri config folderUri
config workspaceUri
workspace workspaceUri config workspaceUri
workspace payload config
trusted
workspace IWorkspace
payload object
config IWorkbenchConstructionOptions
workspace IWorkspace options reuse payload object
options reuse options payload workspace workspace
targetHref workspace options
targetHref
options reuse
mainWindow location href targetHref
result
result mainWindow targetHref
result mainWindow targetHref
result
workspace IWorkspace options reuse payload object
targetHref
workspace
targetHref
workspace
queryParamFolder workspace folderUri
targetHref
workspace
queryParamWorkspace workspace workspaceUri
targetHref
options payload
targetHref
targetHref
uri
config remoteAuthority uri scheme Schemas vscodeRemote
uri
workspaceA IWorkspace workspaceB IWorkspace
workspaceA workspaceB
workspaceA workspaceB
workspaceA workspaceB
workspaceA folderUri workspaceB folderUri
workspaceA workspaceB
workspaceA workspaceUri workspaceB workspaceUri
workspace
workspace
workspace folderUri scheme Schemas vscodeRemote
workspace
workspace workspaceUri scheme Schemas vscodeRemote
name
cookies document cookie
cookie cookies
cookie name
cookie name length
configElement mainWindow document
configElementAttribute configElement configElement
configElement configElementAttribute
config IWorkbenchConstructionOptions folderUri UriComponents workspaceUri UriComponents callbackRoute configElementAttribute
secretStorageKeyPath
secretStorageCrypto secretStorageKeyPath ServerKeyedAESCrypto
secretStorageKeyPath
mainWindow document body
config
windowIndicator config windowIndicator label tooltip
settingsSyncOptions config settingsSyncOptions enabled config settingsSyncOptions enabled
workspaceProvider WorkspaceProvider config
urlCallbackProvider config callbackRoute
secretStorageProvider config remoteAuthority secretStorageKeyPath
secretStorageCrypto
import
{
}
from
'../../../base/common/network.js'
;
import
{
}
from
'../../../base/common/path.js'
;
import
{
}
from
'../../../base/common/resources.js'
;
import
{
}
from
'../../../base/common/strings.js'
;
import
{
URI
,
}
from
'../../../base/common/uri.js'
;
import
from
'../../../platform/product/common/product.js'
;
import
{
}
from
'../../../platform/secrets/common/secrets.js'
;
import
{
,
}
from
'../../../platform/window/common/window.js'
;
import
type
{
,
,
}
from
'../../../workbench/browser/web.api.js'
;
import
{
}
from
'../../../workbench/services/authentication/browser/authenticationService.js'
;
import
type
{
}
from
'../../../workbench/services/url/browser/urlService.js'
;
import
{
}
from
'../../../workbench/workbench.web.main.internal.js'
;
interface
ISecretStorageCrypto
{
seal
(
:
string
)
:
Promise
<
string
>
;
unseal
(
:
string
)
:
Promise
<
string
>
;
}
class
TransparentCrypto
implements
ISecretStorageCrypto
{
async
seal
(
:
string
)
:
Promise
<
string
>
{
return
;
}
async
unseal
(
:
string
)
:
Promise
<
string
>
{
return
;
}
}
const
enum
{
ALGORITHM
=
'AES-GCM'
,
KEY_LENGTH
=
256
,
IV_LENGTH
=
12
,
}
class
NetworkError
extends
Error
{
constructor
(
:
)
{
super
(
.
)
;
this
.
=
.
;
this
.
=
.
;
}
}
class
ServerKeyedAESCrypto
implements
ISecretStorageCrypto
{
private
:
|
undefined
;
static
supported
(
)
{
return
!
!
.
;
}
constructor
(
private
readonly
:
string
)
{
}
async
seal
(
:
string
)
:
Promise
<
string
>
{
const
=
.
.
getRandomValues
(
new
Uint8Array
(
.
IV_LENGTH
)
)
;
const
=
await
.
.
.
generateKey
(
{
:
.
ALGORITHM
as
const
,
:
.
KEY_LENGTH
as
const
}
,
true
,
[
'encrypt'
,
'decrypt'
]
)
;
const
=
new
Uint8Array
(
await
.
.
.
exportKey
(
'raw'
,
)
)
;
const
=
await
this
.
getKey
(
)
;
const
=
new
TextEncoder
(
)
.
encode
(
)
;
const
:
=
await
.
.
.
encrypt
(
{
:
.
ALGORITHM
as
const
,
}
,
,
)
;
const
=
new
Uint8Array
(
[
...
,
...
,
...
new
Uint8Array
(
)
]
)
;
return
encodeBase64
(
.
wrap
(
)
)
;
}
async
unseal
(
:
string
)
:
Promise
<
string
>
{
const
=
decodeBase64
(
)
;
if
(
.
<
60
)
{
throw
Error
(
'Invalid length for the value for credentials.crypto'
)
;
}
const
=
.
KEY_LENGTH
/
8
;
const
=
.
slice
(
0
,
)
;
const
=
.
slice
(
,
+
.
IV_LENGTH
)
;
const
=
.
slice
(
+
.
IV_LENGTH
)
;
const
=
await
this
.
getKey
(
.
)
;
const
=
await
.
.
.
decrypt
(
{
:
.
ALGORITHM
as
const
,
:
.
as
<
>
}
,
,
.
as
<
>
)
;
return
new
TextDecoder
(
)
.
decode
(
new
Uint8Array
(
)
)
;
}
private
async
getKey
(
:
)
:
Promise
<
>
{
if
(
!
||
.
!==
.
KEY_LENGTH
/
8
)
{
throw
Error
(
'Invalid length for clientKey'
)
;
}
const
=
await
this
.
getServerKeyPart
(
)
;
const
=
new
Uint8Array
(
.
KEY_LENGTH
/
8
)
;
for
(
let
=
0
;
i < keyData. byteLength; i++ ) {
keyData[ i] = clientKey[ i] ^ serverKey[ i] ;
}
return mainWindow. crypto. subtle. importKey (
'raw' ,
keyData,
{
name: AESConstants. ALGORITHM as const ,
length: AESConstants. KEY_LENGTH as const ,
} ,
true ,
[ 'encrypt' , 'decrypt' ]
) ;
}
private async getServerKeyPart ( ) : Promise < Uint8Array> {
if ( this . serverKey) {
return this . serverKey;
}
let attempt = 0 ;
let lastError: Error | undefined ;
while ( attempt <= 3 ) {
try {
const res = await fetch ( this . authEndpoint, { credentials: 'include' , method: 'POST' } ) ;
if ( ! res. ok) {
throw new Error ( res. statusText) ;
}
const serverKey = new Uint8Array ( await res. arrayBuffer ( ) ) ;
if ( serverKey. byteLength !== AESConstants. KEY_LENGTH / 8 ) {
throw Error ( ` The key retrieved by the server is not ${ AESConstants. KEY_LENGTH } bit long. ` ) ;
}
this . serverKey = serverKey;
return this . serverKey;
} catch ( e) {
lastError = e instanceof Error ? e : new Error ( String ( e) ) ;
attempt++ ;
await new Promise ( resolve => setTimeout ( resolve, attempt * attempt * 100 ) ) ;
}
}
if ( lastError) {
throw new NetworkError ( lastError) ;
}
throw new Error ( 'Unknown error' ) ;
}
}
export class LocalStorageSecretStorageProvider implements ISecretStorageProvider {
private readonly storageKey = 'secrets.provider' ;
private secretsPromise: Promise < Record< string , string >> ;
type: 'in-memory' | 'persisted' | 'unknown' = 'persisted' ;
constructor (
private readonly crypto: ISecretStorageCrypto,
) {
this . secretsPromise = this . load ( ) ;
}
private async load ( ) : Promise < Record< string , string >> {
const record = this . loadAuthSessionFromElement ( ) ;
const encrypted = localStorage. getItem ( this . storageKey) ;
if ( encrypted) {
try {
const decrypted = JSON . parse ( await this . crypto. unseal ( encrypted) ) ;
return { ... record, ... decrypted } ;
} catch ( err) {
console . error ( 'Failed to decrypt secrets from localStorage' , err) ;
if ( ! ( err instanceof NetworkError) ) {
localStorage. removeItem ( this . storageKey) ;
}
}
}
return record;
}
private loadAuthSessionFromElement ( ) : Record< string , string > {
let authSessionInfo: ( AuthenticationSessionInfo & { scopes: string [ ] [ ] } ) | undefined ;
const authSessionElement = mainWindow. document. getElementById ( 'vscode-workbench-auth-session' ) ;
const authSessionElementAttribute = authSessionElement ? authSessionElement. getAttribute ( 'data-settings' ) : undefined ;
if ( authSessionElementAttribute) {
try {
authSessionInfo = JSON . parse ( authSessionElementAttribute) ;
} catch ( error) { }
}
if ( ! authSessionInfo) {
return { } ;
}
const record: Record< string , string > = { } ;
record[ ` ${ product. urlProtocol} .loginAccount ` ] = JSON . stringify ( authSessionInfo) ;
if ( authSessionInfo. providerId !== 'github' ) {
console . error ( ` Unexpected auth provider: ${ authSessionInfo. providerId} . Expected 'github'. ` ) ;
return record;
}
const authAccount = JSON . stringify ( { extensionId: 'vscode.github-authentication' , key: 'github.auth' } ) ;
record[ authAccount] = JSON . stringify ( authSessionInfo. scopes. map ( scopes =>
(
{
:
.
,
,
:
.
}
)
)
)
;
return
;
}
async
get
(
:
string
)
:
Promise
<
string
|
undefined
>
{
const
=
await
this
.
;
return
[
]
;
}
async
set
(
:
string
,
:
string
)
:
Promise
<
void
>
{
const
=
await
this
.
;
[
]
=
;
this
.
=
Promise
.
resolve
(
)
;
this
.
save
(
)
;
}
async
delete
(
:
string
)
:
Promise
<
void
>
{
const
=
await
this
.
;
delete
[
]
;
this
.
=
Promise
.
resolve
(
)
;
this
.
save
(
)
;
}
async
keys
(
)
:
Promise
<
string
[
]
>
{
const
=
await
this
.
;
return
.
keys
(
)
||
[
]
;
}
private
async
save
(
)
:
Promise
<
void
>
{
try
{
const
=
await
this
.
.
seal
(
JSON
.
stringify
(
await
this
.
)
)
;
.
setItem
(
this
.
,
)
;
}
catch
(
)
{
console
.
error
(
)
;
}
}
}
class
LocalStorageURLCallbackProvider
extends
Disposable
implements
IURLCallbackProvider
{
private
static
REQUEST_ID
=
0
;
private
static
QUERY_KEYS
:
(
'scheme'
|
'authority'
|
'path'
|
'query'
|
'fragment'
)
[
]
=
[
'scheme'
,
'authority'
,
'path'
,
'query'
,
'fragment'
]
;
private
readonly
=
this
.
_register
(
new
Emitter< URI >
(
)
)
;
readonly
=
this
.
.
;
private
=
new
Set< number >
(
)
;
private
=
.
now
(
)
;
private
:
|
undefined
=
undefined
;
private
:
|
undefined
;
constructor
(
private
readonly
:
string
)
{
super
(
)
;
}
create
(
:
<
>
=
{
}
)
:
URI
{
const
=
++
.
REQUEST_ID
;
const
:
string
[
]
=
[
` vscode-reqid= ${ id} `
]
;
for
(
const
of
.
QUERY_KEYS
)
{
const
=
[
]
;
if
(
)
{
.
push
(
` vscode- ${ key} = ${ encodeURIComponent ( value) } `
)
;
}
}
if
(
!
(
.
===
'vscode.github-authentication'
&&
.
===
'/dummy'
)
)
{
const
=
` vscode-web.url-callbacks[ ${ id} ] `
;
.
removeItem
(
)
;
this
.
.
add
(
)
;
this
.
startListening
(
)
;
}
return
URI
.
parse
(
.
.
)
.
with
(
{
:
this
.
,
:
.
join
(
'&'
)
}
)
;
}
private
startListening
(
)
:
void
{
if
(
this
.
)
{
return
;
}
this
.
=
addDisposableListener
(
,
'storage'
,
(
)
=>
this
.
onDidChangeLocalStorage
(
)
)
;
}
private
stopListening
(
)
:
void
{
this
.
?.
dispose
(
)
;
this
.
=
undefined
;
}
private
async
onDidChangeLocalStorage
(
)
:
Promise
<
void
>
{
const
=
.
now
(
)
-
this
.
;
if
(
>
1000
)
{
this
.
checkCallbacks
(
)
;
}
else
if
(
this
.
===
undefined
)
{
this
.
=
setTimeout
(
(
)
=>
{
this
.
=
undefined
;
this
.
checkCallbacks
(
)
;
}
,
1000
-
)
;
}
}
private
checkCallbacks
(
)
:
void
{
let
:
<
number
>
|
undefined
;
for
(
const
of
this
.
)
{
const
=
` vscode-web.url-callbacks[ ${ id} ] `
;
const
=
.
getItem
(
)
;
if
(
!==
null
)
{
try
{
this
.
.
fire
(
URI
.
revive
(
JSON
.
parse
(
)
)
)
;
}
catch
(
)
{
console
.
error
(
)
;
}
=
??
new
Set
(
this
.
)
;
.
delete
(
)
;
.
removeItem
(
)
;
}
}
if
(
)
{
this
.
=
;
if
(
this
.
.
===
0
)
{
this
.
stopListening
(
)
;
}
}
this
.
=
.
now
(
)
;
}
dispose
(
)
:
void
{
clearTimeout
(
this
.
)
;
this
.
stopListening
(
)
;
super
.
dispose
(
)
;
}
}
class
WorkspaceProvider
implements
IWorkspaceProvider
{
private
static
QUERY_PARAM_EMPTY_WINDOW
=
'ew'
;
private
static
QUERY_PARAM_FOLDER
=
'folder'
;
private
static
QUERY_PARAM_WORKSPACE
=
'workspace'
;
private
static
QUERY_PARAM_PAYLOAD
=
'payload'
;
static
create
(
:
&
{
?
:
;
?
:
}
)
{
let
=
false
;
let
:
;
let
=
.
create
(
null
)
;
const
=
new
URL
(
.
.
)
.
;
.
forEach
(
(
,
)
=>
{
switch
(
)
{
case
.
QUERY_PARAM_FOLDER
:
if
(
.
&&
.
startsWith
(
.
)
)
{
=
{
:
URI
.
from
(
{
:
.
,
:
,
:
.
}
)
}
;
}
else
{
=
{
:
URI
.
parse
(
)
}
;
}
=
true
;
break
;
case
.
QUERY_PARAM_WORKSPACE
:
if
(
.
&&
.
startsWith
(
.
)
)
{
=
{
:
URI
.
from
(
{
:
.
,
:
,
:
.
}
)
}
;
}
else
{
=
{
:
URI
.
parse
(
)
}
;
}
=
true
;
break
;
case
.
QUERY_PARAM_EMPTY_WINDOW
:
=
undefined
;
=
true
;
break
;
case
.
QUERY_PARAM_PAYLOAD
:
try
{
=
parse
(
)
;
}
catch
(
)
{
console
.
error
(
)
;
}
break
;
}
}
)
;
if
(
!
)
{
if
(
.
)
{
=
{
:
URI
.
revive
(
.
)
}
;
}
else
if
(
.
)
{
=
{
:
URI
.
revive
(
.
)
}
;
}
}
return
new
WorkspaceProvider
(
,
,
)
;
}
readonly
=
true
;
private
constructor
(
readonly
:
,
readonly
:
,
private
readonly
:
)
{
}
async
open
(
:
,
?
:
{
?
:
boolean
;
?
:
}
)
:
Promise
<
boolean
>
{
if
(
?.
&&
!
.
&&
this
.
isSame
(
this
.
,
)
)
{
return
true
;
}
const
=
this
.
createTargetUrl
(
,
)
;
if
(
)
{
if
(
?.
)
{
.
.
=
;
return
true
;
}
else
{
let
;
if
(
isStandalone
(
)
)
{
=
.
open
(
,
'_blank'
,
'toolbar=no'
)
;
}
else
{
=
.
open
(
)
;
}
return
!
!
;
}
}
return
false
;
}
private
createTargetUrl
(
:
,
?
:
{
?
:
boolean
;
?
:
}
)
:
string
|
undefined
{
let
:
string
|
undefined
=
undefined
;
if
(
!
)
{
=
` ${ document. location. origin} ${ document. location. pathname} ? ${ WorkspaceProvider. QUERY_PARAM_EMPTY_WINDOW } =true `
;
}
else
if
(
isFolderToOpen
(
)
)
{
const
=
this
.
encodeWorkspacePath
(
.
)
;
=
` ${ document. location. origin} ${ document. location. pathname} ? ${ WorkspaceProvider. QUERY_PARAM_FOLDER } = ${ queryParamFolder} `
;
}
else
if
(
isWorkspaceToOpen
(
)
)
{
const
=
this
.
encodeWorkspacePath
(
.
)
;
=
` ${ document. location. origin} ${ document. location. pathname} ? ${ WorkspaceProvider. QUERY_PARAM_WORKSPACE } = ${ queryParamWorkspace} `
;
}
if
(
?.
)
{
+=
` & ${ WorkspaceProvider. QUERY_PARAM_PAYLOAD } = ${ encodeURIComponent ( JSON . stringify ( options. payload) ) } `
;
}
return
;
}
private
encodeWorkspacePath
(
:
URI
)
:
string
{
if
(
this
.
.
&&
.
===
.
)
{
return
encodeURIComponent
(
` ${ posix. sep} ${ ltrim ( uri. path, posix. sep) } `
)
.
replaceAll
(
'%2F'
,
'/'
)
;
}
return
encodeURIComponent
(
.
toString
(
true
)
)
;
}
private
isSame
(
:
,
:
)
:
boolean
{
if
(
!
||
!
)
{
return
===
;
}
if
(
isFolderToOpen
(
)
&&
isFolderToOpen
(
)
)
{
return
isEqual
(
.
,
.
)
;
}
if
(
isWorkspaceToOpen
(
)
&&
isWorkspaceToOpen
(
)
)
{
return
isEqual
(
.
,
.
)
;
}
return
false
;
}
hasRemote
(
)
:
boolean
{
if
(
this
.
)
{
if
(
isFolderToOpen
(
this
.
)
)
{
return
this
.
.
.
===
.
;
}
if
(
isWorkspaceToOpen
(
this
.
)
)
{
return
this
.
.
.
===
.
;
}
}
return
true
;
}
}
function
readCookie
(
:
string
)
:
string
|
undefined
{
const
=
.
.
split
(
'; '
)
;
for
(
const
of
)
{
if
(
.
startsWith
(
+
'='
)
)
{
return
.
substring
(
.
+
1
)
;
}
}
return
undefined
;
}
(
function
(
)
{
const
=
.
.
getElementById
(
'vscode-workbench-web-configuration'
)
;
const
=
?
.
getAttribute
(
'data-settings'
)
:
undefined
;
if
(
!
||
!
)
{
throw
new
Error
(
'Missing web configuration element'
)
;
}
const
:
&
{
?
:
;
?
:
;
:
string
}
=
JSON
.
parse
(
)
;
const
=
readCookie
(
'vscode-secret-key-path'
)
;
const
=
&&
.
supported
(
)
?
new
ServerKeyedAESCrypto
(
)
:
new
TransparentCrypto
(
)
;
create
(
.
.
,
{
...
,
:
.
??
{
:
'$(remote)'
,
:
` ${ product. nameShort} Web `
}
,
:
.
?
{
:
.
.
,
}
:
undefined
,
:
.
create
(
)
,
:
new
LocalStorageURLCallbackProvider
(
.
)
,
:
.
&&
!
?
undefined
:
new
LocalStorageSecretStorageProvider
(
)
,
}
)
;
}
)
(
)
;