Use double quotes
This commit is contained in:
parent
53867e273b
commit
43ad7937f9
6 changed files with 49 additions and 49 deletions
|
@ -1,5 +1,5 @@
|
||||||
import "dart:io";
|
import "dart:io";
|
||||||
import 'package:cli_tools/config.dart';
|
import "package:cli_tools/config.dart";
|
||||||
import "package:matrixoidc/controllers/settings_controller.dart";
|
import "package:matrixoidc/controllers/settings_controller.dart";
|
||||||
import "package:matrixoidc/helpers/api_helper.dart";
|
import "package:matrixoidc/helpers/api_helper.dart";
|
||||||
import "package:riverpod/riverpod.dart";
|
import "package:riverpod/riverpod.dart";
|
||||||
|
@ -36,7 +36,7 @@ void main(List<String> argsRaw) async {
|
||||||
..get("/userinfo", apiHelper.userinfoHandler)
|
..get("/userinfo", apiHelper.userinfoHandler)
|
||||||
..get("/bridge", apiHelper.bridgeHandler)
|
..get("/bridge", apiHelper.bridgeHandler)
|
||||||
..post("/login", apiHelper.loginHandler)
|
..post("/login", apiHelper.loginHandler)
|
||||||
..post('/introspect', apiHelper.introspectionHandler)
|
..post("/introspect", apiHelper.introspectionHandler)
|
||||||
..post("/logout", apiHelper.logoutHandler)
|
..post("/logout", apiHelper.logoutHandler)
|
||||||
..post("/token", apiHelper.tokenHandler))
|
..post("/token", apiHelper.tokenHandler))
|
||||||
.call,
|
.call,
|
||||||
|
|
|
@ -54,8 +54,8 @@ class ApiHelper {
|
||||||
|
|
||||||
Future<Response> bridgeHandler(Request request) async {
|
Future<Response> bridgeHandler(Request request) async {
|
||||||
final query = request.url.queryParameters;
|
final query = request.url.queryParameters;
|
||||||
final code = query['code'];
|
final code = query["code"];
|
||||||
final redirectUri = query['redirect_uri'];
|
final redirectUri = query["redirect_uri"];
|
||||||
|
|
||||||
if (code == null || redirectUri == null) {
|
if (code == null || redirectUri == null) {
|
||||||
return Response(400, body: "Missing code or redirect_uri");
|
return Response(400, body: "Missing code or redirect_uri");
|
||||||
|
@ -65,7 +65,7 @@ class ApiHelper {
|
||||||
Request(
|
Request(
|
||||||
"POST",
|
"POST",
|
||||||
Uri.base,
|
Uri.base,
|
||||||
body: utf8.encode('code=$code&client_id=proxy'),
|
body: utf8.encode("code=$code&client_id=proxy"),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ class ApiHelper {
|
||||||
return Response.found(
|
return Response.found(
|
||||||
redirectUri,
|
redirectUri,
|
||||||
headers: {
|
headers: {
|
||||||
'set-cookie':
|
"set-cookie":
|
||||||
'id_token=${json.decode(await tokenRes.readAsString())["id_token"]}; Path=/; Secure; HttpOnly; SameSite=Lax; Domain=.${ref.watch(SettingsController.provider)!.serviceDomain}',
|
"id_token=${json.decode(await tokenRes.readAsString())["id_token"]}; Path=/; Secure; HttpOnly; SameSite=Lax; Domain=.${ref.watch(SettingsController.provider)!.serviceDomain}",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class ApiHelper {
|
||||||
|
|
||||||
final user = codes[code]!;
|
final user = codes[code]!;
|
||||||
ref.read(AuthCodeController.provider.notifier).remove(code);
|
ref.read(AuthCodeController.provider.notifier).remove(code);
|
||||||
final name = user.userId.split(':').first.replaceFirst('@', '');
|
final name = user.userId.split(":").first.replaceFirst("@", "");
|
||||||
|
|
||||||
final jwt = JWT(
|
final jwt = JWT(
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ class ApiHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> introspectionHandler(Request request) async {
|
Future<Response> introspectionHandler(Request request) async {
|
||||||
final token = Uri.splitQueryString(await request.readAsString())['token'];
|
final token = Uri.splitQueryString(await request.readAsString())["token"];
|
||||||
if (token == null) return Response(400, body: "Missing token");
|
if (token == null) return Response(400, body: "Missing token");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -171,13 +171,13 @@ class ApiHelper {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Response.ok(
|
return Response.ok(
|
||||||
json.encode({'active': true}),
|
json.encode({"active": true}),
|
||||||
headers: {'content-type': 'application/json'},
|
headers: {"content-type": "application/json"},
|
||||||
);
|
);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return Response.ok(
|
return Response.ok(
|
||||||
json.encode({'active': false}),
|
json.encode({"active": false}),
|
||||||
headers: {'content-type': 'application/json'},
|
headers: {"content-type": "application/json"},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// ignore_for_file: type=lint
|
// 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
|
// 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 'matrix_user.dart';
|
part of "matrix_user.dart";
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// FreezedGenerator
|
// FreezedGenerator
|
||||||
|
@ -20,7 +20,7 @@ mixin _$MatrixUser {
|
||||||
/// Create a copy of MatrixUser
|
/// Create a copy of MatrixUser
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma("vm:prefer-inline")
|
||||||
$MatrixUserCopyWith<MatrixUser> get copyWith => _$MatrixUserCopyWithImpl<MatrixUser>(this as MatrixUser, _$identity);
|
$MatrixUserCopyWith<MatrixUser> get copyWith => _$MatrixUserCopyWithImpl<MatrixUser>(this as MatrixUser, _$identity);
|
||||||
|
|
||||||
/// Serializes this MatrixUser to a JSON map.
|
/// Serializes this MatrixUser to a JSON map.
|
||||||
|
@ -38,7 +38,7 @@ int get hashCode => Object.hash(runtimeType,userId,matrixToken);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'MatrixUser(userId: $userId, matrixToken: $matrixToken)';
|
return "MatrixUser(userId: $userId, matrixToken: $matrixToken)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class _$MatrixUserCopyWithImpl<$Res>
|
||||||
|
|
||||||
/// Create a copy of MatrixUser
|
/// Create a copy of MatrixUser
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? userId = null,Object? matrixToken = null,}) {
|
@pragma("vm:prefer-inline") @override $Res call({Object? userId = null,Object? matrixToken = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,matrixToken: null == matrixToken ? _self.matrixToken : matrixToken // ignore: cast_nullable_to_non_nullable
|
as String,matrixToken: null == matrixToken ? _self.matrixToken : matrixToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
@ -90,7 +90,7 @@ class _MatrixUser implements MatrixUser {
|
||||||
/// Create a copy of MatrixUser
|
/// Create a copy of MatrixUser
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma("vm:prefer-inline")
|
||||||
_$MatrixUserCopyWith<_MatrixUser> get copyWith => __$MatrixUserCopyWithImpl<_MatrixUser>(this, _$identity);
|
_$MatrixUserCopyWith<_MatrixUser> get copyWith => __$MatrixUserCopyWithImpl<_MatrixUser>(this, _$identity);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -109,7 +109,7 @@ int get hashCode => Object.hash(runtimeType,userId,matrixToken);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'MatrixUser(userId: $userId, matrixToken: $matrixToken)';
|
return "MatrixUser(userId: $userId, matrixToken: $matrixToken)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class __$MatrixUserCopyWithImpl<$Res>
|
||||||
|
|
||||||
/// Create a copy of MatrixUser
|
/// Create a copy of MatrixUser
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? userId = null,Object? matrixToken = null,}) {
|
@override @pragma("vm:prefer-inline") $Res call({Object? userId = null,Object? matrixToken = null,}) {
|
||||||
return _then(_MatrixUser(
|
return _then(_MatrixUser(
|
||||||
userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
userId: null == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,matrixToken: null == matrixToken ? _self.matrixToken : matrixToken // ignore: cast_nullable_to_non_nullable
|
as String,matrixToken: null == matrixToken ? _self.matrixToken : matrixToken // ignore: cast_nullable_to_non_nullable
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
part of 'matrix_user.dart';
|
part of "matrix_user.dart";
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_MatrixUser _$MatrixUserFromJson(Map<String, dynamic> json) => _MatrixUser(
|
_MatrixUser _$MatrixUserFromJson(Map<String, dynamic> json) => _MatrixUser(
|
||||||
userId: json['userId'] as String,
|
userId: json["userId"] as String,
|
||||||
matrixToken: json['matrixToken'] as String,
|
matrixToken: json["matrixToken"] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$MatrixUserToJson(_MatrixUser instance) =>
|
Map<String, dynamic> _$MatrixUserToJson(_MatrixUser instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'userId': instance.userId,
|
"userId": instance.userId,
|
||||||
'matrixToken': instance.matrixToken,
|
"matrixToken": instance.matrixToken,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// ignore_for_file: type=lint
|
// 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
|
// 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';
|
part of "settings.dart";
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// FreezedGenerator
|
// FreezedGenerator
|
||||||
|
@ -20,7 +20,7 @@ mixin _$Settings {
|
||||||
/// Create a copy of Settings
|
/// Create a copy of Settings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma("vm:prefer-inline")
|
||||||
$SettingsCopyWith<Settings> get copyWith => _$SettingsCopyWithImpl<Settings>(this as Settings, _$identity);
|
$SettingsCopyWith<Settings> get copyWith => _$SettingsCopyWithImpl<Settings>(this as Settings, _$identity);
|
||||||
|
|
||||||
/// Serializes this Settings to a JSON map.
|
/// Serializes this Settings to a JSON map.
|
||||||
|
@ -38,7 +38,7 @@ int get hashCode => Object.hash(runtimeType,socket,serviceDomain,address,port,ho
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Settings(socket: $socket, serviceDomain: $serviceDomain, address: $address, port: $port, homeserver: $homeserver, issuer: $issuer, jwtSecretFile: $jwtSecretFile, authorizeEndpoint: $authorizeEndpoint)';
|
return "Settings(socket: $socket, serviceDomain: $serviceDomain, address: $address, port: $port, homeserver: $homeserver, issuer: $issuer, jwtSecretFile: $jwtSecretFile, authorizeEndpoint: $authorizeEndpoint)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class _$SettingsCopyWithImpl<$Res>
|
||||||
|
|
||||||
/// Create a copy of Settings
|
/// Create a copy of Settings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? socket = freezed,Object? serviceDomain = null,Object? address = null,Object? port = null,Object? homeserver = null,Object? issuer = null,Object? jwtSecretFile = null,Object? authorizeEndpoint = null,}) {
|
@pragma("vm:prefer-inline") @override $Res call({Object? socket = freezed,Object? serviceDomain = null,Object? address = null,Object? port = null,Object? homeserver = null,Object? issuer = null,Object? jwtSecretFile = null,Object? authorizeEndpoint = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
socket: freezed == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
|
socket: freezed == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,serviceDomain: null == serviceDomain ? _self.serviceDomain : serviceDomain // ignore: cast_nullable_to_non_nullable
|
as String?,serviceDomain: null == serviceDomain ? _self.serviceDomain : serviceDomain // ignore: cast_nullable_to_non_nullable
|
||||||
|
@ -102,7 +102,7 @@ class _Settings implements Settings {
|
||||||
/// Create a copy of Settings
|
/// Create a copy of Settings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma("vm:prefer-inline")
|
||||||
_$SettingsCopyWith<_Settings> get copyWith => __$SettingsCopyWithImpl<_Settings>(this, _$identity);
|
_$SettingsCopyWith<_Settings> get copyWith => __$SettingsCopyWithImpl<_Settings>(this, _$identity);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -121,7 +121,7 @@ int get hashCode => Object.hash(runtimeType,socket,serviceDomain,address,port,ho
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Settings(socket: $socket, serviceDomain: $serviceDomain, address: $address, port: $port, homeserver: $homeserver, issuer: $issuer, jwtSecretFile: $jwtSecretFile, authorizeEndpoint: $authorizeEndpoint)';
|
return "Settings(socket: $socket, serviceDomain: $serviceDomain, address: $address, port: $port, homeserver: $homeserver, issuer: $issuer, jwtSecretFile: $jwtSecretFile, authorizeEndpoint: $authorizeEndpoint)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class __$SettingsCopyWithImpl<$Res>
|
||||||
|
|
||||||
/// Create a copy of Settings
|
/// Create a copy of Settings
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? socket = freezed,Object? serviceDomain = null,Object? address = null,Object? port = null,Object? homeserver = null,Object? issuer = null,Object? jwtSecretFile = null,Object? authorizeEndpoint = null,}) {
|
@override @pragma("vm:prefer-inline") $Res call({Object? socket = freezed,Object? serviceDomain = null,Object? address = null,Object? port = null,Object? homeserver = null,Object? issuer = null,Object? jwtSecretFile = null,Object? authorizeEndpoint = null,}) {
|
||||||
return _then(_Settings(
|
return _then(_Settings(
|
||||||
socket: freezed == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
|
socket: freezed == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,serviceDomain: null == serviceDomain ? _self.serviceDomain : serviceDomain // ignore: cast_nullable_to_non_nullable
|
as String?,serviceDomain: null == serviceDomain ? _self.serviceDomain : serviceDomain // ignore: cast_nullable_to_non_nullable
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
part of 'settings.dart';
|
part of "settings.dart";
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_Settings _$SettingsFromJson(Map<String, dynamic> json) => _Settings(
|
_Settings _$SettingsFromJson(Map<String, dynamic> json) => _Settings(
|
||||||
socket: json['socket'] as String?,
|
socket: json["socket"] as String?,
|
||||||
serviceDomain: json['serviceDomain'] as String,
|
serviceDomain: json["serviceDomain"] as String,
|
||||||
address: json['address'] as String,
|
address: json["address"] as String,
|
||||||
port: json['port'] as String,
|
port: json["port"] as String,
|
||||||
homeserver: json['homeserver'] as String,
|
homeserver: json["homeserver"] as String,
|
||||||
issuer: json['issuer'] as String,
|
issuer: json["issuer"] as String,
|
||||||
jwtSecretFile: json['jwtSecretFile'] as String,
|
jwtSecretFile: json["jwtSecretFile"] as String,
|
||||||
authorizeEndpoint: json['authorizeEndpoint'] as String,
|
authorizeEndpoint: json["authorizeEndpoint"] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{
|
Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{
|
||||||
'socket': instance.socket,
|
"socket": instance.socket,
|
||||||
'serviceDomain': instance.serviceDomain,
|
"serviceDomain": instance.serviceDomain,
|
||||||
'address': instance.address,
|
"address": instance.address,
|
||||||
'port': instance.port,
|
"port": instance.port,
|
||||||
'homeserver': instance.homeserver,
|
"homeserver": instance.homeserver,
|
||||||
'issuer': instance.issuer,
|
"issuer": instance.issuer,
|
||||||
'jwtSecretFile': instance.jwtSecretFile,
|
"jwtSecretFile": instance.jwtSecretFile,
|
||||||
'authorizeEndpoint': instance.authorizeEndpoint,
|
"authorizeEndpoint": instance.authorizeEndpoint,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue