33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- < < < << << HEAD
76import { createReadStream , promises , existsSync , writeFileSync } from 'fs' ;
8- === === =
9- import { createReadStream , existsSync , writeFileSync } from 'fs' ;
10- import { readFile } from 'fs/promises' ;
11- import { Promises } from 'vs/base/node/pfs' ;
12- import * as path from 'path' ;
13- >>> >>> > 34 c670ba ( Update patched - vscode )
147import * as http from 'http' ;
158import { spawn } from 'child_process' ;
169import * as fs from 'fs' ;
1710import * as url from 'url' ;
1811import * as cookie from 'cookie' ;
1912import * as crypto from 'crypto' ;
20- << < < < << HEAD
2113import { isEqualOrParent } from '../../base/common/extpath.js' ;
2214import { getMediaMime } from '../../base/common/mime.js' ;
2315import { isLinux } from '../../base/common/platform.js' ;
@@ -38,28 +30,6 @@ import { isString, Mutable } from '../../base/common/types.js';
3830import { CharCode } from '../../base/common/charCode.js' ;
3931import { IExtensionManifest } from '../../platform/extensions/common/extensions.js' ;
4032import { ICSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js' ;
41- === = ===
42- import { isEqualOrParent } from 'vs/base/common/extpath' ;
43- import { getMediaMime } from 'vs/base/common/mime' ;
44- import { isLinux } from 'vs/base/common/platform' ;
45- import { ILogService } from 'vs/platform/log/common/log' ;
46- import { IServerEnvironmentService } from 'vs/server/node/serverEnvironmentService' ;
47- import { extname, dirname, join, normalize } from 'vs/base/common/path' ;
48- import { FileAccess, connectionTokenCookieName, connectionTokenQueryName, Schemas, builtinExtensionsPath } from 'vs/base/common/network' ;
49- import { generateUuid } from 'vs/base/common/uuid' ;
50- import { IProductService } from 'vs/platform/product/common/productService' ;
51- import { ServerConnectionToken, ServerConnectionTokenType } from 'vs/server/node/serverConnectionToken' ;
52- import { asTextOrError, IRequestService } from 'vs/platform/request/common/request' ;
53- import { IHeaders } from 'vs/base/parts/request/common/request' ;
54- import { CancellationToken } from 'vs/base/common/cancellation' ;
55- import { URI } from 'vs/base/common/uri' ;
56- import { streamToBuffer } from 'vs/base/common/buffer' ;
57- import { IProductConfiguration } from 'vs/base/common/product' ;
58- import { isString } from 'vs/base/common/types' ;
59- import { getLocaleFromConfig, getNLSConfiguration } from 'vs/server/node/remoteLanguagePacks' ;
60- import { CharCode } from 'vs/base/common/charCode' ;
61- import { IExtensionManifest } from 'vs/platform/extensions/common/extensions' ;
62- >>> > >>> 34 c670ba ( Update patched - vscode )
6333
6434const textMimeType : { [ ext : string ] : string | undefined } = {
6535 '.html' : 'text/html' ,
@@ -408,7 +378,6 @@ export class WebClientServer {
408378 callbackRoute : callbackRoute
409379 } ;
410380
411- <<<<<<< HEAD
412381 const cookies = cookie . parse ( req . headers . cookie || '' ) ;
413382 const locale = cookies [ 'vscode.nls.locale' ] || req . headers [ 'accept-language' ] ?. split ( ',' ) [ 0 ] ?. toLowerCase ( ) || 'en' ;
414383 let WORKBENCH_NLS_BASE_URL : string | undefined ;
@@ -426,19 +395,6 @@ export class WebClientServer {
426395 WORKBENCH_WEB_BASE_URL : staticRoute ,
427396 WORKBENCH_NLS_URL ,
428397 WORKBENCH_NLS_FALLBACK_URL : `${ staticRoute } /out/nls.messages.js`
429- =======
430- const locale = this._environmentService.args.locale || await getLocaleFromConfig(this._environmentService.argvResource.fsPath);
431- const nlsConfiguration = await getNLSConfiguration(locale, this._environmentService.userDataPath)
432- const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl;
433- const values: { [key: string]: string } = {
434- WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
435- WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
436- WORKBENCH_WEB_BASE_URL: vscodeBase + this._staticRoute,
437- WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? ` $ { nlsBaseUrl } ${! nlsBaseUrl . endsWith ( '/' ) ? '/' : '' } ${this . _productService . commit } / ${this . _productService . version } / ` : '' ) ,
438- BASE : base ,
439- VS_BASE : vscodeBase ,
440- NLS_CONFIGURATION : asJSON ( nlsConfiguration ) ,
441- >>> > >>> 34 c670ba ( Update patched - vscode )
442398 } ;
443399
444400 // DEV ---------------------------------------------------------------------------------------
@@ -480,11 +436,7 @@ export class WebClientServer {
480436 `frame-src 'self' https://*.vscode-cdn.net data:;` ,
481437 'worker-src \'self\' data: blob:;' ,
482438 'style-src \'self\' \'unsafe-inline\';' ,
483- < < < << << HEAD
484439 'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://openvsxorg.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;' ,
485- === === =
486- 'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://*.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;' ,
487- > > >>> >> 34 c670ba ( Update patched - vscode )
488440 'font-src \'self\' blob:;' ,
489441 'manifest-src \'self\';'
490442 ] . join ( ' ' ) ;
@@ -553,30 +505,12 @@ export class WebClientServer {
553505 }
554506
555507 /**
556- <<<<<<< HEAD
557508 * Handles API requests to run the post-startup script in SMD.
558509 */
559510 private async _handlePostStartupScriptInvocation ( req : http . IncomingMessage , res : http . ServerResponse ) : Promise < void > {
560511 const postStartupScriptPath = '/etc/sagemaker-ui/sagemaker_ui_post_startup.sh'
561512 const logPath = '/var/log/apps/post_startup_default.log' ;
562513 const logStream = fs . createWriteStream ( logPath , { flags : 'a' } ) ;
563- === = ===
564- * Handles API requests to retrieve the last activity timestamp .
565- * /
566- private async _handleIdle ( req : http . IncomingMessage , res : http . ServerResponse ) : Promise < void > {
567- try {
568- const tmpDirectory = '/tmp/'
569- const idleFilePath = path . join ( tmpDirectory , '.sagemaker-last-active-timestamp' ) ;
570-
571- // If idle shutdown file does not exist, this indicates the app UI may never been opened
572- // Create the initial metadata file
573- if ( ! existsSync ( idleFilePath ) ) {
574- const timestamp = new Date ( ) . toISOString ( ) ;
575- writeFileSync ( idleFilePath , timestamp ) ;
576- }
577-
578- const data = await readFile ( idleFilePath , 'utf8' ) ;
579- >>> > >>> 34 c670ba ( Update patched - vscode )
580514
581515 // Only trigger post-startup script invocation for SageMakerUnifiedStudio app.
582516 if ( process . env [ 'SERVICE_NAME' ] != ServiceName . SAGEMAKER_UNIFIED_STUDIO ) {
@@ -629,4 +563,4 @@ export class WebClientServer {
629563 serveError ( req , res , 500 , error . message )
630564 }
631565 }
632- }
566+ }
0 commit comments