httpserver

This commit is contained in:
lushunming 2025-07-21 15:02:08 +08:00
parent 48a6d353b6
commit 9e6b74e8ee
5 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,7 @@ public class Init {
public static void init(Context context) { public static void init(Context context) {
get().app = ((Application) context); get().app = ((Application) context);
SpiderDebug.log("自定義爬蟲代碼載入成功!"+"1"); SpiderDebug.log("自定義爬蟲代碼載入成功!"+"1");
// ProxyServer.INSTANCE.stop(); ProxyServer.INSTANCE.stop();
ProxyServer.INSTANCE.start(); ProxyServer.INSTANCE.start();
} }

View File

@ -13,18 +13,18 @@ object ProxyServer {
private val THREAD_NUM = Runtime.getRuntime().availableProcessors() * 2 private val THREAD_NUM = Runtime.getRuntime().availableProcessors() * 2
private const val partSize = 1024 * 1024 * 1 private const val partSize = 1024 * 1024 * 1
private var port = 12345 private var port = 12345
private var server: Server? = null
private val infos = mutableMapOf<String, MutableMap<String, MutableList<String>>>(); private val infos = mutableMapOf<String, MutableMap<String, MutableList<String>>>();
fun stop() { fun stop() {
stop() server?.stop(1000)
} }
fun start() { fun start() {
try { try {
Server(InetSocketAddress(port)).apply { server = Server(InetSocketAddress(port)).apply {
context("/api") { context("/api") {
get("/hello") { "Hello, world!" } get("/hello") { "Hello, world!" }
} }

Binary file not shown.

View File

@ -1 +1 @@
9cfcbe915c5ebd913057e1a1b221be7f fc07413a48c5df5663faf8bda2692848

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;9cfcbe915c5ebd913057e1a1b221be7f", "spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;fc07413a48c5df5663faf8bda2692848",
"lives": [ "lives": [
{ {
"name": "电视直播", "name": "电视直播",