From 7c80f5b5ea36765faf91f67420a777d630e44f7c Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Sun, 8 Jan 2023 16:29:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0csrf=5Ftoken=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=EF=BC=8C=E5=B1=8F=E8=94=BD=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + lib/api/mw/mw_api.dart | 4 +- lib/api/mw/mw_api.g.dart | 21 ---- lib/api/response/csrf_token.dart | 29 +++++ lib/api/response/mugenapp.dart | 68 ++++------ lib/api/response/mugenapp.g.dart | 65 ---------- lib/api/response/page_info.g.dart | 78 ------------ lib/api/response/parse.g.dart | 168 ------------------------- lib/api/response/recent_changes.g.dart | 45 ------- lib/api/response/userinfo.g.dart | 114 ----------------- lib/models/settings.g.dart | 16 --- lib/models/site_config.g.dart | 26 ---- lib/models/user.g.dart | 24 ---- pubspec.lock | 16 ++- pubspec.yaml | 4 +- 15 files changed, 76 insertions(+), 604 deletions(-) delete mode 100644 lib/api/mw/mw_api.g.dart create mode 100644 lib/api/response/csrf_token.dart delete mode 100644 lib/api/response/mugenapp.g.dart delete mode 100644 lib/api/response/page_info.g.dart delete mode 100644 lib/api/response/parse.g.dart delete mode 100644 lib/api/response/recent_changes.g.dart delete mode 100644 lib/api/response/userinfo.g.dart delete mode 100644 lib/models/settings.g.dart delete mode 100644 lib/models/site_config.g.dart delete mode 100644 lib/models/user.g.dart diff --git a/.gitignore b/.gitignore index 8cac985..f2e2797 100755 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,8 @@ migrate_working_dir/ .pub-cache/ .pub/ /build/ +*.g.dart +*.freezed.dart # Symbolication related app.*.symbols diff --git a/lib/api/mw/mw_api.dart b/lib/api/mw/mw_api.dart index 5e1c603..befefa4 100755 --- a/lib/api/mw/mw_api.dart +++ b/lib/api/mw/mw_api.dart @@ -19,9 +19,9 @@ class MWApiErrorException implements Exception { MWApiErrorException({required this.code, this.info, this.detail}); factory MWApiErrorException.fromJson(Map json) => - _$MWApiExceptionFromJson(json); + _$MWApiErrorExceptionFromJson(json); - Map toJson() => _$MWApiExceptionToJson(this); + Map toJson() => _$MWApiErrorExceptionToJson(this); @override String toString() { diff --git a/lib/api/mw/mw_api.g.dart b/lib/api/mw/mw_api.g.dart deleted file mode 100644 index f00ddc1..0000000 --- a/lib/api/mw/mw_api.g.dart +++ /dev/null @@ -1,21 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'mw_api.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -MWApiErrorException _$MWApiExceptionFromJson(Map json) => - MWApiErrorException( - code: json['code'] as String, - info: json['info'] as String?, - detail: json['*'] as String?, - ); - -Map _$MWApiExceptionToJson(MWApiErrorException instance) => - { - 'code': instance.code, - 'info': instance.info, - '*': instance.detail, - }; diff --git a/lib/api/response/csrf_token.dart b/lib/api/response/csrf_token.dart new file mode 100644 index 0000000..6b4052e --- /dev/null +++ b/lib/api/response/csrf_token.dart @@ -0,0 +1,29 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'csrf_token.freezed.dart'; +part 'csrf_token.g.dart'; + +@freezed +class CSRFTokenInfo with _$CSRFTokenInfo { + const factory CSRFTokenInfo({ + String? csrftoken, + String? logintoken, + String? createaccounttoken, + String? patroltoken, + String? rollbacktoken, + String? userrightstoken, + String? watchtoken, + }) = _CSRFTokenInfo; + + factory CSRFTokenInfo.fromJson(Map json) => + _$CSRFTokenInfoFromJson(json); +} + +@freezed +class CSRFTokenResponse with _$CSRFTokenResponse { + const factory CSRFTokenResponse({required CSRFTokenInfo tokens}) = + _CSRFTokenInfoResponse; + + factory CSRFTokenResponse.fromJson(Map json) => + _$CSRFTokenResponseFromJson(json); +} diff --git a/lib/api/response/mugenapp.dart b/lib/api/response/mugenapp.dart index b32d057..56ba1ea 100644 --- a/lib/api/response/mugenapp.dart +++ b/lib/api/response/mugenapp.dart @@ -1,65 +1,47 @@ -import 'package:json_annotation/json_annotation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +part 'mugenapp.freezed.dart'; part 'mugenapp.g.dart'; -@JsonSerializable() -class MugenAppStartAuthInfo { - String loginUrl; - String loginRequestKey; - int ttl; - - MugenAppStartAuthInfo({ - required this.loginUrl, - required this.loginRequestKey, - this.ttl = 0, - }); +@freezed +class MugenAppStartAuthInfo with _$MugenAppStartAuthInfo { + const factory MugenAppStartAuthInfo({ + required String loginUrl, + required String loginRequestKey, + @Default(0) int ttl, + }) = _MugenAppStartAuthInfo; factory MugenAppStartAuthInfo.fromJson(Map json) => _$MugenAppStartAuthInfoFromJson(json); - - Map toJson() => _$MugenAppStartAuthInfoToJson(this); } -@JsonSerializable() -class MugenAppStartAuthResponse { - MugenAppStartAuthInfo startauth; - - MugenAppStartAuthResponse({required this.startauth}); +@freezed +class MugenAppStartAuthResponse with _$MugenAppStartAuthResponse { + const factory MugenAppStartAuthResponse( + {required MugenAppStartAuthInfo startauth}) = _MugenAppStartAuthResponse; factory MugenAppStartAuthResponse.fromJson(Map json) => _$MugenAppStartAuthResponseFromJson(json); - - Map toJson() => _$MugenAppStartAuthResponseToJson(this); } -@JsonSerializable() -class MugenAppAttemptAuthInfo { - String status; - int? userid; - String? username; - - MugenAppAttemptAuthInfo({ - required this.status, - this.userid, - this.username, - }); +@freezed +class MugenAppAttemptAuthInfo with _$MugenAppAttemptAuthInfo { + const factory MugenAppAttemptAuthInfo({ + required String status, + int? userid, + String? username, + }) = _MugenAppAttemptAuthInfo; factory MugenAppAttemptAuthInfo.fromJson(Map json) => _$MugenAppAttemptAuthInfoFromJson(json); - - Map toJson() => _$MugenAppAttemptAuthInfoToJson(this); } -@JsonSerializable() -class MugenAppAttemptAuthResponse { - MugenAppAttemptAuthInfo attemptauth; - - MugenAppAttemptAuthResponse({ - required this.attemptauth, - }); +@freezed +class MugenAppAttemptAuthResponse with _$MugenAppAttemptAuthResponse { + const factory MugenAppAttemptAuthResponse({ + required MugenAppAttemptAuthInfo attemptauth, + }) = _MugenAppAttemptAuthResponse; factory MugenAppAttemptAuthResponse.fromJson(Map json) => _$MugenAppAttemptAuthResponseFromJson(json); - - Map toJson() => _$MugenAppAttemptAuthResponseToJson(this); } diff --git a/lib/api/response/mugenapp.g.dart b/lib/api/response/mugenapp.g.dart deleted file mode 100644 index e15464a..0000000 --- a/lib/api/response/mugenapp.g.dart +++ /dev/null @@ -1,65 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'mugenapp.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -MugenAppStartAuthInfo _$MugenAppStartAuthInfoFromJson( - Map json) => - MugenAppStartAuthInfo( - loginUrl: json['loginUrl'] as String, - loginRequestKey: json['loginRequestKey'] as String, - ttl: json['ttl'] as int? ?? 0, - ); - -Map _$MugenAppStartAuthInfoToJson( - MugenAppStartAuthInfo instance) => - { - 'loginUrl': instance.loginUrl, - 'loginRequestKey': instance.loginRequestKey, - 'ttl': instance.ttl, - }; - -MugenAppStartAuthResponse _$MugenAppStartAuthResponseFromJson( - Map json) => - MugenAppStartAuthResponse( - startauth: MugenAppStartAuthInfo.fromJson( - json['startauth'] as Map), - ); - -Map _$MugenAppStartAuthResponseToJson( - MugenAppStartAuthResponse instance) => - { - 'startauth': instance.startauth, - }; - -MugenAppAttemptAuthInfo _$MugenAppAttemptAuthInfoFromJson( - Map json) => - MugenAppAttemptAuthInfo( - status: json['status'] as String, - userid: json['userid'] as int?, - username: json['username'] as String?, - ); - -Map _$MugenAppAttemptAuthInfoToJson( - MugenAppAttemptAuthInfo instance) => - { - 'status': instance.status, - 'userid': instance.userid, - 'username': instance.username, - }; - -MugenAppAttemptAuthResponse _$MugenAppAttemptAuthResponseFromJson( - Map json) => - MugenAppAttemptAuthResponse( - attemptauth: MugenAppAttemptAuthInfo.fromJson( - json['attemptauth'] as Map), - ); - -Map _$MugenAppAttemptAuthResponseToJson( - MugenAppAttemptAuthResponse instance) => - { - 'attemptauth': instance.attemptauth, - }; diff --git a/lib/api/response/page_info.g.dart b/lib/api/response/page_info.g.dart deleted file mode 100644 index 914215f..0000000 --- a/lib/api/response/page_info.g.dart +++ /dev/null @@ -1,78 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'page_info.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -PageInfo _$PageInfoFromJson(Map json) => PageInfo( - pageid: json['pageid'] as int, - ns: json['ns'] as int, - title: json['title'] as String, - subtitle: json['subtitle'] as String?, - displayTitle: json['displayTitle'] as String?, - description: json['extract'] as String?, - contentmodel: json['contentmodel'] as String?, - pagelanguage: json['pagelanguage'] as String?, - pagelanguagehtmlcode: json['pagelanguagehtmlcode'] as String?, - pagelanguagedir: json['pagelanguagedir'] as String?, - inwatchlist: json['inwatchlist'] as bool?, - updatedTime: json['touched'] == null - ? null - : DateTime.parse(json['touched'] as String), - lastrevid: json['lastrevid'] as int?, - length: json['length'] as int?, - fullurl: json['fullurl'] as String?, - editurl: json['editurl'] as String?, - canonicalurl: json['canonicalurl'] as String?, - )..thumbnail = json['thumbnail'] == null - ? null - : PageImageInfo.fromJson(json['thumbnail'] as Map); - -Map _$PageInfoToJson(PageInfo instance) => { - 'pageid': instance.pageid, - 'ns': instance.ns, - 'title': instance.title, - 'displayTitle': instance.displayTitle, - 'subtitle': instance.subtitle, - 'lastrevid': instance.lastrevid, - 'contentmodel': instance.contentmodel, - 'pagelanguage': instance.pagelanguage, - 'pagelanguagehtmlcode': instance.pagelanguagehtmlcode, - 'pagelanguagedir': instance.pagelanguagedir, - 'inwatchlist': instance.inwatchlist, - 'length': instance.length, - 'fullurl': instance.fullurl, - 'editurl': instance.editurl, - 'canonicalurl': instance.canonicalurl, - 'thumbnail': instance.thumbnail, - 'extract': instance.description, - 'touched': instance.updatedTime?.toIso8601String(), - }; - -PagesResponse _$PagesResponseFromJson(Map json) => - PagesResponse( - pages: (json['pages'] as List) - .map((e) => PageInfo.fromJson(e as Map)) - .toList(), - ); - -Map _$PagesResponseToJson(PagesResponse instance) => - { - 'pages': instance.pages, - }; - -PageImageInfo _$PageImageInfoFromJson(Map json) => - PageImageInfo( - source: json['source'] as String, - width: json['width'] as int?, - height: json['height'] as int?, - ); - -Map _$PageImageInfoToJson(PageImageInfo instance) => - { - 'source': instance.source, - 'width': instance.width, - 'height': instance.height, - }; diff --git a/lib/api/response/parse.g.dart b/lib/api/response/parse.g.dart deleted file mode 100644 index 54c3dd1..0000000 --- a/lib/api/response/parse.g.dart +++ /dev/null @@ -1,168 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'parse.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -MWParseCategoryInfo _$MWParseCategoryInfoFromJson(Map json) => - MWParseCategoryInfo( - sortkey: json['sortkey'] as String? ?? "", - category: json['category'] as String? ?? "", - ); - -Map _$MWParseCategoryInfoToJson( - MWParseCategoryInfo instance) => - { - 'sortkey': instance.sortkey, - 'category': instance.category, - }; - -MWParseLangLinkInfo _$MWParseLangLinkInfoFromJson(Map json) => - MWParseLangLinkInfo( - lang: json['lang'] as String? ?? "", - url: json['url'] as String? ?? "", - langname: json['langname'] as String? ?? "", - autonym: json['autonym'] as String? ?? "", - title: json['title'] as String? ?? "", - ); - -Map _$MWParseLangLinkInfoToJson( - MWParseLangLinkInfo instance) => - { - 'lang': instance.lang, - 'url': instance.url, - 'langname': instance.langname, - 'autonym': instance.autonym, - 'title': instance.title, - }; - -MWParsePageLinkInfo _$MWParsePageLinkInfoFromJson(Map json) => - MWParsePageLinkInfo( - ns: json['ns'] as int? ?? -1, - title: json['title'] as String? ?? "", - exists: json['exists'] as bool? ?? false, - ); - -Map _$MWParsePageLinkInfoToJson( - MWParsePageLinkInfo instance) => - { - 'ns': instance.ns, - 'title': instance.title, - 'exists': instance.exists, - }; - -MWParseSectionInfo _$MWParseSectionInfoFromJson(Map json) => - MWParseSectionInfo( - toclevel: json['toclevel'] as int? ?? -1, - level: json['level'] as int? ?? -1, - line: json['line'] as String? ?? "", - number: json['number'] as String? ?? "", - index: json['index'] as String? ?? "", - fromtitle: json['fromtitle'] as String? ?? "", - byteoffset: json['byteoffset'] as int?, - anchor: json['anchor'] as String? ?? "", - ); - -Map _$MWParseSectionInfoToJson(MWParseSectionInfo instance) => - { - 'toclevel': instance.toclevel, - 'level': instance.level, - 'line': instance.line, - 'number': instance.number, - 'index': instance.index, - 'fromtitle': instance.fromtitle, - 'byteoffset': instance.byteoffset, - 'anchor': instance.anchor, - }; - -MWParseInfo _$MWParseInfoFromJson(Map json) => MWParseInfo( - title: json['title'] as String? ?? "", - pageid: json['pageid'] as int? ?? -1, - revid: json['revid'] as int? ?? -1, - text: json['text'] as String? ?? "", - langlink: (json['langlink'] as List?) - ?.map((e) => - MWParseLangLinkInfo.fromJson(e as Map)) - .toList() ?? - const [], - categories: (json['categories'] as List?) - ?.map((e) => - MWParseCategoryInfo.fromJson(e as Map)) - .toList() ?? - const [], - links: (json['links'] as List?) - ?.map((e) => - MWParsePageLinkInfo.fromJson(e as Map)) - .toList() ?? - const [], - templates: (json['templates'] as List?) - ?.map((e) => - MWParsePageLinkInfo.fromJson(e as Map)) - .toList() ?? - const [], - images: (json['images'] as List?) - ?.map((e) => e as String) - .toList() ?? - const [], - externallinks: (json['externallinks'] as List?) - ?.map((e) => e as String) - .toList() ?? - const [], - sections: (json['sections'] as List?) - ?.map( - (e) => MWParseSectionInfo.fromJson(e as Map)) - .toList() ?? - const [], - showtoc: json['showtoc'] as bool? ?? true, - displaytitle: json['displaytitle'] as String? ?? "", - modules: (json['modules'] as List?) - ?.map((e) => e as String) - .toList() ?? - const [], - modulescripts: (json['modulescripts'] as List?) - ?.map((e) => e as String) - .toList() ?? - const [], - modulestyles: (json['modulestyles'] as List?) - ?.map((e) => e as String) - .toList() ?? - const [], - jsconfigvars: json['jsconfigvars'] as Map? ?? const {}, - iwlinks: json['iwlinks'] as Map? ?? const {}, - properties: json['properties'] as Map? ?? const {}, - ); - -Map _$MWParseInfoToJson(MWParseInfo instance) => - { - 'title': instance.title, - 'pageid': instance.pageid, - 'revid': instance.revid, - 'text': instance.text, - 'langlink': instance.langlink, - 'categories': instance.categories, - 'links': instance.links, - 'templates': instance.templates, - 'images': instance.images, - 'externallinks': instance.externallinks, - 'sections': instance.sections, - 'showtoc': instance.showtoc, - 'displaytitle': instance.displaytitle, - 'modules': instance.modules, - 'modulescripts': instance.modulescripts, - 'modulestyles': instance.modulestyles, - 'jsconfigvars': instance.jsconfigvars, - 'iwlinks': instance.iwlinks, - 'properties': instance.properties, - }; - -MWParseResponse _$MWParseResponseFromJson(Map json) => - MWParseResponse( - parse: MWParseInfo.fromJson(json['parse'] as Map), - ); - -Map _$MWParseResponseToJson(MWParseResponse instance) => - { - 'parse': instance.parse, - }; diff --git a/lib/api/response/recent_changes.g.dart b/lib/api/response/recent_changes.g.dart deleted file mode 100644 index 586a00d..0000000 --- a/lib/api/response/recent_changes.g.dart +++ /dev/null @@ -1,45 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'recent_changes.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -RecentChangesItem _$RecentChangesItemFromJson(Map json) => - RecentChangesItem( - type: json['type'] as String?, - ns: json['ns'] as int, - title: json['title'] as String, - pageid: json['pageid'] as int, - revid: json['revid'] as int, - oldRevid: json['old_revid'] as int?, - rcid: json['rcid'] as int?, - timestamp: DateTime.parse(json['timestamp'] as String), - ); - -Map _$RecentChangesItemToJson(RecentChangesItem instance) => - { - 'type': instance.type, - 'ns': instance.ns, - 'title': instance.title, - 'pageid': instance.pageid, - 'revid': instance.revid, - 'old_revid': instance.oldRevid, - 'rcid': instance.rcid, - 'timestamp': instance.timestamp.toIso8601String(), - }; - -RecentChangesResponse _$RecentChangesResponseFromJson( - Map json) => - RecentChangesResponse( - recentchanges: (json['recentchanges'] as List) - .map((e) => RecentChangesItem.fromJson(e as Map)) - .toList(), - ); - -Map _$RecentChangesResponseToJson( - RecentChangesResponse instance) => - { - 'recentchanges': instance.recentchanges, - }; diff --git a/lib/api/response/userinfo.g.dart b/lib/api/response/userinfo.g.dart deleted file mode 100644 index 8cf69f6..0000000 --- a/lib/api/response/userinfo.g.dart +++ /dev/null @@ -1,114 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'userinfo.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -UserGroupMembership _$UserGroupMembershipFromJson(Map json) => - UserGroupMembership( - group: json['group'] as String, - expiry: json['expiry'] as String, - ); - -Map _$UserGroupMembershipToJson( - UserGroupMembership instance) => - { - 'group': instance.group, - 'expiry': instance.expiry, - }; - -UserAcceptLang _$UserAcceptLangFromJson(Map json) => - UserAcceptLang( - q: (json['q'] as num).toDouble(), - langCode: json['*'] as String, - ); - -Map _$UserAcceptLangToJson(UserAcceptLang instance) => - { - 'q': instance.q, - '*': instance.langCode, - }; - -MetaUserInfo _$MetaUserInfoFromJson(Map json) => MetaUserInfo( - id: json['id'] as int, - name: json['name'] as String, - groups: - (json['groups'] as List?)?.map((e) => e as String).toList(), - groupmemberships: (json['groupmemberships'] as List?) - ?.map((e) => UserGroupMembership.fromJson(e as Map)) - .toList(), - implicitgroups: (json['implicitgroups'] as List?) - ?.map((e) => e as String) - .toList(), - rights: - (json['rights'] as List?)?.map((e) => e as String).toList(), - changeablegroups: - (json['changeablegroups'] as Map?)?.map( - (k, e) => - MapEntry(k, (e as List).map((e) => e as String).toList()), - ), - options: json['options'] as Map?, - editcount: json['editcount'] as int?, - realname: json['realname'] as String?, - email: json['email'] as String?, - emailauthenticated: json['emailauthenticated'] == null - ? null - : DateTime.parse(json['emailauthenticated'] as String), - registrationdate: json['registrationdate'] == null - ? null - : DateTime.parse(json['registrationdate'] as String), - acceptlang: (json['acceptlang'] as List?) - ?.map((e) => UserAcceptLang.fromJson(e as Map)) - .toList(), - unreadcount: json['unreadcount'] as int?, - centralids: (json['centralids'] as Map?)?.map( - (k, e) => MapEntry(k, e as int), - ), - attachedlocal: (json['attachedlocal'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), - latestcontrib: json['latestcontrib'] == null - ? null - : DateTime.parse(json['latestcontrib'] as String), - ); - -Map _$MetaUserInfoToJson(MetaUserInfo instance) => - { - 'id': instance.id, - 'name': instance.name, - 'groups': instance.groups, - 'groupmemberships': instance.groupmemberships, - 'implicitgroups': instance.implicitgroups, - 'rights': instance.rights, - 'changeablegroups': instance.changeablegroups, - 'options': instance.options, - 'editcount': instance.editcount, - 'realname': instance.realname, - 'email': instance.email, - 'emailauthenticated': instance.emailauthenticated?.toIso8601String(), - 'registrationdate': instance.registrationdate?.toIso8601String(), - 'acceptlang': instance.acceptlang, - 'unreadcount': instance.unreadcount, - 'centralids': instance.centralids, - 'attachedlocal': instance.attachedlocal, - 'latestcontrib': instance.latestcontrib?.toIso8601String(), - }; - -MetaUserInfoResponse _$MetaUserInfoResponseFromJson( - Map json) => - MetaUserInfoResponse( - userinfo: MetaUserInfo.fromJson(json['userinfo'] as Map), - useravatar: (json['useravatar'] as Map?)?.map( - (k, e) => MapEntry(int.parse(k), e as String), - ), - ); - -Map _$MetaUserInfoResponseToJson( - MetaUserInfoResponse instance) => - { - 'userinfo': instance.userinfo, - 'useravatar': - instance.useravatar?.map((k, e) => MapEntry(k.toString(), e)), - }; diff --git a/lib/models/settings.g.dart b/lib/models/settings.g.dart deleted file mode 100644 index bbdb8a7..0000000 --- a/lib/models/settings.g.dart +++ /dev/null @@ -1,16 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'settings.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -AppSettings _$AppSettingsFromJson(Map json) => AppSettings( - betaPageRender: json['betaPageRender'] as bool?, - ); - -Map _$AppSettingsToJson(AppSettings instance) => - { - 'betaPageRender': instance.betaPageRender, - }; diff --git a/lib/models/site_config.g.dart b/lib/models/site_config.g.dart deleted file mode 100644 index a2c3021..0000000 --- a/lib/models/site_config.g.dart +++ /dev/null @@ -1,26 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'site_config.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -SiteConfig _$SiteConfigFromJson(Map json) => SiteConfig( - moduleStyles: (json['moduleStyles'] as List?) - ?.map((e) => e as String) - .toList() ?? - const [], - moduleScripts: (json['moduleScripts'] as List?) - ?.map((e) => e as String) - .toList() ?? - const [], - renderTheme: json['renderTheme'] as String? ?? Global.renderThemeFallback, - ); - -Map _$SiteConfigToJson(SiteConfig instance) => - { - 'moduleStyles': instance.moduleStyles, - 'moduleScripts': instance.moduleScripts, - 'renderTheme': instance.renderTheme, - }; diff --git a/lib/models/user.g.dart b/lib/models/user.g.dart deleted file mode 100644 index 20c3284..0000000 --- a/lib/models/user.g.dart +++ /dev/null @@ -1,24 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'user.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -UserInfo _$UserInfoFromJson(Map json) => UserInfo( - userId: json['userId'] as int, - userName: json['userName'] as String, - nickName: json['nickName'] as String?, - avatarUrlSet: (json['avatarUrlSet'] as Map?)?.map( - (k, e) => MapEntry(int.parse(k), e as String), - ), - ); - -Map _$UserInfoToJson(UserInfo instance) => { - 'userId': instance.userId, - 'userName': instance.userName, - 'nickName': instance.nickName, - 'avatarUrlSet': - instance.avatarUrlSet?.map((k, e) => MapEntry(k.toString(), e)), - }; diff --git a/pubspec.lock b/pubspec.lock index 9690ce4..ea5a0dc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -385,6 +385,20 @@ packages: description: flutter source: sdk version: "0.0.0" + freezed: + dependency: "direct dev" + description: + name: freezed + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.2" + freezed_annotation: + dependency: "direct main" + description: + name: freezed_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" frontend_server_client: dependency: transitive description: @@ -477,7 +491,7 @@ packages: source: hosted version: "4.7.0" json_serializable: - dependency: "direct main" + dependency: "direct dev" description: name: json_serializable url: "https://pub.dartlang.org" diff --git a/pubspec.yaml b/pubspec.yaml index c37515d..b6a263c 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,7 +51,6 @@ dependencies: flutter_web_browser: ^0.17.1 flutter_inappwebview: ^5.7.2+3 web_smooth_scroll: ^1.0.0 - json_serializable: ^6.5.4 json_annotation: ^4.7.0 flutter_html: ^2.2.1 ruby_text: ^3.0.1 @@ -65,6 +64,7 @@ dependencies: dio_http2_adapter: ^2.0.0 dio_cache_interceptor: ^3.3.1 get: + freezed_annotation: ^2.2.0 dev_dependencies: flutter_test: @@ -77,6 +77,8 @@ dev_dependencies: # rules and activating additional ones. flutter_lints: ^2.0.0 build_runner: ^2.3.3 + json_serializable: ^6.5.4 + freezed: ^2.3.2 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec