Commit 35523e24 authored by Kenichi Kamiya's avatar Kenichi Kamiya Committed by Masum Reza
Browse files

ags_1: fix build on typescript 5.9.2

parent 674b91e8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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
  '';
+19 −0
Original line number Diff line number Diff line
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 {