mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix #155
This commit is contained in:
@@ -19,8 +19,7 @@ class ComicSourcePage extends StatefulWidget {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
var dio = AppDio();
|
var dio = AppDio();
|
||||||
var res = await dio.get<String>(
|
var res = await dio.get<String>(appdata.settings['comicSourceListUrl']);
|
||||||
"https://raw.githubusercontent.com/venera-app/venera-configs/master/index.json");
|
|
||||||
if (res.statusCode != 200) {
|
if (res.statusCode != 200) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -299,9 +298,9 @@ class _BodyState extends State<_Body> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.to(() => _EditFilePage(source.filePath, () async {
|
context.to(() => _EditFilePage(source.filePath, () async {
|
||||||
await ComicSource.reload();
|
await ComicSource.reload();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> update(ComicSource source) async {
|
static Future<void> update(ComicSource source) async {
|
||||||
@@ -419,7 +418,8 @@ class _BodyState extends State<_Body> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void help() {
|
void help() {
|
||||||
launchUrlString("https://github.com/venera-app/venera/blob/master/doc/comic_source.md");
|
launchUrlString(
|
||||||
|
"https://github.com/venera-app/venera/blob/master/doc/comic_source.md");
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> handleAddSource(String url) async {
|
Future<void> handleAddSource(String url) async {
|
||||||
@@ -521,18 +521,29 @@ class _ComicSourceListState extends State<_ComicSourceList> {
|
|||||||
var key = json![index]["key"];
|
var key = json![index]["key"];
|
||||||
var action = currentKey.contains(key)
|
var action = currentKey.contains(key)
|
||||||
? const Icon(Icons.check, size: 20).paddingRight(8)
|
? const Icon(Icons.check, size: 20).paddingRight(8)
|
||||||
: Tooltip(
|
: Button.filled(
|
||||||
message: "Add",
|
child: Text("Add".tl),
|
||||||
child: Button.icon(
|
onPressed: () async {
|
||||||
color: context.colorScheme.primary,
|
var fileName = json![index]["fileName"];
|
||||||
icon: const Icon(Icons.add),
|
var url = json![index]["url"];
|
||||||
onPressed: () async {
|
if (url == null || !(url.toString()).isURL) {
|
||||||
await widget.onAdd(
|
var listUrl =
|
||||||
"https://raw.githubusercontent.com/venera-app/venera-configs/master/${json![index]["fileName"]}");
|
appdata.settings['comicSourceListUrl'] as String;
|
||||||
setState(() {});
|
if (listUrl
|
||||||
},
|
.replaceFirst("https://", "")
|
||||||
),
|
.replaceFirst("http://", "")
|
||||||
);
|
.contains("/")) {
|
||||||
|
url =
|
||||||
|
listUrl.substring(0, listUrl.lastIndexOf("/") + 1) +
|
||||||
|
fileName;
|
||||||
|
} else {
|
||||||
|
url = '$listUrl/$fileName';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await widget.onAdd(url);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
).fixHeight(32);
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(json![index]["name"]),
|
title: Text(json![index]["name"]),
|
||||||
|
Reference in New Issue
Block a user