This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This is a generated file; do not edit or check into version control. | ||
path_provider=C:\\Users\\linqihang\\scoop\\apps\\flutter\\current\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-2.0.2\\ | ||
path_provider_linux=C:\\Users\\linqihang\\scoop\\apps\\flutter\\current\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_linux-2.0.0\\ | ||
path_provider_macos=C:\\Users\\linqihang\\scoop\\apps\\flutter\\current\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_macos-2.0.0\\ | ||
path_provider_windows=C:\\Users\\linqihang\\scoop\\apps\\flutter\\current\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_windows-2.0.1\\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"C:\\\\Users\\\\linqihang\\\\scoop\\\\apps\\\\flutter\\\\current\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.2\\\\","dependencies":[]}],"android":[{"name":"path_provider","path":"C:\\\\Users\\\\linqihang\\\\scoop\\\\apps\\\\flutter\\\\current\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\linqihang\\\\scoop\\\\apps\\\\flutter\\\\current\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\linqihang\\\\scoop\\\\apps\\\\flutter\\\\current\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\linqihang\\\\scoop\\\\apps\\\\flutter\\\\current\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.1\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-07-22 18:40:13.592612","version":"2.2.1"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ doc/api/ | |
*.js_ | ||
*.js.deps | ||
*.js.map | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# keylol_flutter | ||
keylol.com mobile flutter client | ||
|
||
# API 列表 | ||
|
||
* /api/mobile/index.php?version=4&module=profile | ||
|
||
用户信息 | ||
|
||
* /api/mobile/index.php?version=4&module=viewthread&tid=?&page=? | ||
|
||
帖子 | ||
|
||
* /api/mobile/index.php?version=4&module=sendreply&action=reply&replysubmit=yes&fid=?&tid=? | ||
|
||
回复 | ||
|
||
message: | ||
posttime: | ||
formhash: | ||
usesig: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:cookie_jar/cookie_jar.dart'; | ||
import 'package:dio/dio.dart'; | ||
import 'package:dio_cookie_manager/dio_cookie_manager.dart'; | ||
import 'package:keylol_flutter/model/profile.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
|
||
class KeylolClient { | ||
static late Dio _dio; | ||
|
||
static Future<void> init() async { | ||
_dio = Dio(BaseOptions( | ||
baseUrl: "https://keylol.com", queryParameters: {'version': 4})); | ||
|
||
var appDocDir = await getApplicationDocumentsDirectory(); | ||
var appDocPath = appDocDir.path; | ||
|
||
var cj = PersistCookieJar( | ||
ignoreExpires: false, storage: FileStorage(appDocPath + "/.cookies/")); | ||
_dio.interceptors.add(CookieManager(cj)); | ||
} | ||
|
||
Future<Profile> fetchProfile() async { | ||
var res = await _dio | ||
.get("/api/mobile/index.php", queryParameters: {'module': 'profile'}); | ||
if (res.statusCode != 200) { | ||
Future.error(res.data); | ||
} | ||
return Profile.fromJson(res.data['Variables']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
class Profile { | ||
String? cookiePre; | ||
String? auth; | ||
String? saltKey; | ||
int? memberUid; | ||
String? memberUsername; | ||
String? memberAvatar; | ||
int? groupId; | ||
String? formHash; | ||
String? isModerator; | ||
int? readAccess; | ||
Notice? notice; | ||
|
||
Profile( | ||
this.cookiePre, | ||
this.auth, | ||
this.saltKey, | ||
this.memberUid, | ||
this.memberUsername, | ||
this.memberAvatar, | ||
this.groupId, | ||
this.formHash, | ||
this.isModerator, | ||
this.readAccess, | ||
this.notice); | ||
|
||
Profile.fromJson(Map<String, dynamic> json) { | ||
cookiePre = json['cookiepre']; | ||
auth = json['auth']; | ||
saltKey = json['saltkey']; | ||
String? memberUidStr = json['memberuid']; | ||
if (memberUidStr != null) { | ||
memberUid = int.parse(memberUidStr); | ||
} | ||
memberUsername = json['memberusername']; | ||
memberAvatar = json['memberavatar']; | ||
String? groupIdStr = json['groupid']; | ||
if (groupIdStr != null) { | ||
groupId = int.parse(groupIdStr); | ||
} | ||
formHash = json['formhash']; | ||
isModerator = json['ismoderator']; | ||
String? readAccessStr = json['readaccess']; | ||
if (readAccessStr != null) { | ||
readAccess = int.parse(readAccessStr); | ||
} | ||
Map<String, dynamic>? noticeJson = json['notice']; | ||
if (noticeJson != null) { | ||
notice = Notice.fromJson(noticeJson); | ||
} | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['cookiepre'] = this.cookiePre; | ||
data['auth'] = this.auth; | ||
data['saltkey'] = this.saltKey; | ||
data['memberuid'] = this.memberUid?.toString(); | ||
data['memberusername'] = this.memberUsername?.toString(); | ||
data['memberavatar'] = this.memberAvatar?.toString(); | ||
data['groupid'] = this.groupId?.toString(); | ||
data['formhash'] = this.formHash; | ||
data['ismoderator'] = this.isModerator; | ||
data['readaccess'] = this.readAccess?.toString(); | ||
data['notice'] = this.notice?.toJson(); | ||
return data; | ||
} | ||
} | ||
|
||
class Notice { | ||
int? newPush; | ||
int? newPm; | ||
int? newPrompt; | ||
int? newMyPost; | ||
|
||
Notice(this.newPush, this.newPm, this.newPrompt, this.newMyPost); | ||
|
||
Notice.fromJson(Map<String, dynamic> json) { | ||
newPush = json['newpush']; | ||
newPm = json['newpm']; | ||
newPrompt = json['newprompt']; | ||
newMyPost = json['newmypost']; | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['newpush'] = this.newPush; | ||
data['newpm'] = this.newPm; | ||
data['newprompt'] = this.newPrompt; | ||
data['newmypost'] = this.newMyPost; | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters