This commit is contained in:
huhuang03 2025-07-02 18:52:10 +08:00
commit 760b507286
4 changed files with 24 additions and 4 deletions

View file

@ -1,5 +1,5 @@
package com.soug.mm.base.config
object PortConfig {
const val HTTP_PORT = 30818
const val HTTP_PORT = 30018
}

View file

@ -1,5 +1,23 @@
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
start_server: push-server close-server-if-need
adb shell "nohup sh -c 'CLASSPATH=/data/local/tmp/souls app_process / com.genymobile.scrcpy.Server 3.3.1' > /data/local/tmp/souls.log 2>&1 &"
push-server:
./gradlew assembleRelease
adb push ./server/build/outputs/apk/release/server-release-unsigned.apk /data/local/tmp/souls
adb push ./server/build/outputs/apk/release/server-release-unsigned.apk /data/local/tmp/souls
close-server-if-need:
#netstat: /proc/kshrink_lruvecd_status: Permission denied
#netstat: /proc/voocphy_batt_fake_temp: Permission denied
#tcp6 0 0 [::]:30018 [::]:* LISTEN 28394/app_process
#tcp6 0 0 ::1:44134 ::1:30018 TIME_WAIT -
#tcp6 0 0 ::1:39992 ::1:30018 TIME_WAIT -
#OP5A15L1:/data/local/tmp $ netstat -tulpn | grep 30018
adb shell "for pid_path in /proc/[0-9]*; do \
pid=$${pid_path#/proc/}; \
if grep -q ':7572' /proc/$$pid/net/tcp 2>/dev/null; then \
kill -9 $$pid; \
echo killed $$pid; \
fi; \
done"

View file

@ -39,6 +39,7 @@ android {
dependencies {
//noinspection GradleDependencyleVersion
implementation(project(":base"))
implementation "org.jetbrains.kotlin:kotlin-stdlib:2.1.21"
implementation("io.ktor:ktor-server-netty:3.2.0")

View file

@ -24,6 +24,7 @@ import com.genymobile.scrcpy.video.ScreenCapture
import com.genymobile.scrcpy.video.SurfaceCapture
import com.genymobile.scrcpy.video.SurfaceEncoder
import com.genymobile.scrcpy.video.VideoSource
import com.soug.mm.base.config.PortConfig
import io.ktor.http.ContentType
import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
@ -49,10 +50,10 @@ object Server {
* 开启http server
*/
private fun startHttpServer() {
embeddedServer(Netty, 8080) {
embeddedServer(Netty, PortConfig.HTTP_PORT) {
routing {
get("/") {
call.respondText("Hello, world!", ContentType.Text.Html)
call.respondText("Hello, world!1", ContentType.Text.Html)
}
}
}.start(wait = true)