mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 23:25:24 +00:00
feat: rebuild desktop sync as linked server accounts, fix packaged plugin bundles and UI scaling
This commit is contained in:
1 parent
7c02daccf4
commit
6cd9a2846d
242 files changed
+39127
-8558
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { pluginDir } from "./helpers";
|
||||
|
||||
function read(relative: string): string {
|
||||
return fs.readFileSync(path.join(pluginDir, relative), "utf8");
|
||||
}
|
||||
|
||||
/** Every "/path" the frontend's SSH client sends, without its parameters. */
|
||||
function frontendPaths(): string[] {
|
||||
const source = read("src/frontend/api/ssh-file-operations-api.ts");
|
||||
const paths = new Set<string>();
|
||||
for (const match of source.matchAll(/["`](\/[A-Za-z][\w-]*(?:\/[\w-]+)*)/g)) {
|
||||
paths.add(match[1]);
|
||||
}
|
||||
return [...paths];
|
||||
}
|
||||
|
||||
/** Every route the backend's express app registers. */
|
||||
function backendPaths(): Set<string> {
|
||||
const paths = new Set<string>();
|
||||
const dir = path.join(pluginDir, "src/backend");
|
||||
for (const file of fs
|
||||
.readdirSync(dir)
|
||||
.filter((name) => name.endsWith(".ts"))
|
||||
.map((name) => `src/backend/${name}`)) {
|
||||
for (const match of read(file).matchAll(
|
||||
/app\.(?:get|post|put|delete|patch)\(\s*"(\/[^"]*)"/g,
|
||||
)) {
|
||||
paths.add(match[1].replace(/\/:[\w]+$/, ""));
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
describe("file manager routes", () => {
|
||||
it("serves every path the frontend's SSH client calls", () => {
|
||||
const served = backendPaths();
|
||||
const missing = frontendPaths().filter((p) => !served.has(p));
|
||||
expect(missing).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -50,7 +50,7 @@ describe("chunked SSH file uploads", () => {
|
||||
expect(fileManagerApiMock.post).toHaveBeenCalledTimes(193);
|
||||
expect(fileManagerApiMock.post).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
"/ssh/uploadFileChunk",
|
||||
"/uploadFileChunk",
|
||||
expect.any(Blob),
|
||||
{
|
||||
params: {
|
||||
@@ -65,7 +65,7 @@ describe("chunked SSH file uploads", () => {
|
||||
},
|
||||
);
|
||||
expect(fileManagerApiMock.post).toHaveBeenLastCalledWith(
|
||||
"/ssh/uploadFileChunk",
|
||||
"/uploadFileChunk",
|
||||
expect.any(Blob),
|
||||
expect.objectContaining({
|
||||
params: expect.objectContaining({ offset: 1.5 * 1024 * 1024 * 1024 }),
|
||||
|
||||
Reference in new issue
Block a user