Support 9978 too

pull/590/head
FongMi 9 months ago
parent 28a8b39afd
commit 4f5ec5c8db
  1. 16
      README.md
  2. 6
      app/build.gradle
  3. 2
      app/src/leanback/res/layout/dialog_proxy.xml
  4. 36
      app/src/main/java/com/fongmi/android/tv/server/Server.java
  5. 2
      app/src/mobile/java/com/fongmi/android/tv/utils/ScanTask.java
  6. 2
      app/src/mobile/res/layout/dialog_proxy.xml

@ -102,49 +102,49 @@ https://github.com/CatVodTVOfficial/CatVodTVJarLoader
刷新詳情
```
http://127.0.0.1:8964/action?do=refresh&type=detail
http://127.0.0.1:9978/action?do=refresh&type=detail
```
刷新播放
```
http://127.0.0.1:8964/action?do=refresh&type=player
http://127.0.0.1:9978/action?do=refresh&type=player
```
刷新直播
```
http://127.0.0.1:8964/action?do=refresh&type=live
http://127.0.0.1:9978/action?do=refresh&type=live
```
推送字幕
```
http://127.0.0.1:8964/action?do=refresh&type=subtitle&path=http://xxx
http://127.0.0.1:9978/action?do=refresh&type=subtitle&path=http://xxx
```
推送彈幕
```
http://127.0.0.1:8964/action?do=refresh&type=danmaku&path=http://xxx
http://127.0.0.1:9978/action?do=refresh&type=danmaku&path=http://xxx
```
新增緩存字串
```
http://127.0.0.1:8964/cache?do=set&key=xxx&value=xxx
http://127.0.0.1:9978/cache?do=set&key=xxx&value=xxx
```
取得緩存字串
```
http://127.0.0.1:8964/cache?do=get&key=xxx
http://127.0.0.1:9978/cache?do=get&key=xxx
```
刪除緩存字串
```
http://127.0.0.1:8964/cache?do=del&key=xxx
http://127.0.0.1:9978/cache?do=del&key=xxx
```
### Proxy

@ -89,7 +89,7 @@ dependencies {
implementation project(':quickjs')
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.media:media:1.7.0'
implementation 'androidx.room:room-runtime:2.7.0'
implementation 'androidx.room:room-runtime:2.7.1'
implementation 'cat.ereza:customactivityoncrash:2.4.0'
implementation 'com.github.bassaer:materialdesigncolors:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.16.0'
@ -113,13 +113,13 @@ dependencies {
implementation 'org.fourthline.cling:cling-support:2.1.1'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation('org.simpleframework:simple-xml:2.7.1') { exclude group: 'stax', module: 'stax-api' exclude group: 'xpp3', module: 'xpp3' }
leanbackImplementation 'androidx.leanback:leanback:1.2.0-rc01'
leanbackImplementation 'androidx.leanback:leanback:1.2.0'
leanbackImplementation 'com.github.JessYanCoding:AndroidAutoSize:1.2.1'
mobileImplementation 'androidx.biometric:biometric:1.1.0'
mobileImplementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
mobileImplementation 'com.google.android.flexbox:flexbox:3.0.0'
mobileImplementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
annotationProcessor 'androidx.room:room-compiler:2.7.0'
annotationProcessor 'androidx.room:room-compiler:2.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.3.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.1.4'

@ -34,7 +34,7 @@
android:layout_above="@+id/bottom"
android:layout_alignStart="@+id/info"
android:layout_marginBottom="10dp"
android:hint="socks5://127.0.0.1:8964"
android:hint="socks5://127.0.0.1:9978"
android:imeOptions="actionDone"
android:importantForAutofill="no"
android:inputType="text"

@ -4,11 +4,14 @@ import com.fongmi.android.tv.player.Players;
import com.github.catvod.Proxy;
import com.github.catvod.utils.Util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Server {
private final List<Nano> items;
private Players player;
private Nano nano;
private int port;
private static class Loader {
static volatile Server INSTANCE = new Server();
@ -19,11 +22,7 @@ public class Server {
}
public Server() {
this.port = 8964;
}
public int getPort() {
return port;
this.items = new ArrayList<>();
}
public Players getPlayer() {
@ -50,23 +49,26 @@ public class Server {
return "http://" + (local ? "127.0.0.1" : Util.getIp()) + ":" + getPort();
}
public int getPort() {
for (Nano item : items) if (item.getListeningPort() == 8964) return 8964;
for (Nano item : items) if (item.getListeningPort() == 9978) return 9978;
return -1;
}
public void start() {
if (nano != null) return;
while (port < 9999) {
if (!items.isEmpty()) return;
for (int port : Arrays.asList(9978, 8964)) {
try {
nano = new Nano(port);
Nano nano = new Nano(port);
nano.start(500, false);
Proxy.set(port);
nano.start();
return;
} catch (Exception e) {
nano = null;
port++;
items.add(nano);
} catch (Throwable ignored) {
}
}
}
public void stop() {
if (nano != null) nano.stop();
nano = null;
for (Nano item : items) item.stop();
}
}

@ -73,7 +73,7 @@ public class ScanTask {
Set<String> urls = new HashSet<>(ips);
String local = Server.get().getAddress();
String base = local.substring(0, local.lastIndexOf(".") + 1);
for (int i = 1; i < 256; i++) urls.add(base + i + ":8964");
for (int i = 1; i < 256; i++) urls.add(base + i + ":9978");
return new ArrayList<>(urls);
}

@ -18,7 +18,7 @@
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="socks5://127.0.0.1:8964"
android:hint="socks5://127.0.0.1:9978"
android:imeOptions="actionDone"
android:importantForAutofill="no"
android:inputType="text"

Loading…
Cancel
Save