Compare commits

..

43 commits

Author SHA1 Message Date
Elec3137
d0df1a198b try to use generate script
the script fails with:
Couldn't resolve the package 'ffigen' in 'package:ffigen/ffigen.dart'.
Couldn't resolve the package 'path' in 'package:path/path.dart'.
2026-02-01 17:12:26 -08:00
Elec3137
cc050f62fc dubious (mostly style) changes in flake 2026-02-01 14:25:45 -08:00
Elec3137
f72c59f79d rename fromYAML -> importYAML
this is more consistent with existing nixpkgs.lib functions
2026-02-01 14:15:44 -08:00
Elec3137
32393f12c0 add packages.default flake output
this likely doesn't work (yet),
cannot properly test because at time of writing,
the app doesn't compile through `flutter run` either.
2026-02-01 13:39:16 -08:00
db2a169f34 Update README.md 2026-02-01 06:19:04 -05:00
82b6f2c647
joining rooms from matrix uri or plaintext 2026-01-30 20:22:51 +01:00
cafdf43fd3
removing unused imports because they annoy me 2026-01-30 19:04:03 +01:00
d62626858d
update readme 2026-01-30 18:47:13 +01:00
985b6d52e0
safety checks and message fix 2026-01-30 18:45:55 +01:00
2372ecd141
Working images 2026-01-30 18:45:55 +01:00
34f45c929a
fix bug in timeline 2026-01-30 18:45:55 +01:00
4f66bdc817
working member list 2026-01-30 18:45:55 +01:00
6cc5971919
Working mentions 2026-01-30 18:45:55 +01:00
75be47554f
add a todo 2026-01-30 18:45:55 +01:00
2878412573
show member count 2026-01-30 18:45:55 +01:00
07b492d0f4
wip mention overlay 2026-01-30 18:45:55 +01:00
132efbdfd1
working history loading 2026-01-30 18:45:55 +01:00
bfd0b1ec47
wip 2026-01-30 18:45:55 +01:00
0df327d125
wip thing 2026-01-30 18:45:55 +01:00
3d341ac4d8
working decryption 2026-01-30 18:45:55 +01:00
15ccddfad5
redact support 2026-01-30 18:45:55 +01:00
e59632bb07
working message rendering 2026-01-30 18:45:55 +01:00
5f96c8e57f
shows room but not really 2026-01-30 18:45:55 +01:00
7b0fea3a07
working sidebar 2026-01-30 18:45:55 +01:00
f51d773885
wip 2026-01-30 18:45:55 +01:00
6afa169af9
working sync complete 2026-01-30 18:45:55 +01:00
27fba2cdb5
wip 2026-01-30 18:45:55 +01:00
5424dda62a
Nicer verification error 2026-01-30 18:45:55 +01:00
e447540062
working login 2026-01-30 18:45:55 +01:00
7c6ddab6a3
working login page 2026-01-30 18:45:55 +01:00
5e0ba1029d
add unhandled event printer 2026-01-30 18:45:55 +01:00
96ca282d5a
fix up nix flake 2026-01-30 18:45:55 +01:00
8be9a4f2f6
kind of working! 2026-01-30 18:45:55 +01:00
d1c4a69b40
working build 2026-01-30 18:45:55 +01:00
5c6440894b
working build scripts 2026-01-30 18:45:55 +01:00
e8f4ff072d
working build of generated file 2026-01-30 18:45:55 +01:00
b2da534a32
update readme 2026-01-30 18:45:55 +01:00
ede26c9a27
add skip param 2026-01-30 18:45:30 +01:00
66d4ef18b4
fix build hook 2026-01-30 18:45:30 +01:00
362819b464
wip go 3 2026-01-30 18:45:30 +01:00
2a86bdafeb
wip go 2 2026-01-30 18:45:30 +01:00
77d9f9bdc1
wip go 2026-01-30 18:45:30 +01:00
32d5f30e03 Update README.md 2026-01-24 11:41:06 -05:00
9 changed files with 243 additions and 79 deletions

View file

@ -15,7 +15,7 @@ A simple and user-friendly Matrix client made with Flutter and the Matrix Dart S
## Progress
- [ ] Move from the Dart SDK to the Gomuks SDK with bindings: WIP
- [x] Move from the Dart SDK to the Gomuks SDK with Dart bindings: https://git.federated.nexus/Henry-Hiles/nexus/pulls/2
- [ ] Platform Support
- [x] Linux
- [x] Windows
@ -33,14 +33,17 @@ A simple and user-friendly Matrix client made with Flutter and the Matrix Dart S
- [ ] Searching
- [ ] Creating (Rooms, Spaces, and DMs)
- [x] Joining
- [x] Using alias/id/link
- [x] Using a text/uri/link
- [x] Plain text
- [x] `matrix:` Uri
- [ ] Matrix.to link: I just need to fix my regex
- [ ] From space
- [ ] Exploring
- [x] Leaving
- [x] Subspaces
- [x] Messages
- [x] Encryption
- [ ] Restoring crypto identity from passphrase/key or verification
- [x] Restoring crypto identity from passphrase/key or verification
- [x] Sending
- [x] Plain text
- [x] HTML/Markdown
@ -147,4 +150,4 @@ flutter run
## Community
Come chat in the [Federated Nexus Community](https://matrix.to/#/#space:federated.nexus) for questions or help with developing or using Nexus Client.
Join the [Nexus Client Matrix Room](https://matrix.to/#/#nexus:federated.nexus) for questions or help with developing or using Nexus Client.

View file

@ -29,6 +29,22 @@
...
}:
let
src = ./.;
# from https://discourse.nixos.org/t/is-there-a-way-to-read-a-yaml-file-and-get-back-a-set/18385/5
importYAML =
file:
lib.importJSON (
pkgs.runCommand "converted-yaml.json" { } ''${pkgs.yj}/bin/yj < "${file}" > "$out"''
);
package = importYAML "${src}/pubspec.yaml";
usedFlutter = (pkgs.flutter.override { extraPkgConfigPackages = [ pkgs.libsecret ]; });
buildInputs = [ pkgs.sqlite ];
in
{
_module.args.pkgs = import nixpkgs {
inherit system;
@ -45,20 +61,35 @@
olm
git
clang
(flutter.override { extraPkgConfigPackages = [ pkgs.libsecret ]; })
usedFlutter
(pkgs.writeShellScriptBin "rustup" (builtins.readFile ./nix/fake-rustup.sh))
];
env = {
LD_LIBRARY_PATH = "${
pkgs.lib.makeLibraryPath ([
pkgs.sqlite
])
}:./build/native_assets/linux";
LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}:./build/native_assets/linux";
CPATH = lib.makeSearchPath "include" [ pkgs.glibc.dev ];
};
};
packages.default = usedFlutter.buildFlutterApplication {
inherit src buildInputs;
pname = package.name;
version = package.version;
pubspecLock = importYAML "${src}/pubspec.lock";
gitHashes = {
flutter_chat_ui = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
flutter_link_previewer = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
flyer_chat_text_message = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
window_size = "sha256-XelNtp7tpZ91QCEcvewVphNUtgQX7xrp5QP0oFo6DgM=";
};
patchPhase = /* sh */ ''
patchShebangs ./scripts/generate.sh
./scripts/generate.sh # note: this doesn't quit the build on fail
'';
};
};
};
}

View file

@ -16,6 +16,7 @@ import "package:nexus/models/paginate.dart";
import "package:nexus/models/requests/get_event_request.dart";
import "package:nexus/models/requests/get_related_events_request.dart";
import "package:nexus/models/requests/get_room_state_request.dart";
import "package:nexus/models/requests/join_room_request.dart";
import "package:nexus/models/requests/login_request.dart";
import "package:nexus/models/profile.dart";
import "package:nexus/models/requests/paginate_request.dart";
@ -138,6 +139,11 @@ class ClientController extends AsyncNotifier<int> {
}
}
Future<String> joinRoom(JoinRoomRequest request) async {
final response = await _sendCommand("join_room", request.toJson());
return response["room_id"];
}
Future<void> leaveRoom(Room room) async {
if (room.metadata == null) return;
await _sendCommand("leave_room", {"room_id": room.metadata!.id});

View file

@ -1,9 +1,12 @@
import "package:collection/collection.dart";
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:flutter/material.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:nexus/controllers/client_controller.dart";
import "package:nexus/controllers/key_controller.dart";
import "package:nexus/controllers/spaces_controller.dart";
import "package:nexus/helpers/extensions/link_to_mention.dart";
import "package:nexus/models/requests/join_room_request.dart";
extension JoinRoomWithSnackbars on ClientController {
Future<void> joinRoomWithSnackBars(
@ -11,77 +14,77 @@ extension JoinRoomWithSnackbars on ClientController {
String roomAlias,
WidgetRef ref,
) async {
// final parsed = roomAlias.parseIdentifierIntoParts();
// final alias = parsed?.primaryIdentifier ?? roomAlias;
final roomIdOrAlias = roomAlias.mention ?? roomAlias;
// final scaffoldMessenger = ScaffoldMessenger.of(context);
final scaffoldMessenger = ScaffoldMessenger.of(context);
// final snackbar = scaffoldMessenger.showSnackBar(
// SnackBar(
// content: Text("Joining room $alias."),
// duration: Duration(days: 999),
// ),
// );
final snackbar = scaffoldMessenger.showSnackBar(
SnackBar(
content: Text("Joining room $roomIdOrAlias."),
duration: Duration(days: 999),
),
);
// try {
// final id = await joinRoom(alias, via: parsed?.via.toList());
try {
final id = await joinRoom(
JoinRoomRequest(
roomIdOrAlias: roomIdOrAlias,
via: IList(Uri.tryParse(roomAlias)?.queryParametersAll["via"] ?? []),
),
);
// snackbar.close();
snackbar.close();
// scaffoldMessenger.showSnackBar(
// SnackBar(
// content: Text("Room $alias successfully joined."),
// action: SnackBarAction(
// label: "Open",
// onPressed: () async {
// final spaces = await ref.refresh(
// SpacesController.provider.future,
// );
// final space = spaces.firstWhereOrNull((space) => space.id == id);
scaffoldMessenger.showSnackBar(
SnackBar(
content: Text("Room $roomIdOrAlias successfully joined."),
action: SnackBarAction(
label: "Open",
onPressed: () async {
final spaces = ref.watch(SpacesController.provider);
final space = spaces.firstWhereOrNull((space) => space.id == id);
// await ref
// .watch(
// KeyController.provider(KeyController.spaceKey).notifier,
// )
// .set(
// space?.id ??
// spaces
// .firstWhere(
// (space) =>
// space.children.firstWhereOrNull(
// (child) => child.roomData.id == id,
// ) !=
// null,
// )
// .id,
// );
await ref
.watch(
KeyController.provider(KeyController.spaceKey).notifier,
)
.set(
space?.id ??
spaces
.firstWhere(
(space) => space.children.any(
(child) => child.metadata?.id == id,
),
)
.id,
);
// if (space == null) {
// await ref
// .watch(
// KeyController.provider(KeyController.roomKey).notifier,
// )
// .set(id);
// }
// },
// ),
// ),
// );
// } catch (error) {
// snackbar.close();
// if (context.mounted) {
// scaffoldMessenger.showSnackBar(
// SnackBar(
// backgroundColor: Theme.of(context).colorScheme.errorContainer,
// content: Text(
// error.toString(),
// style: TextStyle(
// color: Theme.of(context).colorScheme.onErrorContainer,
// ),
// ),
// ),
// );
// }
// }
if (space == null) {
await ref
.watch(
KeyController.provider(KeyController.roomKey).notifier,
)
.set(id);
}
},
),
),
);
} catch (error) {
snackbar.close();
if (context.mounted) {
scaffoldMessenger.showSnackBar(
SnackBar(
backgroundColor: Theme.of(context).colorScheme.errorContainer,
content: Text(
error.toString(),
style: TextStyle(
color: Theme.of(context).colorScheme.onErrorContainer,
),
),
),
);
}
}
}
}

View file

@ -29,7 +29,11 @@ extension LinkToMention on String {
if (uri.pathSegments.isNotEmpty) {
final identifier = uri.pathSegments.last;
if (identifier.isNotEmpty) {
return Uri.decodeComponent(identifier);
return "${switch (uri.pathSegments.firstOrNull) {
"r" || "roomid" => "#",
"u" => "@",
_ => "",
}}${Uri.decodeComponent(identifier)}";
}
}
} catch (_) {}

View file

@ -0,0 +1,15 @@
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:freezed_annotation/freezed_annotation.dart";
part "join_room_request.freezed.dart";
part "join_room_request.g.dart";
@freezed
abstract class JoinRoomRequest with _$JoinRoomRequest {
const factory JoinRoomRequest({
required String roomIdOrAlias,
required IList<String> via,
}) = _JoinRoomRequest;
factory JoinRoomRequest.fromJson(Map<String, Object?> json) =>
_$JoinRoomRequestFromJson(json);
}

View file

@ -1,11 +1,8 @@
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
import "package:flutter_hooks/flutter_hooks.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:nexus/controllers/client_controller.dart";
import "package:nexus/models/room.dart";
import "package:nexus/widgets/form_text_input.dart";
class RoomMenu extends ConsumerWidget {
final Room room;

105
src/gomuks/libgomuks.h Normal file
View file

@ -0,0 +1,105 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */
/* package go.mau.fi/gomuks/pkg/ffi */
#line 1 "cgo-builtin-export-prolog"
#include <stddef.h>
#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
extern size_t _GoStringLen(_GoString_ s);
extern const char *_GoStringPtr(_GoString_ s);
#endif
#endif
/* Start of preamble from import "C" comments. */
#line 9 "ffi.go"
#include "gomuksffi.h"
#include <stdlib.h>
static inline void _gomuks_callEventCallback(EventCallback cb, const char *command, int64_t request_id, GomuksOwnedBuffer data) {
cb(command, request_id, data);
}
#line 1 "cgo-generated-wrapper"
/* End of preamble from import "C" comments. */
/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"
#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H
typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#if !defined(__cplusplus) || _MSVC_LANG <= 201402L
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
#include <complex>
typedef std::complex<float> GoComplex64;
typedef std::complex<double> GoComplex128;
#endif
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif
/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
#endif
/* End of boilerplate cgo prologue. */
#ifdef __cplusplus
extern "C" {
#endif
extern GomuksHandle GomuksInit(void);
extern int GomuksStart(GomuksHandle handle, EventCallback callback);
extern void GomuksDestroy(GomuksHandle handle);
extern GomuksResponse GomuksSubmitCommand(GomuksHandle handle, char* command, GomuksBorrowedBuffer data);
extern GomuksAccountInfo GomuksGetAccountInfo(GomuksHandle handle);
extern void GomuksFreeAccountInfo(GomuksAccountInfo info);
extern void GomuksFreeBuffer(GomuksOwnedBuffer buf);
#ifdef __cplusplus
}
#endif

BIN
src/gomuks/libgomuks.so Normal file

Binary file not shown.