Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion patches/disable-builtin-ext-update.diff
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
return false;
}
@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService
@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService
// Skip if check updates only for builtin extensions and current extension is not builtin.
continue;
}
Expand Down
15 changes: 8 additions & 7 deletions patches/telemetry.diff
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme
- sendErrorTelemetry: this.sendErrorTelemetry,
- };
- this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));
-
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@code-asher I refreshed all the patches. Does this look okay to you?

Copy link
Member

@code-asher code-asher Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the blocks shifted a little, probably due to using a different diff algorithm, but I think it should be fine! Looks like I am using patience (you can see what you have by running git config diff.algorithm in the code-server repo).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh...looks like I'm not using one? 😅 Reminds me of when I first started at Coder and Anmol/I were using different algorithms.

image

Okay I will leave as is for now then and merge this!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that probably means it is using the default (myers).

- if (getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
- // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
- // This is most likely due to ad blockers
- fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => {
- this.impl = NullTelemetryService;
- });
+ const telemetryProvider: ITelemetryAppender | undefined = remoteAgentService.getConnection() !== null ? { log: remoteAgentService.logTelemetry.bind(remoteAgentService), flush: remoteAgentService.flushTelemetry.bind(remoteAgentService) } : productService.aiConfig?.ariaKey ? new OneDataSystemWebAppender(isInternal, 'monacoworkbench', null, productService.aiConfig?.ariaKey) : undefined;
+ if (telemetryProvider) {
+ appenders.push(telemetryProvider);
Expand All @@ -114,13 +121,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme
+ sendErrorTelemetry: this.sendErrorTelemetry,
+ };
+ this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));

- if (getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
- // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
- // This is most likely due to ad blockers
- fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => {
- this.impl = NullTelemetryService;
- });
+
+ if (remoteAgentService.getConnection() === null && getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
+ // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
+ // This is most likely due to ad blockers
Expand Down
31 changes: 0 additions & 31 deletions patches/unique-db.diff
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ ensures that different browser paths will be unique (for example /workspace1 and
The easiest way to test is to open files in the same workspace using both / and
/vscode and make sure they are not interacting with each other.

It should also migrate old databases which can be tested by opening in an old
code-server.

This has e2e tests.

Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
Expand All @@ -39,29 +34,3 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
}
}

@@ -141,6 +146,25 @@ export class BrowserStorageService exten

await this.workspaceStorage.init();

+ const firstWorkspaceOpen = this.workspaceStorage.getBoolean(IS_NEW_KEY);
+ if (firstWorkspaceOpen === undefined) {
+ // Migrate the old database.
+ let db: IIndexedDBStorageDatabase | undefined
+ try {
+ db = await IndexedDBStorageDatabase.create({ id: this.payload.id }, this.logService)
+ const items = await db.getItems()
+ for (const [key, value] of items) {
+ this.workspaceStorage.set(key, value);
+ }
+ } catch (error) {
+ this.logService.error(`[IndexedDB Storage ${this.payload.id}] migrate error: ${toErrorMessage(error)}`);
+ } finally {
+ if (db) {
+ db.close()
+ }
+ }
+ }
+
this.updateIsNew(this.workspaceStorage);
}

77 changes: 0 additions & 77 deletions test/e2e/codeServer.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import * as cp from "child_process"
import { promises as fs } from "fs"
import * as os from "os"
import * as path from "path"
import * as util from "util"
import { getMaybeProxiedCodeServer } from "../utils/helpers"
import { describe, test, expect } from "./baseFixture"
import { CodeServer } from "./models/CodeServer"
Expand All @@ -17,30 +14,6 @@ describe("code-server", [], {}, () => {
await Promise.all(procs.map((cs) => cs.close()))
})

/**
* Spawn a specific version of code-server using the install script.
*/
const spawn = async (version: string, dir?: string): Promise<CodeServer> => {
let instance = instances.get(version)
if (!instance) {
await util.promisify(cp.exec)(`./install.sh --method standalone --version ${version}`, {
cwd: path.join(__dirname, "../.."),
})

instance = new CodeServer(
"code-server@" + version,
["--auth=none"],
{ VSCODE_DEV: "" },
dir,
`${os.homedir()}/.local/lib/code-server-${version}`,
)

instances.set(version, instance)
}

return instance
}

test("should navigate to home page", async ({ codeServerPage }) => {
// We navigate codeServer before each test
// and we start the test with a storage state
Expand Down Expand Up @@ -68,54 +41,4 @@ describe("code-server", [], {}, () => {
await fs.writeFile(file, "bar")
await codeServerPage.openFile(file)
})

test("should migrate state to avoid collisions", async ({ codeServerPage }) => {
// This can take a very long time in development because of how long pages
// take to load and we are doing a lot of that here.
if (process.env.VSCODE_DEV === "1") {
test.slow()
}

const dir = await codeServerPage.workspaceDir
const files = [path.join(dir, "foo"), path.join(dir, "bar")]
await Promise.all(
files.map((file) => {
return fs.writeFile(file, path.basename(file))
}),
)

// Open a file in the latest instance.
await codeServerPage.openFile(files[0])
await codeServerPage.stateFlush()

// Open a file in an older version of code-server. It should not see the
// file opened in the new instance since the database has a different
// name. This must be accessed through the proxy so it shares the same
// domain and can write to the same database.
const cs = await spawn("4.0.2", dir)
const address = new URL(await cs.address())

await codeServerPage.navigate("/proxy/" + address.port + "/")
await codeServerPage.openFile(files[1])
expect(await codeServerPage.tabIsVisible(files[0])).toBe(false)
await codeServerPage.stateFlush()

// Move back to latest code-server. We should see the file we previously
// opened with it but not the old code-server file because the new instance
// already created its own database on this path and will avoid migrating.
await codeServerPage.navigate()
await codeServerPage.waitForTab(files[0])
expect(await codeServerPage.tabIsVisible(files[1])).toBe(false)

// Open a new path in latest code-server. This one should migrate the
// database from old code-server but see nothing from the new database
// created on the root.
await codeServerPage.navigate("/vscode")
await codeServerPage.waitForTab(files[1])
expect(await codeServerPage.tabIsVisible(files[0])).toBe(false)
// Should still be open after a reload.
await codeServerPage.navigate("/vscode")
await codeServerPage.waitForTab(files[1])
expect(await codeServerPage.tabIsVisible(files[0])).toBe(false)
})
})