Skip to content

Commit

Permalink
Merge pull request #139 from StarfilesFileSharing/alpha
Browse files Browse the repository at this point in the history
Alpha
  • Loading branch information
QuixThe2nd authored Nov 2, 2024
2 parents 35f1505 + 2985994 commit 3ab0701
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 52 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

25 changes: 3 additions & 22 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@starfiles/hydrafiles",
"version": "0.7.29",
"version": "0.7.30",
"description": "The web privacy layer.",
"main": "src/hydrafiles.ts",
"exports": {
Expand Down Expand Up @@ -39,30 +39,11 @@
"include": ["src/"],
"rules": {
"tags": ["recommended"],
"include": [
"camelcase",
"default-param-last",
"eqeqeq",
"explicit-function-return-type",
"explicit-module-boundary-types",
"guard-for-in",
"no-const-assign",
"no-inferrable-types",
"no-non-null-assertion",
"no-self-compare",
"no-sparse-arrays",
"no-sync-fn-in-async-fn",
"no-throw-literal",
"no-undef",
"constructor-super",
"no-async-promise-executor",
"no-await-in-sync-fn",
"valid-typeof"
]
"include": ["camelcase", "default-param-last", "eqeqeq", "explicit-function-return-type", "explicit-module-boundary-types", "guard-for-in", "no-const-assign", "no-inferrable-types", "no-non-null-assertion", "no-self-compare", "no-sparse-arrays", "no-sync-fn-in-async-fn", "no-throw-literal", "no-undef", "constructor-super", "no-async-promise-executor", "no-await-in-sync-fn", "valid-typeof"]
}
},
"fmt": {
"exclude": ["public/*.html"],
"exclude": ["public/*.html", "deno.jsonc"],
"lineWidth": 240,
"semiColons": true,
"useTabs": true
Expand Down
5 changes: 3 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export const handleRequest = async (req: Request, client: Hydrafiles): Promise<R
sockets.push({ socket, id: 0 });

socket.addEventListener("message", ({ data }) => {
const message = JSON.parse(data) as Message;
const message = JSON.parse(data) as Message | null;
if (message === null) return;
for (let i = 0; i < sockets.length; i++) {
if (sockets[i].socket !== socket && (message && !("to" in message) || message.to === sockets[i].id)) {
if (sockets[i].socket !== socket && (!("to" in message) || message.to === sockets[i].id)) {
if (sockets[i].socket.readyState === 1) sockets[i].socket.send(data);
} else if ("from" in message) {
sockets[i].id = message.from;
Expand Down

0 comments on commit 3ab0701

Please sign in to comment.