ags_1: fix build on typescript 5.9.2

This commit is contained in:
Kenichi Kamiya 2025-08-01 04:23:53 +09:00 committed by Masum Reza
parent 674b91e8cb
commit 35523e24a3
2 changed files with 24 additions and 0 deletions

View File

@ -59,6 +59,11 @@ buildNpmPackage (finalAttrs: {
upower
];
patches = [
# Workaround for TypeScript 5.9: https://github.com/Aylur/ags/issues/725#issuecomment-3070009695
./ts59.patch
];
postPatch = ''
chmod u+x ./post_install.sh && patchShebangs ./post_install.sh
'';

View File

@ -0,0 +1,19 @@
diff --git a/src/service/greetd.ts b/src/service/greetd.ts
index 10a475e..621a427 100644
--- a/src/service/greetd.ts
+++ b/src/service/greetd.ts
@@ -101,8 +101,12 @@ export class Greetd extends Service {
ostream.put_int32(json.length, null);
ostream.put_string(json, null);
- const data = await istream.read_bytes_async(4, GLib.PRIORITY_DEFAULT, null);
- const length = new Uint32Array(data.get_data()?.buffer || [0])[0];
+ const data = (
+ await istream.read_bytes_async(4, GLib.PRIORITY_DEFAULT, null)
+ ).get_data();
+ const length = data
+ ? new DataView(data.buffer, data.byteOffset, data.byteLength).getUint32(0, true)
+ : 0;
const res = await istream.read_bytes_async(length, GLib.PRIORITY_DEFAULT, null);
return JSON.parse(this._decoder.decode(res.get_data()!)) as Response;
} finally {