tamga-vdesktop 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +37 -9
- package/dist/server.js +37 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2868,16 +2868,20 @@ import fs7 from "node:fs";
|
|
|
2868
2868
|
import http from "node:http";
|
|
2869
2869
|
import net from "node:net";
|
|
2870
2870
|
import path7 from "node:path";
|
|
2871
|
+
import zlib from "node:zlib";
|
|
2871
2872
|
import { execSync as execSync3, spawn as spawn4 } from "node:child_process";
|
|
2872
|
-
function
|
|
2873
|
+
function resolveCodeServeBinary() {
|
|
2874
|
+
if (fs7.existsSync("/usr/share/code/bin/code-tunnel")) {
|
|
2875
|
+
return "/usr/share/code/bin/code-tunnel";
|
|
2876
|
+
}
|
|
2873
2877
|
try {
|
|
2874
|
-
const out = execSync3("command -v code", {
|
|
2878
|
+
const out = execSync3("command -v code-tunnel || command -v code", {
|
|
2875
2879
|
stdio: ["ignore", "pipe", "ignore"],
|
|
2876
2880
|
shell: "/bin/sh"
|
|
2877
2881
|
}).toString("utf-8").trim();
|
|
2878
|
-
return
|
|
2882
|
+
return out || null;
|
|
2879
2883
|
} catch {
|
|
2880
|
-
return
|
|
2884
|
+
return null;
|
|
2881
2885
|
}
|
|
2882
2886
|
}
|
|
2883
2887
|
var VSCodeServerManager = class {
|
|
@@ -2891,7 +2895,7 @@ var VSCodeServerManager = class {
|
|
|
2891
2895
|
this.dataDir = dataDir;
|
|
2892
2896
|
}
|
|
2893
2897
|
isInstalled() {
|
|
2894
|
-
return
|
|
2898
|
+
return Boolean(resolveCodeServeBinary());
|
|
2895
2899
|
}
|
|
2896
2900
|
getStatus() {
|
|
2897
2901
|
return {
|
|
@@ -2907,7 +2911,8 @@ var VSCodeServerManager = class {
|
|
|
2907
2911
|
if (this.starting) {
|
|
2908
2912
|
return this.starting;
|
|
2909
2913
|
}
|
|
2910
|
-
|
|
2914
|
+
const bin = resolveCodeServeBinary();
|
|
2915
|
+
if (!bin) {
|
|
2911
2916
|
throw new Error("VS Code sunucuda kurulu de\u011Fil. Uygulamalar penceresinden kurabilirsiniz.");
|
|
2912
2917
|
}
|
|
2913
2918
|
this.starting = (async () => {
|
|
@@ -2935,7 +2940,7 @@ var VSCodeServerManager = class {
|
|
|
2935
2940
|
this.ready = false;
|
|
2936
2941
|
this.statusMessage = "VS Code Web motoru ba\u015Flat\u0131l\u0131yor (ilk a\xE7\u0131l\u0131\u015Fta bile\u015Fenler indirilebilir)...";
|
|
2937
2942
|
const proc = spawn4(
|
|
2938
|
-
|
|
2943
|
+
bin,
|
|
2939
2944
|
[
|
|
2940
2945
|
"serve-web",
|
|
2941
2946
|
"--host",
|
|
@@ -2953,6 +2958,7 @@ var VSCodeServerManager = class {
|
|
|
2953
2958
|
"--disable-telemetry"
|
|
2954
2959
|
],
|
|
2955
2960
|
{
|
|
2961
|
+
detached: true,
|
|
2956
2962
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2957
2963
|
env: {
|
|
2958
2964
|
...process.env,
|
|
@@ -3017,6 +3023,7 @@ var VSCodeServerManager = class {
|
|
|
3017
3023
|
res.status(503).send("VS Code haz\u0131rlan\u0131yor...");
|
|
3018
3024
|
return;
|
|
3019
3025
|
}
|
|
3026
|
+
const acceptGzip = String(req.headers["accept-encoding"] || "").includes("gzip");
|
|
3020
3027
|
const headers = { ...req.headers };
|
|
3021
3028
|
const upstream = http.request(
|
|
3022
3029
|
{
|
|
@@ -3034,6 +3041,23 @@ var VSCodeServerManager = class {
|
|
|
3034
3041
|
/frame-ancestors[^;]*;?/gi,
|
|
3035
3042
|
""
|
|
3036
3043
|
);
|
|
3044
|
+
} else if (Array.isArray(outHeaders["content-security-policy"])) {
|
|
3045
|
+
outHeaders["content-security-policy"] = outHeaders["content-security-policy"].map(
|
|
3046
|
+
(v) => v.replace(/frame-ancestors[^;]*;?/gi, "")
|
|
3047
|
+
);
|
|
3048
|
+
}
|
|
3049
|
+
const ctype = String(outHeaders["content-type"] || "").toLowerCase();
|
|
3050
|
+
const shouldGzip = acceptGzip && req.method !== "HEAD" && !outHeaders["content-encoding"] && /(javascript|css|json|html|svg|wasm|xml|text\/plain)/.test(ctype);
|
|
3051
|
+
if (shouldGzip) {
|
|
3052
|
+
delete outHeaders["content-length"];
|
|
3053
|
+
outHeaders["content-encoding"] = "gzip";
|
|
3054
|
+
res.writeHead(upRes.statusCode || 200, outHeaders);
|
|
3055
|
+
const gz = zlib.createGzip({ level: 1 });
|
|
3056
|
+
gz.on("error", () => res.destroy());
|
|
3057
|
+
upRes.on("error", () => gz.destroy());
|
|
3058
|
+
res.on("close", () => gz.destroy());
|
|
3059
|
+
upRes.pipe(gz).pipe(res);
|
|
3060
|
+
return;
|
|
3037
3061
|
}
|
|
3038
3062
|
res.writeHead(upRes.statusCode || 200, outHeaders);
|
|
3039
3063
|
upRes.pipe(res);
|
|
@@ -3064,7 +3088,11 @@ var VSCodeServerManager = class {
|
|
|
3064
3088
|
stop() {
|
|
3065
3089
|
if (this.proc) {
|
|
3066
3090
|
try {
|
|
3067
|
-
this.proc.
|
|
3091
|
+
if (this.proc.pid) {
|
|
3092
|
+
process.kill(-this.proc.pid, "SIGTERM");
|
|
3093
|
+
} else {
|
|
3094
|
+
this.proc.kill("SIGTERM");
|
|
3095
|
+
}
|
|
3068
3096
|
} catch {
|
|
3069
3097
|
}
|
|
3070
3098
|
this.proc = null;
|
|
@@ -3074,7 +3102,7 @@ var VSCodeServerManager = class {
|
|
|
3074
3102
|
};
|
|
3075
3103
|
|
|
3076
3104
|
// server/index.ts
|
|
3077
|
-
var TAMGA_VERSION = "1.1.
|
|
3105
|
+
var TAMGA_VERSION = "1.1.2";
|
|
3078
3106
|
var MIME_MAP = {
|
|
3079
3107
|
html: "text/html; charset=utf-8",
|
|
3080
3108
|
htm: "text/html; charset=utf-8",
|
package/dist/server.js
CHANGED
|
@@ -2859,16 +2859,20 @@ import fs7 from "node:fs";
|
|
|
2859
2859
|
import http from "node:http";
|
|
2860
2860
|
import net from "node:net";
|
|
2861
2861
|
import path7 from "node:path";
|
|
2862
|
+
import zlib from "node:zlib";
|
|
2862
2863
|
import { execSync as execSync3, spawn as spawn4 } from "node:child_process";
|
|
2863
|
-
function
|
|
2864
|
+
function resolveCodeServeBinary() {
|
|
2865
|
+
if (fs7.existsSync("/usr/share/code/bin/code-tunnel")) {
|
|
2866
|
+
return "/usr/share/code/bin/code-tunnel";
|
|
2867
|
+
}
|
|
2864
2868
|
try {
|
|
2865
|
-
const out = execSync3("command -v code", {
|
|
2869
|
+
const out = execSync3("command -v code-tunnel || command -v code", {
|
|
2866
2870
|
stdio: ["ignore", "pipe", "ignore"],
|
|
2867
2871
|
shell: "/bin/sh"
|
|
2868
2872
|
}).toString("utf-8").trim();
|
|
2869
|
-
return
|
|
2873
|
+
return out || null;
|
|
2870
2874
|
} catch {
|
|
2871
|
-
return
|
|
2875
|
+
return null;
|
|
2872
2876
|
}
|
|
2873
2877
|
}
|
|
2874
2878
|
var VSCodeServerManager = class {
|
|
@@ -2882,7 +2886,7 @@ var VSCodeServerManager = class {
|
|
|
2882
2886
|
this.dataDir = dataDir;
|
|
2883
2887
|
}
|
|
2884
2888
|
isInstalled() {
|
|
2885
|
-
return
|
|
2889
|
+
return Boolean(resolveCodeServeBinary());
|
|
2886
2890
|
}
|
|
2887
2891
|
getStatus() {
|
|
2888
2892
|
return {
|
|
@@ -2898,7 +2902,8 @@ var VSCodeServerManager = class {
|
|
|
2898
2902
|
if (this.starting) {
|
|
2899
2903
|
return this.starting;
|
|
2900
2904
|
}
|
|
2901
|
-
|
|
2905
|
+
const bin = resolveCodeServeBinary();
|
|
2906
|
+
if (!bin) {
|
|
2902
2907
|
throw new Error("VS Code sunucuda kurulu de\u011Fil. Uygulamalar penceresinden kurabilirsiniz.");
|
|
2903
2908
|
}
|
|
2904
2909
|
this.starting = (async () => {
|
|
@@ -2926,7 +2931,7 @@ var VSCodeServerManager = class {
|
|
|
2926
2931
|
this.ready = false;
|
|
2927
2932
|
this.statusMessage = "VS Code Web motoru ba\u015Flat\u0131l\u0131yor (ilk a\xE7\u0131l\u0131\u015Fta bile\u015Fenler indirilebilir)...";
|
|
2928
2933
|
const proc = spawn4(
|
|
2929
|
-
|
|
2934
|
+
bin,
|
|
2930
2935
|
[
|
|
2931
2936
|
"serve-web",
|
|
2932
2937
|
"--host",
|
|
@@ -2944,6 +2949,7 @@ var VSCodeServerManager = class {
|
|
|
2944
2949
|
"--disable-telemetry"
|
|
2945
2950
|
],
|
|
2946
2951
|
{
|
|
2952
|
+
detached: true,
|
|
2947
2953
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2948
2954
|
env: {
|
|
2949
2955
|
...process.env,
|
|
@@ -3008,6 +3014,7 @@ var VSCodeServerManager = class {
|
|
|
3008
3014
|
res.status(503).send("VS Code haz\u0131rlan\u0131yor...");
|
|
3009
3015
|
return;
|
|
3010
3016
|
}
|
|
3017
|
+
const acceptGzip = String(req.headers["accept-encoding"] || "").includes("gzip");
|
|
3011
3018
|
const headers = { ...req.headers };
|
|
3012
3019
|
const upstream = http.request(
|
|
3013
3020
|
{
|
|
@@ -3025,6 +3032,23 @@ var VSCodeServerManager = class {
|
|
|
3025
3032
|
/frame-ancestors[^;]*;?/gi,
|
|
3026
3033
|
""
|
|
3027
3034
|
);
|
|
3035
|
+
} else if (Array.isArray(outHeaders["content-security-policy"])) {
|
|
3036
|
+
outHeaders["content-security-policy"] = outHeaders["content-security-policy"].map(
|
|
3037
|
+
(v) => v.replace(/frame-ancestors[^;]*;?/gi, "")
|
|
3038
|
+
);
|
|
3039
|
+
}
|
|
3040
|
+
const ctype = String(outHeaders["content-type"] || "").toLowerCase();
|
|
3041
|
+
const shouldGzip = acceptGzip && req.method !== "HEAD" && !outHeaders["content-encoding"] && /(javascript|css|json|html|svg|wasm|xml|text\/plain)/.test(ctype);
|
|
3042
|
+
if (shouldGzip) {
|
|
3043
|
+
delete outHeaders["content-length"];
|
|
3044
|
+
outHeaders["content-encoding"] = "gzip";
|
|
3045
|
+
res.writeHead(upRes.statusCode || 200, outHeaders);
|
|
3046
|
+
const gz = zlib.createGzip({ level: 1 });
|
|
3047
|
+
gz.on("error", () => res.destroy());
|
|
3048
|
+
upRes.on("error", () => gz.destroy());
|
|
3049
|
+
res.on("close", () => gz.destroy());
|
|
3050
|
+
upRes.pipe(gz).pipe(res);
|
|
3051
|
+
return;
|
|
3028
3052
|
}
|
|
3029
3053
|
res.writeHead(upRes.statusCode || 200, outHeaders);
|
|
3030
3054
|
upRes.pipe(res);
|
|
@@ -3055,7 +3079,11 @@ var VSCodeServerManager = class {
|
|
|
3055
3079
|
stop() {
|
|
3056
3080
|
if (this.proc) {
|
|
3057
3081
|
try {
|
|
3058
|
-
this.proc.
|
|
3082
|
+
if (this.proc.pid) {
|
|
3083
|
+
process.kill(-this.proc.pid, "SIGTERM");
|
|
3084
|
+
} else {
|
|
3085
|
+
this.proc.kill("SIGTERM");
|
|
3086
|
+
}
|
|
3059
3087
|
} catch {
|
|
3060
3088
|
}
|
|
3061
3089
|
this.proc = null;
|
|
@@ -3065,7 +3093,7 @@ var VSCodeServerManager = class {
|
|
|
3065
3093
|
};
|
|
3066
3094
|
|
|
3067
3095
|
// server/index.ts
|
|
3068
|
-
var TAMGA_VERSION = "1.1.
|
|
3096
|
+
var TAMGA_VERSION = "1.1.2";
|
|
3069
3097
|
var MIME_MAP = {
|
|
3070
3098
|
html: "text/html; charset=utf-8",
|
|
3071
3099
|
htm: "text/html; charset=utf-8",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamga-vdesktop",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "TamgaVDesktop — Self-hostable Linux Virtual Desktop OS platform with native web shell, real Linux terminal, and seamless native Linux GUI apps (Firefox, VS Code, Antigravity).",
|