Skip to content

Commit

Permalink
Merge branch 'update-devdeps-20231208' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
throwaway96 committed Dec 11, 2023
2 parents f0ca490 + 63e2ad8 commit 45d3f8b
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 59 deletions.
18 changes: 14 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@babel/preset-env": "^7.23.5",
"@babel/preset-typescript": "^7.23.3",
"@types/bluebird": "^3.5.42",
"@types/node": "^20.10.4",
"@types/node-fetch": "^2.6.9",
"@types/progress-stream": "^2.0.5",
"@types/webos-service": "^0.4.6",
Expand Down
1 change: 1 addition & 0 deletions services/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fetch.Promise = Bluebird.Promise;
// Sadly these need to be manually typed according to
// https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
// since types infered from Bluebird.Promise.promisify are wrong.
// @ts-ignore
export const asyncPipeline: (
...args: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>
) => Promise<void> = Bluebird.Promise.promisify(pipeline);
Expand Down
4 changes: 2 additions & 2 deletions services/elevate-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { existsSync, statSync, readFileSync, writeFileSync } from 'fs';
import { execFile } from 'child_process';
import { dirname, resolve } from 'path';

process.env.PATH = `/usr/sbin:${process.env.PATH}`;
process.env['PATH'] = `/usr/sbin:${process.env['PATH']}`;

function isFile(path: string): boolean {
try {
Expand Down Expand Up @@ -40,7 +40,7 @@ function patchServiceFile(serviceFile: string): boolean {
serviceFileNew = serviceFileNew.replace(/^Exec=\/usr\/bin\/run-js-service/gm, `Exec=${runJsServicePath}`);
} else if (serviceFileNew.indexOf('/jailer') !== -1) {
console.info(`[ ] ${serviceFile} is a native service`);
serviceFileNew = serviceFileNew.replace(/^Exec=\/usr\/bin\/jailer .* ([^ ]*)$/gm, (match, binaryPath) => `Exec=${binaryPath}`);
serviceFileNew = serviceFileNew.replace(/^Exec=\/usr\/bin\/jailer .* ([^ ]*)$/gm, (_, binaryPath) => `Exec=${binaryPath}`);
} else if (serviceFileNew.indexOf('Exec=/media') === -1) {
// Ignore elevated native services...
console.info(`[~] ${serviceFile}: unknown service type, this may cause some troubles`);
Expand Down
12 changes: 6 additions & 6 deletions services/protocol.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
type Response<T extends Record<string, any>> = T & {
interface Response {
returnValue: true;
};
}

type ErrorResponse<T extends Record<string, any>> = T & {
interface ErrorResponse {
returnValue: false;
errorText: string;
};
}

export function makeSuccess<T>(payload: T): Response<T> {
export function makeSuccess(payload: Record<string, any>): Response {
return { returnValue: true, ...payload };
}

export function makeError<T>(error: string, payload?: T): ErrorResponse<T> {
export function makeError(error: string, payload?: Record<string, any>): ErrorResponse {
return { returnValue: false, errorText: error, ...payload };
}
Loading

0 comments on commit 45d3f8b

Please sign in to comment.