diff --git a/package-lock.json b/package-lock.json index 09e156936..ad9f35f2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "ISC", "devDependencies": { "@cloudflare/workers-types": "^4.20250109.0", - "@github1s/vscode-web": "0.24.0", + "@github1s/vscode-web": "0.25.1", "chokidar": "^4.0.3", "clean-css": "^5.3.3", "copy-webpack-plugin": "^12.0.2", @@ -248,9 +248,9 @@ } }, "node_modules/@github1s/vscode-web": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@github1s/vscode-web/-/vscode-web-0.24.0.tgz", - "integrity": "sha512-zEguYqlQdrmiQGjw3UAToggV7kZMZuykhWmP+awNarcYLmcPsO+cd6un48IIp74YBRT0qol0dghORvFiq/TIeQ==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@github1s/vscode-web/-/vscode-web-0.25.1.tgz", + "integrity": "sha512-cv1mS3ulPl28uxpCpNR2TFZWAjSnYtw0a/STJUnCJfNGG1r3McZKIIHf/tr0xo2oexUg8JOSLKcBh2uXFqrTNg==", "dev": true, "license": "MIT" }, @@ -1582,9 +1582,9 @@ } }, "node_modules/axios": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", - "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 4cebf8947..ef7120438 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "license": "ISC", "devDependencies": { "@cloudflare/workers-types": "^4.20250109.0", - "@github1s/vscode-web": "0.24.0", + "@github1s/vscode-web": "0.25.1", "chokidar": "^4.0.3", "clean-css": "^5.3.3", "copy-webpack-plugin": "^12.0.2", diff --git a/vscode-web/.VERSION b/vscode-web/.VERSION index 7cfa21bfa..8b14e4022 100644 --- a/vscode-web/.VERSION +++ b/vscode-web/.VERSION @@ -1 +1 @@ -1.97.2 \ No newline at end of file +1.99.1 \ No newline at end of file diff --git a/vscode-web/package-lock.json b/vscode-web/package-lock.json index c4eed2dbe..545764f81 100644 --- a/vscode-web/package-lock.json +++ b/vscode-web/package-lock.json @@ -1,12 +1,12 @@ { "name": "@github1s/vscode-web", - "version": "0.24.0", + "version": "0.25.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@github1s/vscode-web", - "version": "0.24.0", + "version": "0.25.1", "license": "MIT", "devDependencies": { "chokidar": "^4.0.3", diff --git a/vscode-web/package.json b/vscode-web/package.json index d2053ca41..a44202796 100644 --- a/vscode-web/package.json +++ b/vscode-web/package.json @@ -1,6 +1,6 @@ { "name": "@github1s/vscode-web", - "version": "0.24.0", + "version": "0.25.1", "description": "VS Code web for GitHub1s", "author": "github1s", "license": "MIT", diff --git a/vscode-web/scripts/.patch b/vscode-web/scripts/.patch index c0cb460e0..4e4602f5b 100644 --- a/vscode-web/scripts/.patch +++ b/vscode-web/scripts/.patch @@ -1,12 +1,12 @@ { - "src/vs/workbench/browser/parts/activitybar/activitybarPart.ts": "533dd320519e7523e9bfd102ab35b2329223c1cf6fa909210d47ebbb75e7cf41", - "src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css": "654fa16577a5fcf83f2601f1e22e0a6ac67a9710980d6a762ee68074423a74cc", + "src/vs/workbench/browser/parts/activitybar/activitybarPart.ts": "a195c8b4170a58eca301c3044ae278fa3b811539a7274830691afc73f6da86b8", + "src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css": "6be71e59eeb2e650262bb6d15a05dbd7636928fbbae7f33998f1554b436b4108", "src/vs/workbench/browser/web.main.ts": "0cf354b9221fdb15a738366043fbf69d8f8373891faf9f5e66a033de935eba79", "src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts": "e986095a30dbea54af56c25fa1b184b55f34f8914129b27e2f20d8c4ea9fd16b", - "src/vs/workbench/contrib/webview/browser/pre/index.html": "09664522d7c6b0fdb7728be06b1a1f6ec8bb82c4fd6f2d13a7e84a0fd7d667af", + "src/vs/workbench/contrib/webview/browser/pre/index.html": "a325d58526d8ac86f3460afdb63787e09ea71d10e95c20518b92586ed028834c", "src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts": "c220568141adf6ed560bab754ea7769795465c6fa93ecd461e9b59f05ca56377", "src/vs/workbench/services/label/common/labelService.ts": "72d72581bd521c2edadd60d4458de4d1c6a9a2cc2cf83820034c82815a2eae6a", - "src/vs/workbench/services/textfile/browser/textFileService.ts": "b5ce3f8032cd2fe5a871b33d67f578d209bbae3f42007998559138326fd16b04", - "src/vs/base/common/network.ts": "10cb07268d9805b102cf8ab9d5e03f97d935a42304c7bdc5e8c54013038bd9ad", - "src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html": "1b7956deade55aa1420516b62251d412fb578bb1165e2580b21d3d8ace968a67" + "src/vs/workbench/services/textfile/browser/textFileService.ts": "fbb6ae9a1d9ed4d57ce8b0f91e54c5a9505a293a8b15c72e09773ee54fb5cd28", + "src/vs/base/common/network.ts": "34fc2461d4b6029e71b60a3bf5d7438585e9d2b66ccdcab0893cc69d77fab5b5", + "src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html": "40d576ad2307d28012b34b86858ba36ba49ae10e5aedb394bd06b14a35b869a5" } \ No newline at end of file diff --git a/vscode-web/scripts/clone.js b/vscode-web/scripts/clone.js index a05f50169..82e25a225 100755 --- a/vscode-web/scripts/clone.js +++ b/vscode-web/scripts/clone.js @@ -51,7 +51,7 @@ const main = () => { } const url = 'https://github.com/microsoft/vscode.git'; - const ref = cp.execSync(`cat ${PROJECT_ROOT}/.VERSION`).toString(); + const ref = cp.execSync(`cat ${PROJECT_ROOT}/.VERSION`).toString().trim(); executeCommand('git', ['clone', '--depth', '1', '-b', ref, url, 'lib/vscode'], PROJECT_ROOT); const locUrl = 'https://github.com/microsoft/vscode-loc.git'; diff --git a/vscode-web/src/vs/base/common/network.ts b/vscode-web/src/vs/base/common/network.ts index f6802e0c3..7ba2e3d1e 100644 --- a/vscode-web/src/vs/base/common/network.ts +++ b/vscode-web/src/vs/base/common/network.ts @@ -336,7 +336,7 @@ class FileAccessImpl { return uri; } - private toUri(uriOrModule: URI | string, moduleIdToUrl?: { toUrl(moduleId: string): string }): URI { + private toUri(uriOrModule: URI | string): URI { if (URI.isUri(uriOrModule)) { return uriOrModule; } @@ -354,12 +354,19 @@ class FileAccessImpl { return URI.file(modulePath); } - return URI.parse(moduleIdToUrl!.toUrl(uriOrModule)); + throw new Error('Cannot determine URI for module id!'); } } export const FileAccess = new FileAccessImpl(); +export const CacheControlheaders: Record = Object.freeze({ + 'Cache-Control': 'no-cache, no-store' +}); + +export const DocumentPolicyheaders: Record = Object.freeze({ + 'Document-Policy': 'include-js-call-stacks-in-crash-reports' +}); export namespace COI { diff --git a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index f5ad9fe26..8c6bbb2e6 100644 --- a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -280,8 +280,7 @@ export class ActivityBarCompositeBar extends PaneCompositeBar { return; // prevent menu bar from installing twice #110720 } - this.menuBarContainer = document.createElement('div'); - this.menuBarContainer.classList.add('menubar'); + this.menuBarContainer = $('.menubar'); const content = assertIsDefined(this.element); /* below codes are changed by github1s */ diff --git a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index e48284095..584f32db0 100644 --- a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -320,10 +320,6 @@ width: calc(100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px)); } -.monaco-workbench.linux:not(.web) .part.titlebar .titlebar-container.counter-zoom .window-controls-container.wco-enabled { - width: calc(100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px)); -} - .monaco-workbench:not(.web):not(.mac) .part.titlebar .titlebar-container:not(.counter-zoom) .window-controls-container * { zoom: calc(1 / var(--zoom-factor, 1)); } diff --git a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html index 3d6f095c6..8c0ea0e6a 100644 --- a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html +++ b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html @@ -230,7 +230,7 @@ return reject(new Error('Service Workers are not enabled. Webviews will not work. Try disabling private/incognito mode.')); } - const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`); + const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&id=${ID}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`); navigator.serviceWorker.register(swPath) .then(async registration => { /** diff --git a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html index d42684184..20d9d82dd 100644 --- a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html +++ b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html @@ -237,7 +237,7 @@ return reject(new Error('Service Workers are not enabled. Webviews will not work. Try disabling private/incognito mode.')); } - const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`); + const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&id=${ID}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`); navigator.serviceWorker.register(swPath) .then(async registration => { /** diff --git a/vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts b/vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts index 79dedc916..c515abe1e 100644 --- a/vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -51,13 +51,13 @@ export abstract class AbstractTextFileService extends Disposable implements ITex private static readonly TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', localize('textFileCreate.source', "File Created")); private static readonly TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', localize('textFileOverwrite.source', "File Replaced")); - readonly files: ITextFileEditorModelManager = this._register(this.instantiationService.createInstance(TextFileEditorModelManager)); + readonly files: ITextFileEditorModelManager; - readonly untitled: IUntitledTextEditorModelManager = this.untitledTextEditorService; + readonly untitled: IUntitledTextEditorModelManager; constructor( @IFileService protected readonly fileService: IFileService, - @IUntitledTextEditorService private untitledTextEditorService: IUntitledTextEditorModelManager, + @IUntitledTextEditorService untitledTextEditorService: IUntitledTextEditorModelManager, @ILifecycleService protected readonly lifecycleService: ILifecycleService, @IInstantiationService protected readonly instantiationService: IInstantiationService, @IModelService private readonly modelService: IModelService, @@ -77,6 +77,9 @@ export abstract class AbstractTextFileService extends Disposable implements ITex ) { super(); + this.files = this._register(this.instantiationService.createInstance(TextFileEditorModelManager)); + this.untitled = untitledTextEditorService; + /* below codes are changed by github1s */ if (!globalThis._VSCODE_WEB?.hideTextFileLabelDecorations) { this.provideDecorations(); @@ -274,13 +277,18 @@ export abstract class AbstractTextFileService extends Disposable implements ITex return this.fileService.writeFile(resource, readable, options); } - async getEncodedReadable(resource: URI, value: ITextSnapshot): Promise; - async getEncodedReadable(resource: URI, value: string): Promise; - async getEncodedReadable(resource: URI, value?: ITextSnapshot): Promise; - async getEncodedReadable(resource: URI, value?: string): Promise; - async getEncodedReadable(resource: URI, value?: string | ITextSnapshot): Promise; - async getEncodedReadable(resource: URI, value: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise; - async getEncodedReadable(resource: URI, value?: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise { + getEncoding(resource: URI): string { + const model = resource.scheme === Schemas.untitled ? this.untitled.get(resource) : this.files.get(resource); + return model?.getEncoding() ?? this.encoding.getUnvalidatedEncodingForResource(resource); + } + + async getEncodedReadable(resource: URI | undefined, value: ITextSnapshot): Promise; + async getEncodedReadable(resource: URI | undefined, value: string): Promise; + async getEncodedReadable(resource: URI | undefined, value?: ITextSnapshot): Promise; + async getEncodedReadable(resource: URI | undefined, value?: string): Promise; + async getEncodedReadable(resource: URI | undefined, value?: string | ITextSnapshot): Promise; + async getEncodedReadable(resource: URI | undefined, value: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise; + async getEncodedReadable(resource: URI | undefined, value?: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise { // check for encoding const { encoding, addBOM } = await this.encoding.getWriteEncoding(resource, options); @@ -298,11 +306,11 @@ export abstract class AbstractTextFileService extends Disposable implements ITex return toEncodeReadable(snapshot, encoding, { addBOM }); } - async getDecodedStream(resource: URI, value: VSBufferReadableStream, options?: IReadTextFileEncodingOptions): Promise> { + async getDecodedStream(resource: URI | undefined, value: VSBufferReadableStream, options?: IReadTextFileEncodingOptions): Promise> { return (await this.doGetDecodedStream(resource, value, options)).stream; } - private doGetDecodedStream(resource: URI, stream: VSBufferReadableStream, options?: IReadTextFileEncodingOptions): Promise { + private doGetDecodedStream(resource: URI | undefined, stream: VSBufferReadableStream, options?: IReadTextFileEncodingOptions): Promise { // read through encoding library return toDecodeStream(stream, { @@ -770,14 +778,14 @@ export class EncodingOracle extends Disposable implements IResourceEncodings { return defaultEncodingOverrides; } - async getWriteEncoding(resource: URI, options?: IWriteTextFileOptions): Promise<{ encoding: string; addBOM: boolean }> { + async getWriteEncoding(resource: URI | undefined, options?: IWriteTextFileOptions): Promise<{ encoding: string; addBOM: boolean }> { const { encoding, hasBOM } = await this.getPreferredWriteEncoding(resource, options ? options.encoding : undefined); return { encoding, addBOM: hasBOM }; } - async getPreferredWriteEncoding(resource: URI, preferredEncoding?: string): Promise { - const resourceEncoding = await this.getEncodingForResource(resource, preferredEncoding); + async getPreferredWriteEncoding(resource: URI | undefined, preferredEncoding?: string): Promise { + const resourceEncoding = await this.getValidatedEncodingForResource(resource, preferredEncoding); return { encoding: resourceEncoding, @@ -785,7 +793,7 @@ export class EncodingOracle extends Disposable implements IResourceEncodings { }; } - async getPreferredReadEncoding(resource: URI, options?: IReadTextFileEncodingOptions, detectedEncoding?: string): Promise { + async getPreferredReadEncoding(resource: URI | undefined, options?: IReadTextFileEncodingOptions, detectedEncoding?: string): Promise { let preferredEncoding: string | undefined; // Encoding passed in as option @@ -807,7 +815,7 @@ export class EncodingOracle extends Disposable implements IResourceEncodings { preferredEncoding = UTF8; // if we did not detect UTF 8 BOM before, this can only be UTF 8 then } - const encoding = await this.getEncodingForResource(resource, preferredEncoding); + const encoding = await this.getValidatedEncodingForResource(resource, preferredEncoding); return { encoding, @@ -815,7 +823,7 @@ export class EncodingOracle extends Disposable implements IResourceEncodings { }; } - private async getEncodingForResource(resource: URI, preferredEncoding?: string): Promise { + getUnvalidatedEncodingForResource(resource: URI | undefined, preferredEncoding?: string): string { let fileEncoding: string; const override = this.getEncodingOverride(resource); @@ -827,17 +835,20 @@ export class EncodingOracle extends Disposable implements IResourceEncodings { fileEncoding = this.textResourceConfigurationService.getValue(resource, 'files.encoding'); // and last we check for settings } - if (fileEncoding !== UTF8) { - if (!fileEncoding || !(await encodingExists(fileEncoding))) { - fileEncoding = UTF8; // the default is UTF-8 - } + return fileEncoding || UTF8; + } + + private async getValidatedEncodingForResource(resource: URI | undefined, preferredEncoding?: string): Promise { + let fileEncoding = this.getUnvalidatedEncodingForResource(resource, preferredEncoding); + if (fileEncoding !== UTF8 && !(await encodingExists(fileEncoding))) { + fileEncoding = UTF8; } return fileEncoding; } - private getEncodingOverride(resource: URI): string | undefined { - if (this.encodingOverrides?.length) { + private getEncodingOverride(resource: URI | undefined): string | undefined { + if (resource && this.encodingOverrides?.length) { for (const override of this.encodingOverrides) { // check if the resource is child of encoding override path