initial commit
This commit is contained in:
commit
e8e678bc2b
23 changed files with 2339 additions and 0 deletions
36
lib/controllers/login_controller.dart
Normal file
36
lib/controllers/login_controller.dart
Normal file
|
@ -0,0 +1,36 @@
|
|||
import "dart:io";
|
||||
import "dart:convert";
|
||||
import "package:http/http.dart";
|
||||
import "package:nexusbot/controllers/settings_controller.dart";
|
||||
import "package:riverpod/riverpod.dart";
|
||||
|
||||
class LoginController extends AsyncNotifier<String> {
|
||||
@override
|
||||
Future<String> build() async {
|
||||
final settings = ref.watch(SettingsController.provider)!;
|
||||
final response = await post(
|
||||
settings.homeserver.replace(path: "_matrix/client/v3/login"),
|
||||
headers: {HttpHeaders.contentTypeHeader: "application/json"},
|
||||
body: json.encode({
|
||||
"type": "m.login.password",
|
||||
"device_id": "script",
|
||||
"identifier": {"type": "m.id.user", "user": settings.name},
|
||||
"password": (await File(
|
||||
settings.botPasswordFile,
|
||||
).readAsString()).trim(),
|
||||
}),
|
||||
);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception(
|
||||
"Login failed, check your name, homeserver and botPasswordFile: ${response.body}",
|
||||
);
|
||||
}
|
||||
|
||||
return json.decode(response.body)["access_token"];
|
||||
}
|
||||
|
||||
static final provider = AsyncNotifierProvider<LoginController, String>(
|
||||
LoginController.new,
|
||||
);
|
||||
}
|
16
lib/controllers/settings_controller.dart
Normal file
16
lib/controllers/settings_controller.dart
Normal file
|
@ -0,0 +1,16 @@
|
|||
import "package:args/args.dart";
|
||||
import "package:nexusbot/models/settings.dart";
|
||||
import "package:riverpod/riverpod.dart";
|
||||
|
||||
class SettingsController extends Notifier<Settings?> {
|
||||
@override
|
||||
Settings? build() => null;
|
||||
|
||||
void set(ArgResults args) => state = Settings.fromJson(<String, dynamic>{
|
||||
for (final opt in args.options) opt: args.option(opt),
|
||||
});
|
||||
|
||||
static final provider = NotifierProvider<SettingsController, Settings?>(
|
||||
SettingsController.new,
|
||||
);
|
||||
}
|
66
lib/helpers/api_helper.dart
Normal file
66
lib/helpers/api_helper.dart
Normal file
|
@ -0,0 +1,66 @@
|
|||
import "dart:convert";
|
||||
import "dart:io";
|
||||
import "package:nexusbot/controllers/login_controller.dart";
|
||||
import "package:nexusbot/controllers/settings_controller.dart";
|
||||
import "package:nexusbot/models/registration.dart";
|
||||
import "package:shelf/shelf.dart";
|
||||
import "package:http/http.dart" as http;
|
||||
import "package:riverpod/riverpod.dart";
|
||||
|
||||
class ApiHelper {
|
||||
final Ref ref;
|
||||
ApiHelper(this.ref);
|
||||
|
||||
String getTxn() => DateTime.now().millisecondsSinceEpoch.toString();
|
||||
Future<Map<String, String>> getHeaders() async => {
|
||||
HttpHeaders.contentTypeHeader: "application/json",
|
||||
HttpHeaders.authorizationHeader:
|
||||
"Bearer ${await ref.watch(LoginController.provider.future)}",
|
||||
};
|
||||
|
||||
Future<String> getRoomId(String alias) async {
|
||||
final settings = ref.watch(SettingsController.provider)!;
|
||||
final response = await http.get(
|
||||
settings.homeserver.replace(
|
||||
path: "_matrix/client/v3/directory/room/$alias",
|
||||
),
|
||||
headers: await getHeaders(),
|
||||
);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception("Alias lookup failed for $alias: ${response.body}");
|
||||
}
|
||||
|
||||
return json.decode(response.body)["room_id"];
|
||||
}
|
||||
|
||||
Future<Response> register(Request request) async {
|
||||
final settings = ref.read(SettingsController.provider)!;
|
||||
final registration = Registration.fromJson(
|
||||
json.decode(await request.readAsString()),
|
||||
);
|
||||
|
||||
final response = await http.post(
|
||||
settings.homeserver.replace(
|
||||
path:
|
||||
"_matrix/client/v3/rooms/${getRoomId(settings.adminRoom)}/send/m.room.message/${getTxn()}",
|
||||
),
|
||||
headers: await getHeaders(),
|
||||
body: json.encode({
|
||||
"msgtype": "m.text",
|
||||
"body":
|
||||
"Signup request from ${registration.username}, email is: ${registration.email}.",
|
||||
}),
|
||||
);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception(
|
||||
"Registration failed for ${registration.username}: ${response.body}",
|
||||
);
|
||||
}
|
||||
|
||||
return Response.found(settings.foundUri);
|
||||
}
|
||||
|
||||
static final provider = Provider<ApiHelper>(ApiHelper.new);
|
||||
}
|
15
lib/models/registration.dart
Normal file
15
lib/models/registration.dart
Normal file
|
@ -0,0 +1,15 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
|
||||
part "registration.freezed.dart";
|
||||
part "registration.g.dart";
|
||||
|
||||
@freezed
|
||||
abstract class Registration with _$Registration {
|
||||
const factory Registration({
|
||||
required String email,
|
||||
required String username,
|
||||
}) = _Registration;
|
||||
|
||||
factory Registration.fromJson(Map<String, dynamic> json) =>
|
||||
_$RegistrationFromJson(json);
|
||||
}
|
151
lib/models/registration.freezed.dart
Normal file
151
lib/models/registration.freezed.dart
Normal file
|
@ -0,0 +1,151 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'registration.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Registration {
|
||||
|
||||
String get email; String get username;
|
||||
/// Create a copy of Registration
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$RegistrationCopyWith<Registration> get copyWith => _$RegistrationCopyWithImpl<Registration>(this as Registration, _$identity);
|
||||
|
||||
/// Serializes this Registration to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Registration&&(identical(other.email, email) || other.email == email)&&(identical(other.username, username) || other.username == username));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,email,username);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Registration(email: $email, username: $username)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $RegistrationCopyWith<$Res> {
|
||||
factory $RegistrationCopyWith(Registration value, $Res Function(Registration) _then) = _$RegistrationCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String email, String username
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$RegistrationCopyWithImpl<$Res>
|
||||
implements $RegistrationCopyWith<$Res> {
|
||||
_$RegistrationCopyWithImpl(this._self, this._then);
|
||||
|
||||
final Registration _self;
|
||||
final $Res Function(Registration) _then;
|
||||
|
||||
/// Create a copy of Registration
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? email = null,Object? username = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,username: null == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _Registration implements Registration {
|
||||
const _Registration({required this.email, required this.username});
|
||||
factory _Registration.fromJson(Map<String, dynamic> json) => _$RegistrationFromJson(json);
|
||||
|
||||
@override final String email;
|
||||
@override final String username;
|
||||
|
||||
/// Create a copy of Registration
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$RegistrationCopyWith<_Registration> get copyWith => __$RegistrationCopyWithImpl<_Registration>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$RegistrationToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Registration&&(identical(other.email, email) || other.email == email)&&(identical(other.username, username) || other.username == username));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,email,username);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Registration(email: $email, username: $username)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$RegistrationCopyWith<$Res> implements $RegistrationCopyWith<$Res> {
|
||||
factory _$RegistrationCopyWith(_Registration value, $Res Function(_Registration) _then) = __$RegistrationCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String email, String username
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$RegistrationCopyWithImpl<$Res>
|
||||
implements _$RegistrationCopyWith<$Res> {
|
||||
__$RegistrationCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Registration _self;
|
||||
final $Res Function(_Registration) _then;
|
||||
|
||||
/// Create a copy of Registration
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? email = null,Object? username = null,}) {
|
||||
return _then(_Registration(
|
||||
email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
||||
as String,username: null == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
16
lib/models/registration.g.dart
Normal file
16
lib/models/registration.g.dart
Normal file
|
@ -0,0 +1,16 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'registration.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_Registration _$RegistrationFromJson(Map<String, dynamic> json) =>
|
||||
_Registration(
|
||||
email: json['email'] as String,
|
||||
username: json['username'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RegistrationToJson(_Registration instance) =>
|
||||
<String, dynamic>{'email': instance.email, 'username': instance.username};
|
21
lib/models/settings.dart
Normal file
21
lib/models/settings.dart
Normal file
|
@ -0,0 +1,21 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
|
||||
part "settings.freezed.dart";
|
||||
part "settings.g.dart";
|
||||
|
||||
@freezed
|
||||
abstract class Settings with _$Settings {
|
||||
const factory Settings({
|
||||
required String socket,
|
||||
required Uri homeserver,
|
||||
required Uri foundUri,
|
||||
required String name,
|
||||
required String adminRoom,
|
||||
required String botPasswordFile,
|
||||
required String smtpPasswordFile,
|
||||
required String? inviteTo,
|
||||
}) = _Settings;
|
||||
|
||||
factory Settings.fromJson(Map<String, dynamic> json) =>
|
||||
_$SettingsFromJson(json);
|
||||
}
|
169
lib/models/settings.freezed.dart
Normal file
169
lib/models/settings.freezed.dart
Normal file
|
@ -0,0 +1,169 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'settings.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Settings {
|
||||
|
||||
String get socket; Uri get homeserver; Uri get foundUri; String get name; String get adminRoom; String get botPasswordFile; String get smtpPasswordFile; String? get inviteTo;
|
||||
/// Create a copy of Settings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$SettingsCopyWith<Settings> get copyWith => _$SettingsCopyWithImpl<Settings>(this as Settings, _$identity);
|
||||
|
||||
/// Serializes this Settings to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Settings&&(identical(other.socket, socket) || other.socket == socket)&&(identical(other.homeserver, homeserver) || other.homeserver == homeserver)&&(identical(other.foundUri, foundUri) || other.foundUri == foundUri)&&(identical(other.name, name) || other.name == name)&&(identical(other.adminRoom, adminRoom) || other.adminRoom == adminRoom)&&(identical(other.botPasswordFile, botPasswordFile) || other.botPasswordFile == botPasswordFile)&&(identical(other.smtpPasswordFile, smtpPasswordFile) || other.smtpPasswordFile == smtpPasswordFile)&&(identical(other.inviteTo, inviteTo) || other.inviteTo == inviteTo));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,socket,homeserver,foundUri,name,adminRoom,botPasswordFile,smtpPasswordFile,inviteTo);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Settings(socket: $socket, homeserver: $homeserver, foundUri: $foundUri, name: $name, adminRoom: $adminRoom, botPasswordFile: $botPasswordFile, smtpPasswordFile: $smtpPasswordFile, inviteTo: $inviteTo)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $SettingsCopyWith<$Res> {
|
||||
factory $SettingsCopyWith(Settings value, $Res Function(Settings) _then) = _$SettingsCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String socket, Uri homeserver, Uri foundUri, String name, String adminRoom, String botPasswordFile, String smtpPasswordFile, String? inviteTo
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$SettingsCopyWithImpl<$Res>
|
||||
implements $SettingsCopyWith<$Res> {
|
||||
_$SettingsCopyWithImpl(this._self, this._then);
|
||||
|
||||
final Settings _self;
|
||||
final $Res Function(Settings) _then;
|
||||
|
||||
/// Create a copy of Settings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? socket = null,Object? homeserver = null,Object? foundUri = null,Object? name = null,Object? adminRoom = null,Object? botPasswordFile = null,Object? smtpPasswordFile = null,Object? inviteTo = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
socket: null == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
|
||||
as String,homeserver: null == homeserver ? _self.homeserver : homeserver // ignore: cast_nullable_to_non_nullable
|
||||
as Uri,foundUri: null == foundUri ? _self.foundUri : foundUri // ignore: cast_nullable_to_non_nullable
|
||||
as Uri,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,adminRoom: null == adminRoom ? _self.adminRoom : adminRoom // ignore: cast_nullable_to_non_nullable
|
||||
as String,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,smtpPasswordFile: null == smtpPasswordFile ? _self.smtpPasswordFile : smtpPasswordFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _Settings implements Settings {
|
||||
const _Settings({required this.socket, required this.homeserver, required this.foundUri, required this.name, required this.adminRoom, required this.botPasswordFile, required this.smtpPasswordFile, required this.inviteTo});
|
||||
factory _Settings.fromJson(Map<String, dynamic> json) => _$SettingsFromJson(json);
|
||||
|
||||
@override final String socket;
|
||||
@override final Uri homeserver;
|
||||
@override final Uri foundUri;
|
||||
@override final String name;
|
||||
@override final String adminRoom;
|
||||
@override final String botPasswordFile;
|
||||
@override final String smtpPasswordFile;
|
||||
@override final String? inviteTo;
|
||||
|
||||
/// Create a copy of Settings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SettingsCopyWith<_Settings> get copyWith => __$SettingsCopyWithImpl<_Settings>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$SettingsToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Settings&&(identical(other.socket, socket) || other.socket == socket)&&(identical(other.homeserver, homeserver) || other.homeserver == homeserver)&&(identical(other.foundUri, foundUri) || other.foundUri == foundUri)&&(identical(other.name, name) || other.name == name)&&(identical(other.adminRoom, adminRoom) || other.adminRoom == adminRoom)&&(identical(other.botPasswordFile, botPasswordFile) || other.botPasswordFile == botPasswordFile)&&(identical(other.smtpPasswordFile, smtpPasswordFile) || other.smtpPasswordFile == smtpPasswordFile)&&(identical(other.inviteTo, inviteTo) || other.inviteTo == inviteTo));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,socket,homeserver,foundUri,name,adminRoom,botPasswordFile,smtpPasswordFile,inviteTo);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Settings(socket: $socket, homeserver: $homeserver, foundUri: $foundUri, name: $name, adminRoom: $adminRoom, botPasswordFile: $botPasswordFile, smtpPasswordFile: $smtpPasswordFile, inviteTo: $inviteTo)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$SettingsCopyWith<$Res> implements $SettingsCopyWith<$Res> {
|
||||
factory _$SettingsCopyWith(_Settings value, $Res Function(_Settings) _then) = __$SettingsCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String socket, Uri homeserver, Uri foundUri, String name, String adminRoom, String botPasswordFile, String smtpPasswordFile, String? inviteTo
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$SettingsCopyWithImpl<$Res>
|
||||
implements _$SettingsCopyWith<$Res> {
|
||||
__$SettingsCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Settings _self;
|
||||
final $Res Function(_Settings) _then;
|
||||
|
||||
/// Create a copy of Settings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? socket = null,Object? homeserver = null,Object? foundUri = null,Object? name = null,Object? adminRoom = null,Object? botPasswordFile = null,Object? smtpPasswordFile = null,Object? inviteTo = freezed,}) {
|
||||
return _then(_Settings(
|
||||
socket: null == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
|
||||
as String,homeserver: null == homeserver ? _self.homeserver : homeserver // ignore: cast_nullable_to_non_nullable
|
||||
as Uri,foundUri: null == foundUri ? _self.foundUri : foundUri // ignore: cast_nullable_to_non_nullable
|
||||
as Uri,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,adminRoom: null == adminRoom ? _self.adminRoom : adminRoom // ignore: cast_nullable_to_non_nullable
|
||||
as String,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,smtpPasswordFile: null == smtpPasswordFile ? _self.smtpPasswordFile : smtpPasswordFile // ignore: cast_nullable_to_non_nullable
|
||||
as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
29
lib/models/settings.g.dart
Normal file
29
lib/models/settings.g.dart
Normal file
|
@ -0,0 +1,29 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'settings.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_Settings _$SettingsFromJson(Map<String, dynamic> json) => _Settings(
|
||||
socket: json['socket'] as String,
|
||||
homeserver: Uri.parse(json['homeserver'] as String),
|
||||
foundUri: Uri.parse(json['foundUri'] as String),
|
||||
name: json['name'] as String,
|
||||
adminRoom: json['adminRoom'] as String,
|
||||
botPasswordFile: json['botPasswordFile'] as String,
|
||||
smtpPasswordFile: json['smtpPasswordFile'] as String,
|
||||
inviteTo: json['inviteTo'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{
|
||||
'socket': instance.socket,
|
||||
'homeserver': instance.homeserver.toString(),
|
||||
'foundUri': instance.foundUri.toString(),
|
||||
'name': instance.name,
|
||||
'adminRoom': instance.adminRoom,
|
||||
'botPasswordFile': instance.botPasswordFile,
|
||||
'smtpPasswordFile': instance.smtpPasswordFile,
|
||||
'inviteTo': instance.inviteTo,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue