This commit is contained in:
Андрей Дувакин 2025-01-24 22:30:11 +05:00
parent 7454461e84
commit 13429ca61d
3 changed files with 59 additions and 1 deletions

View File

@ -333,7 +333,7 @@ def get_events():
def main():
init_db()
app.run()
app.run('0.0.0.0')
if __name__ == '__main__':

View File

@ -0,0 +1,31 @@
package com.example.russionroadsapp
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.HttpURLConnection
import java.net.URL
object API {
private val API_BASE_URL = "http://192.168.0.124:5000"
fun getNews(onFinish: (String) -> Unit) {
GlobalScope.launch(Dispatchers.IO) {
val reqURL = URL("$API_BASE_URL/rss")
val connection = reqURL.openConnection() as HttpURLConnection
connection.requestMethod = "GET"
if (connection.responseCode == 200) {
val resp = BufferedReader(
InputStreamReader(connection.inputStream)
).use { it.readText() }
onFinish(resp)
} else {
onFinish("Error")
}
}
}
}

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.MyApplication">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>