-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: compress docsis values for url transmition * chore: updated readme with experimental features * feat: add web diagnosing url to the diagnose module * chore: rename smmwio to web-diagnose * chore: prepare for release
- Loading branch information
Showing
9 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,5 +94,4 @@ export abstract class Modem implements GenericModem { | |
timeout: 30000 | ||
})) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { brotliDecompressSync } from "zlib" | ||
import { DocsisStatus } from "./modem" | ||
import { compressDocsisStatus } from "./web-diagnose" | ||
import fixtureDocsisStatus from './__fixtures__/docsisStatus_normalized.json' | ||
|
||
test('should compress json status with brotli', () => { | ||
const status = compressDocsisStatus(fixtureDocsisStatus as DocsisStatus) | ||
console.log(status) | ||
const decompressed = brotliDecompressSync((Buffer.from(status, "base64url"))) | ||
const decompressedStatus = JSON.parse(decompressed.toString("utf-8")) | ||
|
||
expect(decompressedStatus).toStrictEqual(fixtureDocsisStatus) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { DocsisStatus } from "./modem"; | ||
import { brotliCompressSync } from "zlib"; | ||
|
||
export function compressDocsisStatus(docsisStatus: DocsisStatus): string{ | ||
const json = JSON.stringify(docsisStatus) | ||
const compressed = brotliCompressSync(Buffer.from(json, 'utf-8')) | ||
return compressed.toString('base64url') | ||
} | ||
|
||
export function webDiagnoseLink(docsisStatus: DocsisStatus): string{ | ||
return `https://docsis-diagnose.totev.dev/#docsis=${compressDocsisStatus(docsisStatus)}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters