pakstr 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -103,11 +103,19 @@ class LocalServer(
|
|
|
103
103
|
): Response {
|
|
104
104
|
|
|
105
105
|
val apiBase =
|
|
106
|
-
|
|
106
|
+
|
|
107
|
+
RuntimeConfig.load(context)
|
|
108
|
+
|
|
109
|
+
.optString("apiBase", null)
|
|
110
|
+
|
|
107
111
|
?: return newFixedLengthResponse(
|
|
112
|
+
|
|
108
113
|
Response.Status.INTERNAL_ERROR,
|
|
114
|
+
|
|
109
115
|
"application/json",
|
|
116
|
+
|
|
110
117
|
"""{"error":"apiBase missing"}"""
|
|
118
|
+
|
|
111
119
|
)
|
|
112
120
|
|
|
113
121
|
|
|
@@ -24,9 +24,6 @@ class ShellRuntime(
|
|
|
24
24
|
|
|
25
25
|
private lateinit var controller: WebViewController
|
|
26
26
|
|
|
27
|
-
private var apiBase: String? = null
|
|
28
|
-
|
|
29
|
-
|
|
30
27
|
fun start() {
|
|
31
28
|
|
|
32
29
|
controller = WebViewController(
|
|
@@ -37,16 +34,6 @@ class ShellRuntime(
|
|
|
37
34
|
permissionHandler
|
|
38
35
|
)
|
|
39
36
|
|
|
40
|
-
val runtimeConfig = RuntimeConfig.load(context)
|
|
41
|
-
|
|
42
|
-
apiBase = runtimeConfig.optString(
|
|
43
|
-
|
|
44
|
-
"apiBase",
|
|
45
|
-
|
|
46
|
-
null
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
|
|
50
37
|
CoroutineScope(Dispatchers.IO).launch {
|
|
51
38
|
|
|
52
39
|
val ok = startServer()
|
|
@@ -80,48 +67,34 @@ class ShellRuntime(
|
|
|
80
67
|
if (server != null)
|
|
81
68
|
return true
|
|
82
69
|
|
|
83
|
-
|
|
84
70
|
return try {
|
|
85
71
|
|
|
86
72
|
server = LocalServer(
|
|
87
|
-
|
|
88
73
|
context,
|
|
89
|
-
|
|
90
|
-
port,
|
|
91
|
-
|
|
92
|
-
apiBase
|
|
93
|
-
|
|
74
|
+
port
|
|
94
75
|
)
|
|
95
76
|
|
|
96
|
-
|
|
97
77
|
server?.start(
|
|
98
78
|
NanoHTTPD.SOCKET_READ_TIMEOUT,
|
|
99
79
|
false
|
|
100
80
|
)
|
|
101
81
|
|
|
102
|
-
|
|
103
82
|
AppDebugLogger.log(
|
|
104
83
|
"SERVER",
|
|
105
84
|
"Started OK"
|
|
106
85
|
)
|
|
107
86
|
|
|
108
|
-
|
|
109
87
|
true
|
|
110
88
|
|
|
111
|
-
|
|
112
89
|
} catch (e: Exception) {
|
|
113
90
|
|
|
114
|
-
|
|
115
91
|
AppDebugLogger.log(
|
|
116
92
|
"SERVER",
|
|
117
93
|
"Failed to start: ${e.message}"
|
|
118
94
|
)
|
|
119
95
|
|
|
120
|
-
|
|
121
96
|
false
|
|
122
|
-
|
|
123
97
|
}
|
|
124
|
-
|
|
125
98
|
}
|
|
126
99
|
|
|
127
100
|
|