js-dos 7.2.3 → 7.2.7
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/.github/workflows/codeql-analysis.yml +70 -0
- package/README.md +6 -5
- package/dist/emulators-ui-loader.png +0 -0
- package/dist/js-dos.css +208 -15
- package/dist/js-dos.js +2 -2
- package/dist/js-dos.js.map +1 -1
- package/dist/types/src/backend/jj/jj-config.d.ts +6 -0
- package/dist/types/src/backend/jj/latency.d.ts +8 -0
- package/dist/types/src/{personal.d.ts → backend/v7/personal.d.ts} +0 -0
- package/dist/types/src/backend/v7/v7-config.d.ts +8 -0
- package/dist/types/src/components/region.d.ts +6 -0
- package/dist/types/src/components/sidebar/active-token.d.ts +2 -0
- package/dist/types/src/components/sidebar/create-token.d.ts +2 -0
- package/dist/types/src/components/sidebar/latency-info.d.ts +7 -0
- package/dist/types/src/components/sidebar/main.d.ts +2 -0
- package/dist/types/src/components/sidebar/networking.d.ts +2 -0
- package/dist/types/src/components/tip.d.ts +2 -0
- package/dist/types/src/hardware-transport-layer.d.ts +4 -2
- package/dist/types/src/icons.d.ts +18 -0
- package/dist/types/src/player-app.d.ts +18 -0
- package/dist/types/src/player.d.ts +2 -1
- package/dist/types/src/xhr.d.ts +1 -0
- package/dist/types/{sls → v7-services}/src/personal.d.ts +0 -0
- package/dist/wdosbox.js +1 -1
- package/dist/wdosbox.js.symbols +3132 -3071
- package/dist/wdosbox.wasm +0 -0
- package/examples/digger/index.html +9 -7
- package/package.json +7 -4
- package/v7-services/.env +6 -0
- package/v7-services/ok.yaml +24 -0
- package/v7-services/package.json +17 -0
- package/v7-services/redeploy-ok.sh +25 -0
- package/v7-services/serverless.yml +140 -0
- package/v7-services/src/networking/day.ts +5 -0
- package/v7-services/src/networking/get-free-token.ts +33 -0
- package/v7-services/src/networking/get-token-cost.ts +31 -0
- package/v7-services/src/networking/get-token-info.ts +16 -0
- package/v7-services/src/networking/ipx/put-ipx-ip.ts +20 -0
- package/v7-services/src/networking/ipx/start-ipx.ts +16 -0
- package/v7-services/src/networking/ipx/stop-ipx.ts +19 -0
- package/v7-services/src/networking/limits.ts +3 -0
- package/v7-services/src/networking/token.ts +238 -0
- package/v7-services/src/ok.ts +7 -0
- package/v7-services/src/personal-acl.ts +33 -0
- package/v7-services/src/personal-put.ts +35 -0
- package/v7-services/src/personal.ts +18 -0
- package/v7-services/src/responses.ts +28 -0
- package/v7-services/src/user.ts +3 -0
- package/v7-services/yarn.lock +4400 -0
- package/dist/emulators-ui-loader.gif +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Handler } from "aws-lambda";
|
|
2
|
+
|
|
3
|
+
import { badRequest, noSession, success } from "./responses";
|
|
4
|
+
|
|
5
|
+
import * as AWS from "aws-sdk";
|
|
6
|
+
import { validateUser } from "./user";
|
|
7
|
+
import { getPersonalBundleKey, uploadsS3Bucket } from "./personal";
|
|
8
|
+
|
|
9
|
+
const s3 = new AWS.S3();
|
|
10
|
+
|
|
11
|
+
export const personalAcl: Handler = async (event: any) => {
|
|
12
|
+
const namespace = event.queryStringParameters.namespace;
|
|
13
|
+
const id = event.queryStringParameters.id;
|
|
14
|
+
const bundleUrl = event.queryStringParameters.bundleUrl;
|
|
15
|
+
|
|
16
|
+
if (!bundleUrl || bundleUrl.length === 0) {
|
|
17
|
+
return badRequest();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!validateUser(namespace, id)) {
|
|
21
|
+
return noSession();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const personalKey = getPersonalBundleKey(namespace, id, bundleUrl);
|
|
25
|
+
|
|
26
|
+
await s3.putObjectAcl({
|
|
27
|
+
Bucket: uploadsS3Bucket,
|
|
28
|
+
Key: personalKey,
|
|
29
|
+
ACL: "public-read",
|
|
30
|
+
}).promise();
|
|
31
|
+
|
|
32
|
+
return success({});
|
|
33
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Handler } from "aws-lambda";
|
|
2
|
+
|
|
3
|
+
import { badRequest, noSession, success } from "./responses";
|
|
4
|
+
import { validateUser } from "./user";
|
|
5
|
+
|
|
6
|
+
import * as AWS from "aws-sdk";
|
|
7
|
+
import { getPersonalBundleUrl } from "./personal";
|
|
8
|
+
|
|
9
|
+
const PutCurlLambda = process.env.PUT_CURL as string;
|
|
10
|
+
const lambda = new AWS.Lambda();
|
|
11
|
+
|
|
12
|
+
export const personalPut: Handler = async (event: any) => {
|
|
13
|
+
const namespace = event.queryStringParameters.namespace;
|
|
14
|
+
const id = event.queryStringParameters.id;
|
|
15
|
+
const bundleUrl = event.queryStringParameters.bundleUrl;
|
|
16
|
+
|
|
17
|
+
if (!bundleUrl || bundleUrl.length === 0) {
|
|
18
|
+
return badRequest();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!validateUser(namespace, id)) {
|
|
22
|
+
return noSession();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const personalUrl = getPersonalBundleUrl(namespace, id, bundleUrl);
|
|
26
|
+
|
|
27
|
+
const result = await lambda.invoke({
|
|
28
|
+
FunctionName: PutCurlLambda,
|
|
29
|
+
Payload: JSON.stringify({
|
|
30
|
+
bundleUrl: personalUrl,
|
|
31
|
+
}),
|
|
32
|
+
}).promise();
|
|
33
|
+
|
|
34
|
+
return success({ payload: result.Payload });
|
|
35
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const uploadsS3Bucket = "doszone-uploads";
|
|
2
|
+
|
|
3
|
+
const uploadsS3Url = "https://doszone-uploads.s3.dualstack.eu-central-1.amazonaws.com";
|
|
4
|
+
|
|
5
|
+
export function getPersonalBundleKey(namespace: string, id: string, bundleUrl: string): string {
|
|
6
|
+
const index = bundleUrl.lastIndexOf("/");
|
|
7
|
+
const basename = bundleUrl.substr(index + 1);
|
|
8
|
+
if (namespace === "doszone") {
|
|
9
|
+
return "personal/" + id + "/" + basename;
|
|
10
|
+
} else {
|
|
11
|
+
return "personal-v2/" + namespace + "/" + id + "/" + basename;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getPersonalBundleUrl(namespace: string, id: string, bundleUrl: string): string {
|
|
16
|
+
const personalBundleKey = getPersonalBundleKey(namespace, id, bundleUrl);
|
|
17
|
+
return uploadsS3Url + "/" + personalBundleKey;
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function success(body: any) {
|
|
2
|
+
return response200(body, true);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function error(errorCode: string) {
|
|
6
|
+
return response200({ errorCode }, false);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function badRequest() {
|
|
10
|
+
return error("error_bad_request");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function noSession() {
|
|
14
|
+
return error("error_no_session");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function response200(body: any, success: boolean) {
|
|
18
|
+
body.success = success;
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
statusCode: 200,
|
|
22
|
+
headers: {
|
|
23
|
+
"Access-Control-Allow-Origin": "*",
|
|
24
|
+
"Access-Control-Allow-Credentials": true,
|
|
25
|
+
},
|
|
26
|
+
body: JSON.stringify(body, null, 2),
|
|
27
|
+
};
|
|
28
|
+
}
|