mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 12:34:45 +08:00
update RSHttp
This commit is contained in:
@ -2,8 +2,8 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/api/http_api.dart' as rust_http;
|
||||
|
||||
class AnalyticsApi {
|
||||
static touch(String key) async {
|
||||
@ -11,9 +11,8 @@ class AnalyticsApi {
|
||||
if (kDebugMode) return;
|
||||
dPrint("AnalyticsApi.touch === $key start");
|
||||
try {
|
||||
await rust_http.postJsonString(
|
||||
url: "${URLConf.xkeycApiHome}/analytics/$key",
|
||||
jsonData: json.encode({"test": "a"}));
|
||||
await RSHttp.postData("${URLConf.xkeycApiHome}/analytics/$key",
|
||||
data: utf8.encode(json.encode({"test": "a"})), contentType: "application/json");
|
||||
dPrint("AnalyticsApi.touch === $key over");
|
||||
} catch (e) {
|
||||
dPrint("AnalyticsApi.touch === $key Error:$e");
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/api/http_api.dart' as rust_http;
|
||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||
import 'package:starcitizen_doctor/data/app_placard_data.dart';
|
||||
import 'package:starcitizen_doctor/data/app_version_data.dart';
|
||||
import 'package:starcitizen_doctor/data/countdown_festival_item_data.dart';
|
||||
@ -33,9 +33,8 @@ class Api {
|
||||
|
||||
static Future<Map<String, dynamic>> getAppReleaseDataByVersionName(
|
||||
String version) async {
|
||||
final r = await rust_http.getString(
|
||||
url:
|
||||
"${URLConf.gitlabApiPath}/repos/SCToolBox/Release/releases/tags/$version");
|
||||
final r = await RSHttp.getText(
|
||||
"${URLConf.gitlabApiPath}/repos/SCToolBox/Release/releases/tags/$version");
|
||||
return json.decode(r);
|
||||
}
|
||||
|
||||
@ -52,8 +51,8 @@ class Api {
|
||||
}
|
||||
|
||||
static Future<List> getScServerStatus() async {
|
||||
final r = await rust_http.getString(
|
||||
url: "https://status.robertsspaceindustries.com/index.json");
|
||||
final r = await RSHttp.getText(
|
||||
"https://status.robertsspaceindustries.com/index.json");
|
||||
final map = json.decode(r);
|
||||
return map["systems"];
|
||||
}
|
||||
@ -65,8 +64,7 @@ class Api {
|
||||
}
|
||||
|
||||
static Future<String> getRepoData(String dir, String name) async {
|
||||
final r =
|
||||
await rust_http.getString(url: "${URLConf.apiRepoPath}/$dir/$name");
|
||||
final r = await RSHttp.getText("${URLConf.apiRepoPath}/$dir/$name");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dart_rss/dart_rss.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/api/http_api.dart' as rust_http;
|
||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
|
||||
class RSSApi {
|
||||
static Future<List<RssItem>> getRssVideo() async {
|
||||
final r = await rust_http.getString(url: URLConf.rssVideoUrl);
|
||||
final r = await RSHttp.getText(URLConf.rssVideoUrl);
|
||||
final f = RssFeed.parse(r);
|
||||
return f.items.sublist(0, 8);
|
||||
}
|
||||
|
||||
static Future<List<RssItem>> getRssText() async {
|
||||
final r1 = await rust_http.getString(url: URLConf.rssTextUrl1);
|
||||
final r1 = await RSHttp.getText(URLConf.rssTextUrl1);
|
||||
final r1f = RssFeed.parse(r1);
|
||||
final r2 = await rust_http.getString(url: URLConf.rssTextUrl2);
|
||||
final r2 = await RSHttp.getText(URLConf.rssTextUrl2);
|
||||
final r2f = RssFeed.parse(r2);
|
||||
final items = r1f.items..addAll(r2f.items);
|
||||
items.sort((a, b) {
|
||||
|
Reference in New Issue
Block a user