Compare commits

...

No commits in common. "android" and "python" have entirely different histories.

64 changed files with 240 additions and 2541 deletions

23
.gitignore vendored
View file

@ -1,12 +1,11 @@
*.iml # venv
/.gradle bin/
/local.properties lib/
/.idea pyvenv.cfg
.DS_Store
/build # vscode
/captures .vscode/
.externalNativeBuild
.cxx # project
local.properties .env
*:Zone.Identifier *.csv
app/release/

8
LICENSE Normal file
View file

@ -0,0 +1,8 @@
Copyright (c) 2021, Mylloon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,12 +1,18 @@
# MobiDL # Disclaimer
## Disclaimer This branch corresponds to the scraper written in Python, check [this branch](https://git.kennel.ml/Anri/mobilismScrap/src/branch/android) for the one written in Kotlin (Android application).
This branch corresponds to the scraper written in Kotlin *for Android*, check [this branch](https://git.kennel.ml/Anri/mobilismScrap/src/branch/python) for the one written in Python.<br>
## Download ## Scrap apps from Mobilism
You can download the app in the [release page](https://git.kennel.ml/Anri/mobilismScrap/releases). Create a `.csv` file with the first 40 results of the search on Mobilism. No need to repeat several annoying clicks to get the latest version of an application anymore.
Application compatible with Android 12. ### Usage
Do `git clone https://git.kennel.ml/Anri/mobilismScrap.git && cd mobilismScrap && git checkout python && python3 main.py [user] [pass] <app>`.
### Requirements Or create `.env` file inside the repo folder with `PSEUDO_MOBILISM`, `PASSWORD_MOBILISM` variables.
Minimum: Android 6.0 (Marshmallow) <br>
Recommended: Android 8.0 (Oreo) You can also add `DEBUG_MOBILISM` variable to add some verboses (only to `.env` file).
#### Applications tested
```
Plex, Spotify, Tiktok, Clash of Clans, Clash Royale, Twitch, Brawl Stars
```
If your requested app isn't working just make an [issue](https://git.kennel.ml/Anri/mobilismScrap/issues).

1
app/.gitignore vendored
View file

@ -1 +0,0 @@
/build

View file

@ -1,43 +0,0 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.mylloon.mobidl"
minSdk 23
targetSdk 31
versionCode 1
versionName "1.2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.github.kittinunf.fuel:fuel:2.3.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'androidx.work:work-runtime-ktx:2.7.1'
}

View file

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mylloon.mobidl" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MobiDL"
android:fullBackupContent="@xml/backup_descriptor">
<activity
android:name=".MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
<receiver
android:name="BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View file

@ -1,4 +0,0 @@
{
"tiktok": "musically",
"twitch livestream multiplayer": "twitch"
}

View file

@ -1,47 +0,0 @@
{
"Which of the following is not a musical instrument? Metronome, violin, banjo, drum.": "Metronome",
"Which of the following is not a cheese? Mozzarella, Cipollina, Brie.": "Cipollina",
"Which of the following cannot be found in the desert? Camel/Bear/Scorpion.": "Bear",
"Which of the following has ancient architecture? Boston, Jerusalem, Seattle.": "Jerusalem",
"Which of the following is not a planet? Mars, Jupiter, Your Mom.": "Your Mom",
"Which of the following is not known for great wine? France, Belgium, Italy.": "Belgium",
"Which of the following is not an ancient civilization? Germany, China, Greece.": "Germany",
"Which of the following is not a flower? Lotus, Rose, Maple.": "Maple",
"Which of the following is not in the US? Beijing, New York City, San Francisco.": "Beijing",
"Who of the following is not an author? Conan Doyle, Hercule Poirot, Agatha Christie.": "Hercule Poirot",
"Which of the following is not a type of meat? Mutton, Beef, Tofu.": "Tofu",
"Who of the following never drove a car? Isaac Newton, Angelina Jolie, The Terminator.": "Isaac Newton",
"Which of the following experiences cold weather? Miami, Moscow, Cairo.": "Moscow",
"Which of the following is not in Europe? Miami, Rome, Barcelona.": "Miami",
"Which of the following has nice beaches? Moscow, Helsinki, Miami.": "Miami",
"Which of the following experiences cold weather? Madagascar, Helsinki, Buenos Aires.": "Helsinki",
"Which of the following has a high alcoholic content? Whiskey, Beer, Wine.": "Whiskey",
"Which of the following is not a whale? Narwhal, Humpback, Your Mom.": "Your Mom",
"Which of the following is not a planet? Hermes, Mercury, Saturn.": "Hermes",
"Who of the following is not a composer? Chopin, Beethoven, Bach, Moriarty.": "Moriarty",
"Which of the following is not a European capital? Paris, Berlin, Washington.": "Washington",
"Who of the following probably never rode in a car? Churchill, Ramses II, Obama.": "Ramses II",
"Which of the following is not a European capital? Paris, Tokyo, Rome.": "Tokyo",
"Which country in Europe is historically neutral in conflicts? Portugal, Switzerland, Austria.": "Switzerland",
"Which of the following countries remained neutral in World War II? Russia, Switzerland, France.": "Switzerland",
"Which one of the following is not in Europe? Paris/London/Chicago.": "Chicago",
"Which of the following is not an ancient civilization? Persia, Parthia, Poland.": "Poland",
"Which of the following languages is most different from English? German, Arabic, Swedish.": "Arabic",
"Which of the following is not made from grapes? Wine, beer, champagne.": "beer",
"Which of the following is not a religion? Judaism, Christianity, Narcissism.": "Narcissism",
"Who of the following has not been prime minister of Great Britain? Merkel, Cameron, Thatcher.": "Merkel",
"Which of the following is not an ancient civilization? Egypt, Inca, Germany.": "Germany",
"Which of the following is an ancient civilization? Spain, Persia, Sweden.": "Persia",
"Which of the following is not an ancient civilization? France, China, Carthage.": "France",
"Which of the following is not a capital of a country? Barcelona, Kyiv, London.": "Barcelona",
"Who of the following never drove a car? Jesus, Bush, Austin Powers.": "Jesus",
"Which of the following is not a fish? Salmon, Shark, Dolphin.": "Shark",
"Which of the following is not a tree? Cranberry, Apple, Orange.": "Cranberry",
"Which of the following is not a cheese? Camembert, Cumberbatch, Brie.": "Cumberbatch",
"Who of the following is not a painter? Dali, Picasso, that cousin who went to art school, Rembrandt.": "that cousin who went to art school",
"Which of the following is not an ancient civilization? Maya, Sumeria, Portugal.": "Portugal",
"Which of the following is not a real animal? Comodo Dragon, Salamander, Unicorn.": "Unicorn",
"Which of the following is a dish? Hamburg, Violin, Sausage.": "Sausage",
"Which of the following isn't a colonial power? Portugal, Spain, Switzerland." : "Switzerland",
"Which of the following is not among the ancient wonders of the world? Petra, Pyramid of Giza, Eiffel Tower.": "Eiffel Tower"
}

View file

@ -1,149 +0,0 @@
package com.mylloon.mobidl
import android.content.Context.MODE_PRIVATE
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import java.security.KeyPairGenerator
import java.security.KeyStore
import java.security.PrivateKey
import java.security.PublicKey
import javax.crypto.Cipher
class Credentials {
private val provider = "AndroidKeyStore" // location of the key
private val aliasKeyStore = "MobiDL" // name of the key
private val transformation = "RSA/ECB/PKCS1Padding" // 'type' of the key
private val sharedPref = "com.mylloon.MobiDL" // shared pref name
fun generateKey() { // generate RSA Keys
val keyPairGenerator = KeyPairGenerator.getInstance(
KeyProperties.KEY_ALGORITHM_RSA, provider
)
keyPairGenerator.initialize(
KeyGenParameterSpec.Builder(
aliasKeyStore,
KeyProperties.PURPOSE_DECRYPT
)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1)
.build()
)
keyPairGenerator.generateKeyPair()
}
private fun getPublicKey(): PublicKey { // Get the Public RSA key from the Android KeyStore
val keyStore: KeyStore = KeyStore.getInstance(provider)
keyStore.load(null)
return keyStore.getCertificate(aliasKeyStore).publicKey
}
private fun getPrivateKey(): PrivateKey { // Get the Private RSA key from the Android KeyStore
val keyStore: KeyStore = KeyStore.getInstance(provider)
keyStore.load(null)
return keyStore.getKey(aliasKeyStore, null) as PrivateKey
}
private fun encrypt(message: String): ByteArray { // Encrypt a string with the public RSA key
val cipher = Cipher.getInstance(transformation)
cipher.init(Cipher.ENCRYPT_MODE, getPublicKey())
return cipher.doFinal(message.toByteArray())
}
private fun decrypt(message: ByteArray): String { // Decrypt an encrypted string with the private RSA key
val cipher = Cipher.getInstance(transformation)
cipher.init(Cipher.DECRYPT_MODE, getPrivateKey())
val decryptedBytes = cipher.doFinal(message)
return decryptedBytes.decodeToString()
}
fun store(
user: String,
password: String
) { // Store combo encrypted user/pass in shared preferences
val userEncrypted = encrypt(user) // encrypt user
val passwordEncrypted = encrypt(password) // encrypt password
val context = MainActivity.applicationContext() // get app context
// show key : Base64.getEncoder().encodeToString(encryptedData)
// write encrypted data to the app preference
val sharedPref = context.getSharedPreferences(sharedPref, MODE_PRIVATE)
with(sharedPref?.edit()) {
this?.putString("username", userEncrypted.contentToString())
this?.putString("password", passwordEncrypted.contentToString())
this?.apply()
}
}
fun get(type: Int): String? { // type 0 -> username | type 1 -> password [ return null if there is nothing
val context = MainActivity.applicationContext() // get app context
// read encrypted data from the app preference
val sharedPref = context.getSharedPreferences(sharedPref, MODE_PRIVATE)
var data: String? = null
when (type) {
0 -> {
data = sharedPref.getString("username", null)
}
1 -> {
data = sharedPref.getString("password", null)
}
}
return if (data != null) {
val split: List<String> =
data.substring(1, data.length - 1).split(", ")
val array = ByteArray(split.size)
for (i in split.indices) {
array[i] = split[i].toByte()
}
decrypt(array)
} else null
}
fun storeSID(sid: String) {
val sidEncrypted = encrypt(sid) // encrypt sid
val context = MainActivity.applicationContext() // get app context
// write encrypted data to the app preference
val sharedPref = context.getSharedPreferences(sharedPref, MODE_PRIVATE)
with(sharedPref?.edit()) {
this?.putString("sid", sidEncrypted.contentToString())
this?.apply()
}
}
fun getSID(): String? {
val context = MainActivity.applicationContext() // get app context
// read encrypted data from the app preference
val sharedPref = context.getSharedPreferences(sharedPref, MODE_PRIVATE)
val data: String? = sharedPref.getString("sid", null)
return if (data != null) {
val split: List<String> =
data.substring(1, data.length - 1).split(", ")
val array = ByteArray(split.size)
for (i in split.indices) {
array[i] = split[i].toByte()
}
decrypt(array)
} else null
}
fun delete() {
val context = MainActivity.applicationContext() // get app context
// clear shared pref
val sharedPref = context.getSharedPreferences(sharedPref, MODE_PRIVATE)
with(sharedPref.edit()) {
this.remove("username")
this.remove("password")
this.remove("sid")
this.apply()
}
}
}

View file

@ -1,691 +0,0 @@
package com.mylloon.mobidl
import android.Manifest
import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.Editable
import android.text.InputType
import android.text.TextWatcher
import android.text.method.ScrollingMovementMethod
import android.util.DisplayMetrics
import android.view.*
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.work.*
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import kotlinx.coroutines.*
import java.util.*
import java.util.concurrent.ExecutionException
import java.util.concurrent.TimeUnit
private fun isWorkScheduled(context: Context): Boolean {
val instance = WorkManager.getInstance(context)
val statuses = instance.getWorkInfosByTag("com.mylloon.mobidl.BackgroundUpdateCheck")
return try {
var running = false
val workInfoList = statuses.get()
for (workInfo in workInfoList) {
val state = workInfo.state
running = (state == WorkInfo.State.RUNNING) or (state == WorkInfo.State.ENQUEUED)
}
running
} catch (e: ExecutionException) {
e.printStackTrace()
println("No job already running")
false
} catch (e: InterruptedException) {
e.printStackTrace()
println("No job already running")
false
}
}
fun newJob(context: Context) {
val myConstraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED) //checks whether device should have Network Connection
.build()
val job = PeriodicWorkRequestBuilder<BackgroundUpdateCheck>(1, TimeUnit.DAYS)
.setConstraints(myConstraints)
.build()
WorkManager.getInstance(context).enqueue(job)
}
class BootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (!isWorkScheduled(context)) {
println("Create a update check job in background...")
when (intent.action) {
Intent.ACTION_DATE_CHANGED -> {
newJob(context)
}
Intent.ACTION_BOOT_COMPLETED -> {
val sharedPref = context.getSharedPreferences("com.mylloon.MobiDL",
AppCompatActivity.MODE_PRIVATE)
sharedPref.edit().putInt("notifID", 0).apply()
newJob(context)
}
}
}
}
}
class MainActivity : AppCompatActivity() {
private var settingsButton: Menu? = null // before starting the app there is no settings button
private var settingsButtonVisible: Boolean = false
private var inSettings: Boolean = false // by default your not in settings page
private var inAppList: Boolean = false // by default your not in app list page
private var inAppInfo: Boolean = false // by default your not in app info page
private var sharedPref: SharedPreferences? = null // first run detection
private val sharedPrefName = "com.mylloon.MobiDL" // shared pref name
private var timeOfLastToast: Long = System.currentTimeMillis() - 2000
private var listInfos: MutableList<Map<String, String?>>? = null
private var appMobilismInfos: Map<String, String?>? = null
companion object {
private var instance: MainActivity? = null
fun applicationContext(): Context {
return instance!!.applicationContext
}
}
init {
instance = this
}
private fun toggleSettingsButtonVisibility() { // Change Settings button visibility
settingsButtonVisible = settingsButton?.findItem(R.id.settingsButton)?.isVisible == false
settingsButton?.findItem(R.id.settingsButton)?.isVisible = settingsButtonVisible
}
private fun getValuesRecyclerView(): MutableList<String> { // list of the apps (from the storage if exists)
val context = applicationContext() // get app context
// read apps from the app preference
val sharedPref = context.getSharedPreferences(sharedPrefName, MODE_PRIVATE)
val data: Set<String>? = sharedPref.getStringSet("apps", null)
return data?.toMutableList() ?: mutableListOf()
}
private fun getValuesAppNeedToBeUpdated(): MutableMap<String, Boolean> { // list of the apps (from the storage if exists)
val context = applicationContext() // get app context
// read apps from the app preference
val sharedPref = context.getSharedPreferences(sharedPrefName, MODE_PRIVATE)
val dataApp: Set<String>? = sharedPref.getStringSet("appsUpdate", null)
val dataBool: Set<String>? = sharedPref.getStringSet("boolUpdate", null)
val dataAppList = dataApp?.toList()
val dataBoolList = dataBool?.toList()
val finalMap = mutableMapOf<String, Boolean>()
if ((dataAppList != null) and (dataBoolList != null)) {
for (i in dataAppList!!.indices) {
if (i in dataBoolList!!.indices) {
finalMap[dataAppList[i]] =
dataBoolList[i].substring(i.toString().length).toBoolean()
}
}
}
return finalMap
}
private fun storeValuesAppNeedToBeUpdated(updateApps: MutableMap<String, Boolean>) {
val updateAppsName: Set<String> = updateApps.keys
val updateAppsBool: MutableCollection<Boolean> = updateApps.values
val updateAppsBoolList: List<Boolean> = updateAppsBool.toList()
val updateAppsBoolSet: MutableList<String> = mutableListOf()
for (i in updateAppsBoolList.indices) {
updateAppsBoolSet.add(i.toString() + updateAppsBoolList[i].toString())
}
with(applicationContext().getSharedPreferences(sharedPrefName, MODE_PRIVATE).edit()) {
this?.putStringSet("appsUpdate", updateAppsName)
this?.putStringSet("boolUpdate", updateAppsBoolSet.toSet())
this?.apply()
}
}
override fun onCreate(savedInstanceState: Bundle?) { // Main function
super.onCreate(savedInstanceState)
sharedPref = getSharedPreferences(sharedPrefName, MODE_PRIVATE)
try {
if (Credentials().get(0) == null) { // test if credentials have already been registered
loginPage() // if no ask for
} else {
mainPage() // if yes go to main page
}
} catch (_: Throwable) {
loginPage()
}
}
private fun loginPage() {
setContentView(R.layout.activity_login) // show login page
this.title = getString(R.string.app_name)
val userInput = findViewById<EditText>(R.id.usernameInput)
val passwordInput = findViewById<EditText>(R.id.passwordInput)
val buttonInput = findViewById<Button>(R.id.loginButton)
fun changeButtonStatus() { // function who enable/disable the login button
val text1: String = userInput.text.toString()
val text2: String = passwordInput.text.toString()
buttonInput.isEnabled = text1.isNotEmpty() && text2.isNotEmpty()
}
userInput.addTextChangedListener(object : TextWatcher { // looking user input changes
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
override fun afterTextChanged(editable: Editable) {
changeButtonStatus()
}
})
passwordInput.addTextChangedListener(object :
TextWatcher { // looking password input changes
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
override fun afterTextChanged(editable: Editable) {
changeButtonStatus()
}
})
buttonInput.setOnClickListener { // show main page when clicking the login button
val user = userInput.text.toString()
val password = passwordInput.text.toString()
Credentials().store(user, password)
mainPage()
}
}
private fun mainPage(toDelete: String? = null) {
if (toDelete == null) {
setContentView(R.layout.activity_main) // display main page
if (!isWorkScheduled(applicationContext)) newJob(applicationContext) // run background job if not already running
if (!settingsButtonVisible) { // check if the settings button isn't already showed
Handler(Looper.getMainLooper()).postDelayed({
toggleSettingsButtonVisibility()
}, 100) // delay to add button settings
}
}
val user = Credentials().get(0).toString()
this.title = "${getString(R.string.app_name)} (${getString(R.string.connected_as)} $user)"
val valuesRecyclerView = getValuesRecyclerView() // list of all the element in the main page
val checkedItemListOfApps = getValuesAppNeedToBeUpdated()
class Adapter(private val values: List<String>) :
RecyclerView.Adapter<Adapter.ViewHolder>() {
override fun getItemCount() = values.size
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int,
): ViewHolder { // add viewHolder to the main page
val itemView = LayoutInflater.from(parent.context)
.inflate(R.layout.list_item_view, parent, false)
return ViewHolder(itemView)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.button?.text = values[position]
}
inner class ViewHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {
var button: Button? = null
init {
button = itemView?.findViewById(R.id.text_list_item)
button?.setOnLongClickListener {
val builder: AlertDialog.Builder =
AlertDialog.Builder(instance)
builder.setTitle("${getString(R.string.config)} ${button?.text} ?")
builder.setPositiveButton(R.string.remove) { _, _ ->
instance?.mainPage(
button?.text.toString()
)
checkedItemListOfApps[button?.text.toString()] = false
storeValuesAppNeedToBeUpdated(checkedItemListOfApps)
}
val appInstalled = isItAnInstalledApp(button?.text.toString())
if (appInstalled != null) {
val checkedItems = booleanArrayOf(
checkedItemListOfApps[button?.text.toString()] == true
)
builder.setMultiChoiceItems(
arrayOf(getString(R.string.updateCheck)),
checkedItems
) { _, _, isChecked ->
checkedItemListOfApps[button?.text.toString()] = isChecked
storeValuesAppNeedToBeUpdated(checkedItemListOfApps)
}
builder.setNegativeButton(R.string.forceUpdate) { _, _ ->
Notif().work(applicationContext,
button?.text.toString())
}
}
builder.setNeutralButton(R.string.cancel) { dialog, _ -> dialog.cancel() }
builder.show()
true
}
button?.setOnClickListener {
val password = Credentials().get(1)
if (password != null) { // call script
callScrapper(user, password.toString(), button?.text.toString())
} else {
Toast.makeText(
applicationContext,
R.string.notConnected,
Toast.LENGTH_LONG
)
.show()
loginPage()
}
}
}
}
}
val recyclerView: RecyclerView = findViewById(R.id.recyclerView)
if (toDelete != null) {
valuesRecyclerView.remove(toDelete)
// read apps from the app preference
sharedPref!!.edit().putStringSet("apps", valuesRecyclerView.toSet()).apply()
recyclerView.adapter = Adapter(valuesRecyclerView)
}
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.adapter = Adapter(valuesRecyclerView)
fun addApp(app: String) {
valuesRecyclerView.add(app)
// read apps from the app preference
sharedPref!!.edit().putStringSet("apps", valuesRecyclerView.toSet()).apply()
recyclerView.adapter = Adapter(valuesRecyclerView)
}
val addButton = findViewById<FloatingActionButton>(R.id.addButton)
addButton.setOnClickListener {
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle(R.string.newAppDialogTitle)
val input = EditText(this)
input.inputType = InputType.TYPE_CLASS_TEXT
builder.setView(input)
builder.setPositiveButton(R.string.validate) { _, _ -> addApp(input.text.toString()) }
builder.setNeutralButton(R.string.cancel) { dialog, _ -> dialog.cancel() }
builder.show()
}
// easter egg
addButton.setOnLongClickListener {
Toast.makeText(this@MainActivity, R.string.dropBro, Toast.LENGTH_SHORT)
.show()
true
}
}
fun isItAnInstalledApp(app: String): String? {
var appName = app
val registeredAnswered: Map<String, String> = Gson().fromJson(
assets.open("appNames.json").bufferedReader()
.use { it.readText() },
object : TypeToken<Map<String, String>>() {}.type
)
for ((key, value) in registeredAnswered) appName =
if (Regex(appName.lowercase()).containsMatchIn(key)) value else appName.lowercase()
for (packageInfo in packageManager.getInstalledPackages(PackageManager.GET_META_DATA)) {
if (Regex(appName).containsMatchIn(packageInfo.packageName)) return packageInfo.versionName
}
return null
}
private fun callScrapper(
user: String,
password: String,
app: String,
captchaID: String? = null,
captchaResponse: String? = null,
) {
if (ContextCompat.checkSelfPermission(this@MainActivity, Manifest.permission.INTERNET)
!= PackageManager.PERMISSION_GRANTED
) {
Toast.makeText(this@MainActivity, R.string.internetPermission, Toast.LENGTH_SHORT)
.show()
this.finishAffinity()
} else {
runBlocking { // GlobalScope.launch {
val returns: MutableList<Map<String, String?>>? = Scraper(
user,
password,
app,
captchaID = captchaID,
captchaResponse = captchaResponse
).search()
if (returns != null) { // if job is needed
if (returns[0].containsKey("errorNotConnected")) {
Toast.makeText(
instance,
"${getString(R.string.connectionFailed)}\n${getString(R.string.credentialsDeleted)}.",
Toast.LENGTH_LONG
).show()
loginPage()
}
if (returns[0].containsKey("loginAttemptsExceeded")) {
val returnsCaptchaQuestion = returns[0]["question"]
val returnsCaptchaID = returns[0]["qaConfirmID"]
if (returnsCaptchaQuestion == null) callScrapper(user, password, app)
val registeredAnswered: Map<String, String> = Gson().fromJson(
assets.open("captcha.json").bufferedReader()
.use { it.readText() },
object : TypeToken<Map<String, String>>() {}.type
)
for ((key, value) in registeredAnswered) {
if (returnsCaptchaQuestion == key) {
println("${applicationContext().getString(R.string.knownCaptcha)}...")
val now = System.currentTimeMillis()
if ((now - timeOfLastToast) >= 2000) {
Toast.makeText(
applicationContext(),
"${applicationContext().getString(R.string.knownCaptcha)}...",
Toast.LENGTH_SHORT
)
.show()
timeOfLastToast = now
}
return@runBlocking callScrapper(
user,
password,
app,
returnsCaptchaID,
value
)
}
}
val builder: AlertDialog.Builder = AlertDialog.Builder(
instance
)
builder.setTitle("Captcha")
builder.setMessage(returnsCaptchaQuestion)
val input = EditText(instance)
input.inputType = InputType.TYPE_CLASS_TEXT
builder.setView(input)
builder.setPositiveButton(R.string.validate) { _, _ ->
callScrapper(
user,
password,
app,
returnsCaptchaID,
input.text.toString()
)
}
builder.setNeutralButton(R.string.cancel) { dialog, _ -> dialog.cancel() }
builder.show()
}
if (returns[0].containsKey("noSID"))
Toast.makeText(instance, R.string.noSID, Toast.LENGTH_SHORT).show()
if (returns[0].containsKey("badSID"))
Toast.makeText(
instance,
"${getString(R.string.badSID)}...",
Toast.LENGTH_SHORT
).show()
if (returns[0].containsKey("noResults"))
Toast.makeText(
instance,
"${getString(R.string.noResults)}...",
Toast.LENGTH_SHORT
).show()
if (returns[0].containsKey("gotResults")) {
returns.removeFirst()
Toast.makeText(
instance,
"${returns.size} ${getString(R.string.gotResults)} !",
Toast.LENGTH_SHORT
).show()
listInfos = returns
showAppListPage()
}
}
}
}
}
private fun showAppListPage() {
setContentView(R.layout.activity_app_list) // display list of app version page
if (!settingsButtonVisible) toggleSettingsButtonVisibility() // check if the settings button isn't already showed and show it if necessary
inAppList = true
class Adapter(private val values: List<String>) :
RecyclerView.Adapter<Adapter.ViewHolder>() {
override fun getItemCount() = values.size
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int,
): ViewHolder { // add viewHolder to the parent page
val itemView = LayoutInflater.from(parent.context)
.inflate(R.layout.list_item_view_app_list, parent, false)
return ViewHolder(itemView)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.button?.text = values[position]
}
inner class ViewHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {
var button: Button? = null
init {
button = itemView?.findViewById(R.id.text_list_item_app_list)
button?.setOnClickListener {
inAppList = false
appMobilismInfos =
listInfos!![Regex("""\d+""").findAll(button?.text.toString())
.map { it.groupValues[0] }.toList()[0].toInt() - 1]
showAppInfoPage()
}
}
}
}
val recyclerViewAppList: RecyclerView =
findViewById(R.id.recyclerViewAppList) // get recyclerview
recyclerViewAppList.layoutManager = LinearLayoutManager(this)
val listInfosNames = mutableListOf<String>()
for (i in listInfos!!.indices) { // get all apps name
val tmp =
"${i + 1} - ${listInfos!![i]["title"]} (${listInfos!![i]["author"]})\n${listInfos!![i]["date"]}"
listInfosNames += tmp
}
recyclerViewAppList.adapter = Adapter(listInfosNames)
}
@SuppressLint("SetTextI18n")
private fun showAppInfoPage() {
val link = appMobilismInfos!!["link"]
if (link != null) {
val infoApp: MutableMap<String, String?>
var links: MutableMap<String, List<String>> = mutableMapOf()
var errorHappen = false
runBlocking {
infoApp = Scraper().parseInfos(link)
try {
links = Scraper().parseDownloadLinks(infoApp["downloadLinks"]!!)
} catch (e: Exception) {
Toast.makeText(
instance,
"${getString(R.string.noLinkFound)}...",
Toast.LENGTH_SHORT
).show()
errorHappen = true
}
}
if (errorHappen) return else {
setContentView(R.layout.activity_app_infos) // display app info detailed page
if (!settingsButtonVisible) toggleSettingsButtonVisibility() // check if the settings button isn't already showed and show it if necessary
inAppInfo = true
}
class Adapter(private val values: List<String>) :
RecyclerView.Adapter<Adapter.ViewHolder>() {
override fun getItemCount() = values.size
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int,
): ViewHolder { // add viewHolder to the parent page
val itemView = LayoutInflater.from(parent.context)
.inflate(R.layout.list_item_view_app_download, parent, false)
return ViewHolder(itemView)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.button?.text = values[position]
}
inner class ViewHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) {
var button: Button? = null
init {
button = itemView?.findViewById(R.id.download_button)
button?.setOnClickListener {
val splitText = button?.text.toString().split(Regex(" - "))
startActivity(
Intent(
Intent.ACTION_VIEW, Uri.parse(
links[splitText[0]]!![splitText[1].replace("\\s".toRegex(),
"").toInt() - 1]
)
)
)
}
}
}
}
val title = findViewById<TextView>(R.id.textViewAppName)
title.text = appMobilismInfos!!["title"]
title.setOnClickListener {
startActivity(Intent(Intent.ACTION_VIEW,
Uri.parse("https://forum.mobilism.org$link")))
}
findViewById<TextView>(R.id.textViewAppAuthor).text = appMobilismInfos!!["author"]
findViewById<TextView>(R.id.textViewAppDate).text = appMobilismInfos!!["date"]
val changelogs = findViewById<TextView>(R.id.textViewAppChangelogs)
changelogs.text = infoApp["changelogs"]
changelogs.movementMethod = ScrollingMovementMethod()
val listDownloads = mutableListOf<String>()
val recyclerViewAppDownloads: RecyclerView =
findViewById(R.id.recyclerViewAppDownloads) // get recyclerview
recyclerViewAppDownloads.layoutManager = LinearLayoutManager(this)
val displayMetrics = DisplayMetrics()
recyclerViewAppDownloads.layoutParams.height = displayMetrics.heightPixels / 3
for (arch in links.keys) {
for ((count, _) in links[arch]!!.withIndex()) {
listDownloads += "$arch - ${count + 1}"
}
recyclerViewAppDownloads.adapter = Adapter(listDownloads)
}
} else Toast.makeText(instance, "${getString(R.string.noURL)}...", Toast.LENGTH_SHORT)
.show()
}
@SuppressLint("SetTextI18n")
private fun settingsPage() {
setContentView(R.layout.activity_settings)
toggleSettingsButtonVisibility()
inSettings = true
val pInfo: PackageInfo =
applicationContext().packageManager.getPackageInfo(applicationContext().packageName, 0)
val stringVersion = findViewById<TextView>(R.id.version)
stringVersion.text = "v${pInfo.versionName}"
val credentialsButton = findViewById<Button>(R.id.changeCredentialsButton)
credentialsButton.setOnClickListener { // show main page when clicking the login button
Credentials().delete()
Toast.makeText(this@MainActivity, R.string.deletedCredentials, Toast.LENGTH_LONG)
.show()
loginPage()
}
val sourceCodeButton = findViewById<Button>(R.id.sourcecodeButton)
sourceCodeButton.setOnClickListener {
startActivity(
Intent(
Intent.ACTION_VIEW, Uri.parse(
"https://gitlab.com/Mylloon/mobilismScrap/-/tree/android"
)
)
)
}
}
override fun onResume() {
super.onResume()
if (sharedPref!!.getBoolean("firstrun", true)) {
Credentials().generateKey() // Generate RSA keys
sharedPref!!.edit().putBoolean("firstrun", false)
.apply() // first run done, now the next ones won't be "first".
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean { // add settings button
menuInflater.inflate(R.menu.menu_main, menu)
settingsButton = menu
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean { // go to settings page when clicking on settings button
when (item.itemId) {
R.id.settingsButton -> {
settingsPage()
}
}
return super.onOptionsItemSelected(item)
}
override fun onBackPressed() { // allow user to use back button to go back to main page
when {
inSettings -> {
inSettings = false
return when {
inAppList -> showAppListPage()
inAppInfo -> showAppInfoPage()
else -> mainPage()
}
}
inAppList -> {
inAppList = false
return mainPage()
}
inAppInfo -> {
inAppInfo = false
return showAppListPage()
}
else -> super.onBackPressed()
}
}
}

View file

@ -1,169 +0,0 @@
package com.mylloon.mobidl
import android.annotation.SuppressLint
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.BitmapFactory
import android.graphics.Color
import android.net.Uri
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import androidx.work.Worker
import androidx.work.WorkerParameters
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
var sharedPrefName = "com.mylloon.MobiDL" // shared pref name
class BackgroundUpdateCheck(appContext: Context, workerParams: WorkerParameters) :
Worker(appContext, workerParams) {
private val ctx = appContext
override fun doWork(): Result {
fun getValuesAppNeedToBeUpdated(): MutableMap<String, Boolean> { // list of the apps (from the storage if exists)
val context = MainActivity.applicationContext() // get app context
// read apps from the app preference
val sharedPref = context.getSharedPreferences(sharedPrefName,
AppCompatActivity.MODE_PRIVATE)
val dataApp: Set<String>? = sharedPref.getStringSet("appsUpdate", null)
val dataBool: Set<String>? = sharedPref.getStringSet("boolUpdate", null)
val dataAppList = dataApp?.toList()
val dataBoolList = dataBool?.toList()
val finalMap = mutableMapOf<String, Boolean>()
if ((dataAppList != null) and (dataBoolList != null)) {
for (i in dataAppList!!.indices) {
if (i in dataBoolList!!.indices) {
finalMap[dataAppList[i]] =
dataBoolList[i].substring(i.toString().length).toBoolean()
}
}
}
return finalMap
}
val apps = getValuesAppNeedToBeUpdated()
for (app in apps.keys) {
if (apps[app] == true) {
println("Checking update for $app...")
Notif().work(ctx, app)
}
}
println("Update check: Done.")
return Result.success()
}
}
class Notif {
private lateinit var notificationManager: NotificationManager
private lateinit var notificationChannel: NotificationChannel
private lateinit var builder: Notification.Builder
private val channelId = "i.apps.notifications"
private val description = R.string.descriptionNotification
@SuppressLint("UnspecifiedImmutableFlag")
fun newNotification(
context: Context,
notificationID: Int,
appName: String,
version: String,
url: String,
) {
notificationManager = context.getSystemService(NotificationManager::class.java)
val pendingIntent = PendingIntent.getActivity(context,
notificationID,
Intent(Intent.ACTION_VIEW, Uri.parse(url)),
(PendingIntent.FLAG_UPDATE_CURRENT))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // checking if android version is greater than oreo(API 26) or not
notificationChannel = NotificationChannel(channelId,
context.getString(description),
NotificationManager.IMPORTANCE_LOW)
notificationChannel.enableLights(true)
notificationChannel.lightColor = Color.GREEN
notificationChannel.enableVibration(false)
notificationManager.createNotificationChannel(notificationChannel)
builder = Notification.Builder(context, channelId)
.setContentTitle("${context.getString(R.string.newUpdateTitleNotification)} $appName")
.setContentText("${context.getString(R.string.newUpdateVersionNotification)} $version ${
context.getString(R.string.newUpdateAvailableNotification)
}")
.setSmallIcon(R.drawable.download)
.setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher))
.setContentIntent(pendingIntent)
.setAutoCancel(true)
} else {
builder = Notification.Builder(context)
.setContentTitle("${context.getString(R.string.newUpdateTitleNotification)} $appName")
.setContentText("${context.getString(R.string.newUpdateVersionNotification)} $version ${
context.getString(R.string.newUpdateAvailableNotification)
}")
.setSmallIcon(R.drawable.download)
.setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher))
.setContentIntent(pendingIntent)
.setAutoCancel(true)
}
notificationManager.notify(notificationID, builder.build())
val sharedPref =
context.getSharedPreferences(sharedPrefName, AppCompatActivity.MODE_PRIVATE)
sharedPref.edit().putInt("notifID", notificationID + 1).apply()
}
fun work(context: Context, app: String) {
var appName = app
val registeredAnswered: Map<String, String> = Gson().fromJson(
context.assets.open("appNames.json").bufferedReader()
.use { it.readText() },
object : TypeToken<Map<String, String>>() {}.type
)
for ((key, value) in registeredAnswered) appName =
if (Regex(appName.lowercase()).containsMatchIn(key)) value else appName.lowercase()
var installedAppVersion: String? = null
for (packageInfo in context.packageManager.getInstalledPackages(PackageManager.GET_META_DATA)) {
if (Regex(appName).containsMatchIn(packageInfo.packageName)) installedAppVersion =
packageInfo.versionName
}
if (installedAppVersion == null) return
else {
try {
val res =
Scraper(Credentials().get(0), Credentials().get(1), app).search() ?: return
if (res[0].containsKey("gotResults")) {
var latestVersion = res[1]["title"]!!
latestVersion = Regex("""(?<=v?)\d+\.\d+(\.\d+)?""").findAll(latestVersion)
.map { it.groupValues[0] }.toList()[0]
val arrayInstalledVersion: MutableList<String> =
installedAppVersion.split(".") as MutableList<String>
val arrayLatestVersion: MutableList<String> =
latestVersion.split(".") as MutableList<String>
while (arrayInstalledVersion.size > arrayLatestVersion.size) arrayLatestVersion.add(
"0")
while (arrayInstalledVersion.size < arrayLatestVersion.size) arrayInstalledVersion.add(
"0")
var needUpdate = false
for (i in arrayInstalledVersion.indices) {
if (arrayLatestVersion[i].toInt() > arrayInstalledVersion[i].toInt()) needUpdate =
true
}
if (needUpdate) {
val sharedPref = context.getSharedPreferences(sharedPrefName,
AppCompatActivity.MODE_PRIVATE)
return newNotification(context,
sharedPref.getInt("notifID", 0),
app,
latestVersion,
"https://forum.mobilism.org${res[1]["link"]}")
}
}
} catch (e: Exception) {
return
}
}
}
}

View file

@ -1,255 +0,0 @@
package com.mylloon.mobidl
import com.github.kittinunf.fuel.core.FuelManager
import com.github.kittinunf.fuel.httpGet
import com.github.kittinunf.fuel.httpPost
import com.github.kittinunf.result.Result.Failure as FuelFailure
import com.github.kittinunf.result.Result.Success as FuelSuccess
class Scraper(
private var pseudo: String? = null, // can be null if parsing a post
private var password: String? = null, // can be null if parsing a post
private var app: String? = null, // can be null if parsing a post
private var captchaID: String? = null, // can be null if no captcha
private var captchaResponse: String? = null, // can be null if no captcha
) {
private var url: String = "https://forum.mobilism.org"
private var sid: String? = Credentials().getSID()
private var retry: Int = 0
private var errorNotConnected = "Log me on automatically each visit"
private var loginAttemptsExceeded = "You exceeded the maximum allowed number of login attempts."
private var searchNotLogged =
"Sorry but you are not permitted to use the search system. If you're not logged in please"
private fun connect(): MutableList<Map<String, String?>>? { // Login to the forum using credentials.
println("Connection attempt...")
retry++
FuelManager.instance.basePath = url
FuelManager.instance.baseParams = listOf("mode" to "login")
val params = mutableListOf("username" to pseudo, "password" to password, "login" to "Login")
if (captchaID != null) {
params.add("qa_answer" to captchaResponse.toString())
params.add("qa_confirm_id" to captchaID.toString())
}
val session = "/ucp.php"
.httpPost(params)
.responseString { _, response, result ->
when (result) {
is FuelFailure -> {
val ex = result.getException()
println("[${response.statusCode}] Exception: $ex")
}
is FuelSuccess -> {
println("") // does nothing but is required otherwise everything bugs :(
}
}
}
val data = session.join().data.decodeToString()
sid = "(?<=sid=)(.{32})".toRegex().find(data)?.value
if (errorNotConnected in data) return error(data)
Credentials().storeSID(sid.toString())
return search()
}
private fun error(htmlPage: String): MutableList<Map<String, String?>>? { // Handle connection errors
var array: MutableList<Map<String, String?>>? = null
if (errorNotConnected in htmlPage) {
if (loginAttemptsExceeded in htmlPage) {
val qaConfirmID =
"(?<=qa_confirm_id\" value=\")(.{32})".toRegex().find(htmlPage)?.value
var question = "(?<=answer\">)(.*)</l".toRegex().find(htmlPage)?.value
if (question != null) {
question = question.dropLast(3)
}
array = mutableListOf(
mutableMapOf(
"loginAttemptsExceeded" to null,
"question" to question,
"qaConfirmID" to qaConfirmID
)
)
} else {
Credentials().delete()
array = mutableListOf(mutableMapOf("errorNotConnected" to null))
}
}
return array
}
fun search(): MutableList<Map<String, String?>>? { // Do the research.
if (sid == null) {
println("SID not found")
return if (retry < 3) connect() else mutableListOf(mutableMapOf("noSID" to null))
} else {
println("SID recovered")
retry = 0
}
println("Going to search page...")
FuelManager.instance.basePath = url
FuelManager.instance.baseParams =
listOf("sid" to sid, "sr" to "topics", "sf" to "titleonly")
val session = "/search.php"
.httpGet(listOf("keywords" to app))
.responseString { _, response, result ->
when (result) {
is FuelFailure -> {
val ex = result.getException()
println("[${response.statusCode}] Exception: $ex")
}
is FuelSuccess -> {
println("") // does nothing but is required otherwise everything bugs :(
}
}
}
val data = session.join().data.decodeToString()
return if (searchNotLogged in data) {
println("The SID doesn't work, new attempt...")
if (retry < 3) connect() else mutableListOf(mutableMapOf("badSID" to null))
} else parse(data)
}
private fun parse(htmlPage: String): MutableList<Map<String, String?>> { // Parse HTML response to a clean list.
println("Fetching results for $app...")
// println(htmlPage)
if ("No suitable matches were found." in htmlPage) return mutableListOf(mutableMapOf("noResults" to null))
val elements: MutableList<String> = htmlPage.split("<tr>\n<td>").toMutableList()
val finalElements = mutableListOf<Map<String, String?>>()
elements.removeFirst()
val lastIndex = elements.toList().lastIndex
elements[lastIndex] = elements[lastIndex].split("</td>\n</tr>")[0]
finalElements.add(0, mapOf("gotResults" to null))
for (i in elements.indices) {
val title: String? = try {
Regex("""class="topictitle">(.*)</a>""").findAll(elements[i])
.map { it.groupValues[1] }.toList()[0].replace(Regex("( ?&amp; ?)"), " & ")
} catch (e: Exception) {
null
}
val author: String? = try {
val regex =
"""(<br />|</strong>)\n\n?<i class="icon-user"></i> by <a href="\./memberlist\.php\?mode=viewprofile&amp;u=\d+&amp;sid=.+"( style="color: #.*;" class="username-coloured")?>(.*)</a>"""
Regex(regex).findAll(elements[i]).map { it.groupValues.last() }.toList()[0]
} catch (e: Exception) {
null
}
val link: String? = try {
val temp =
Regex("""\./viewtopic\.php\?f=(\d*)&amp;t=(\d*)&amp""").findAll(elements[i])
"/viewtopic.php?f=${
temp.map { it.groupValues[1] }.toList()[0]
}&t=${temp.map { it.groupValues[2] }.toList()[0]}"
} catch (e: Exception) {
null
}
val date: String? = try {
Regex("""</a> <i class="icon-time"></i> <small>(.*)</small>""").findAll(elements[i])
.map { it.groupValues[1] }.toList()[0]
} catch (e: Exception) {
null
}
finalElements.add(
i + 1,
mapOf("title" to title, "author" to author, "link" to link, "date" to date)
)
}
println("Search parsed!")
return finalElements
}
fun parseInfos(urlPost: String): MutableMap<String, String?> {
println("Going to post page...")
FuelManager.instance.basePath = url
val session = urlPost
.httpGet()
.responseString { _, response, result ->
when (result) {
is FuelFailure -> {
val ex = result.getException()
println("[${response.statusCode}] Exception: $ex")
}
is FuelSuccess -> {
println("Post page retrieved") // does nothing but is required otherwise everything bugs :(
}
}
}
var htmlPage = session.join().data.decodeToString()
val elements = mutableMapOf<String, String?>()
// if ("Download Instructions" !in htmlPage) {
// elements["changelogs"] = null
// elements["downloadLinks"] = null
// }
elements["changelogs"] = try {
var tmp =
Regex("""What's New:</span> ?<br />(.*)<br /><br /><span style="c|font-weight: bold">T""").findAll(
htmlPage)
.map { it.groupValues[1] }.toList()[0]
if (tmp.length < 2) { // if result none, trying other method
tmp =
Regex("""What's New:</span> ?<br />(.*)<br /><br /><span style="font-weight: bold">T""").findAll(
htmlPage)
.map { it.groupValues[1] }.toList()[0]
}
tmp.replace(Regex("""<br />\n?"""), "\n") // convert newline html to \n
} catch (e: Exception) {
"No changelog found."
}
elements["downloadLinks"] = try {
htmlPage = htmlPage.replace(Regex("Download Instructions:</span>(.*?)?<br />"),
"Download Instructions:</span><br />")
var tmp =
Regex("""Download Instructions:</span> ?<br />(.*|[\s\S]*)<br /><br />Trouble downloading|</a></div>""").findAll(
htmlPage)
.map { it.groupValues[1] }.toList()[0]
if (tmp.length < 2) { // if result none, trying other method
tmp =
Regex("""Download Instructions:</span> ?<br />(.*|[\s\S]*)</a></div>""").findAll(
htmlPage)
.map { it.groupValues[1] }.toList()[0]
}
tmp =
tmp.replace(Regex("""\n|<a class="postlink" href="|\(Closed Filehost\) ?|<span style="font-weight: bold">|</span>|">(\S*)</a>"""),
"") // remove html garbage
tmp = tmp.replace(Regex("""<br />\n?"""), "\n") // convert newline html to \n
tmp = tmp.replace(Regex("""Mirrors(?!:)|Mirror(?!s)(?!:)"""), "Mirror:") // add ":"
var finalTmp = ""
for (i in tmp.split("\n")) finalTmp += i.split(">")[0] + "\n"
finalTmp.replace("\"", "")
} catch (e: Exception) {
null
}
return elements
}
fun parseDownloadLinks(links: String): MutableMap<String, List<String>> {
val downloadLinks = links.split("\n").filter { it != "" }
val categoryDL = mutableMapOf<String, List<String>>()
var inCategory: String? = null
val noCategoryString = "No Category"
val tempNoCategoryDL = mutableListOf<String>()
val tempCategoryDL = mutableListOf<String>()
categoryDL[noCategoryString] = listOf("") // init the no category at index 0 of the map
for (downloadLink in downloadLinks) {
if (("http" in downloadLink) or ("www." in downloadLink)) { // lien
if (inCategory != null) tempCategoryDL.add(downloadLink) // if the link is inside a category
else tempNoCategoryDL.add(downloadLink) // else he don't have category
} else { // else it's a category
if ((inCategory != null) && (tempCategoryDL.size > 0)) { // already in category?
categoryDL[inCategory] = tempCategoryDL.toMutableList()
tempCategoryDL.clear()
}
var previous = ""
if (("Mirror" in downloadLink) and (inCategory != null)) previous =
" of $inCategory"
inCategory = "${downloadLink.replace(":", "")}$previous" // first category
}
}
if (tempCategoryDL.isNotEmpty()) categoryDL[inCategory!!] = tempCategoryDL
if (tempNoCategoryDL.isNotEmpty()) categoryDL[noCategoryString] =
tempNoCategoryDL else categoryDL.remove(noCategoryString)
return categoryDL
}
}

View file

@ -1,30 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View file

@ -1,5 +0,0 @@
<vector android:height="24dp" android:tint="#8E44AD"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M5,20h14v-2H5V20zM19,9h-4V3H9v6H5l7,7L19,9z"/>
</vector>

View file

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View file

@ -1,11 +0,0 @@
<vector
android:height="48dp"
android:tint="@color/wisteria"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="48dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@color/wisteria"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z" />
</vector>

View file

@ -1,11 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>

View file

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
</vector>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Exo 2&amp;weight=300"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Exo 2&amp;weight=500"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>

View file

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textViewAppName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/exo_2_light"
android:layout_marginTop="36dp"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textViewAppAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.898"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAppName" />
<TextView
android:id="@+id/textViewAppDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.052"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAppName" />
<TextView
android:id="@+id/textViewAppChangelogsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/exo_2_medium"
android:layout_marginTop="36dp"
android:text="@string/changelogs"
android:textAlignment="center"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAppName" />
<TextView
android:id="@+id/textViewAppChangelogs"
android:layout_width="337dp"
android:layout_height="183dp"
android:layout_marginTop="12dp"
android:fontFamily="monospace"
android:scrollbars="vertical"
android:textAlignment="viewStart"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAppChangelogsTitle" />
<TextView
android:id="@+id/textViewAppDownloadsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/exo_2_medium"
android:layout_marginTop="20dp"
android:text="@string/downloads"
android:textAlignment="center"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAppChangelogs" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewAppDownloads"
android:layout_width="350dp"
android:layout_height="262dp"
android:layout_marginTop="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAppDownloadsTitle"
app:layout_constraintVertical_bias="0.036" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewAppList"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View file

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/exo_2_light"
android:text="@string/titleLogin"
android:textAlignment="center"
android:textSize="34sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.111" />
<EditText
android:id="@+id/usernameInput"
android:layout_width="331dp"
android:layout_height="48dp"
android:layout_marginTop="60dp"
android:autofillHints="username"
android:ems="10"
android:fontFamily="@font/exo_2_light"
android:hint="@string/userLogin"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintVertical_bias="0.0"
tools:ignore="TextContrastCheck" />
<EditText
android:id="@+id/passwordInput"
android:layout_width="331dp"
android:layout_height="48dp"
android:layout_marginTop="23dp"
android:autofillHints="password"
android:ems="10"
android:fontFamily="@font/exo_2_light"
android:hint="@string/passwordLogin"
android:inputType="textPassword"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/usernameInput"
app:layout_constraintVertical_bias="0.007"
tools:ignore="TextContrastCheck" />
<Button
android:id="@+id/loginButton"
android:layout_width="345dp"
android:layout_height="102dp"
android:layout_marginTop="65dp"
android:enabled="false"
android:fontFamily="@font/exo_2_medium"
android:text="@string/buttonLogin"
android:textSize="34sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passwordInput"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/mainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
android:clickable="true"
android:src="@drawable/ic_plus"
app:maxImageSize="67dp"
tools:ignore="ContentDescription"
android:focusable="true" />
</FrameLayout>

View file

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="232dp"
android:layout_height="47dp"
android:fontFamily="@font/exo_2_medium"
android:text="@string/titleSettings"
android:textAlignment="center"
android:textSize="34sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.131" />
<Button
android:id="@+id/changeCredentialsButton"
android:layout_width="198dp"
android:layout_height="85dp"
android:layout_marginTop="99dp"
android:text="@string/changeCredentials"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
app:layout_constraintVertical_bias="0.099" />
<Button
android:id="@+id/sourcecodeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="43dp"
android:text="@string/sourceCode"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/changeCredentialsButton"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sourcecodeButton"
app:layout_constraintVertical_bias="0.08" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="100dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<Button
android:id="@+id/text_list_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp" />
</LinearLayout>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
android:id="@+id/linear_layout_app_list"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="70dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<Button
android:id="@+id/download_button"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
android:id="@+id/linear_layout_app_list"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="180dp"
android:paddingTop="8dp"
android:paddingBottom="15dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<Button
android:id="@+id/text_list_item_app_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp" />
</LinearLayout>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/settingsButton"
android:icon="@drawable/ic_settings"
android:title="@string/titleSettings"
android:visible="false"
app:showAsAction="always" />
</menu>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/amethyst"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/amethyst"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="titleLogin" translatable="true">Connectez-vous à votre compte Mobilism</string>
<string name="userLogin" translatable="true">Identifiant</string>
<string name="passwordLogin" translatable="true">Mot de passe</string>
<string name="buttonLogin" translatable="true">Connexion</string>
<string name="titleSettings" translatable="true">Paramètres</string>
<string name="changeCredentials">Change les identifiants</string>
<string name="sourceCode">Code source</string>
<string name="credits">Crédits</string>
<string name="remove">Retirer</string>
<string name="cancel">Annuler</string>
<string name="newAppDialogTitle">Nom de la nouvelle app</string>
<string name="validate">Valider</string>
<string name="deletedCredentials">Identifiants supprimés</string>
<string name="dropBro">lâche frère</string>
<string name="internetPermission">Pas la permission d\'utiliser internet</string>
<string name="connected_as">en tant que</string>
<string name="connectionFailed">Connexion échoué, changez vos identifiants</string>
<string name="error">Erreur</string>
<string name="credentialsDeleted">Vos identifiants ont été supprimées</string>
<string name="loginAttemptsExceeded">Vous avez dépassé le nombre maximum de tentatives de connexion, veuillez compléter les captchas</string>
<string name="notConnected">Vous n\'êtes pas connecté, redirection vers la page de connexion</string>
<string name="knownCaptcha">Résolution des captchas</string>
<string name="noSID">Aucun SID n\'a été trouvé</string>
<string name="badSID">Le SID ne fonctionne pas, nouvel essaie</string>
<string name="updateCheck">Vérification des mises à jour</string>
<string name="noResults">Aucun résultat n\'a été trouvé</string>
<string name="gotResults">résultats ont été trouvés</string>
<string name="noURL">Aucune URL n\'a été trouvé pour ce post</string>
<string name="changelogs">Changements</string>
<string name="downloads">Téléchargements</string>
<string name="noLinkFound">Aucun lien trouvé</string>
<string name="descriptionNotification">Mise à jour des applications</string>
<string name="newUpdateTitleNotification">Nouvelle version pour</string>
<string name="newUpdateVersionNotification">Version</string>
<string name="newUpdateAvailableNotification">disponible</string>
<string name="forceUpdate">Force recherche de MàJ</string>
<string name="rename">Renommer</string>
<string name="config">Configurer</string>
</resources>

View file

@ -1,16 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.MobiDL" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/wetasphalt</item>
<item name="colorPrimaryVariant">@color/midnightblue</item>
<item name="colorOnPrimary">@color/niceWhite</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/amethyst</item>
<item name="colorSecondaryVariant">@color/wisteria</item>
<item name="colorOnSecondary">@color/dark</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">@color/dark</item>
<!-- Customize your theme here. -->
</style>
</resources>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="amethyst">#9B59B6</color>
<color name="wisteria">#8E44AD</color>
<color name="wetasphalt">#34495E</color>
<color name="midnightblue">#2C3E50</color>
<color name="black">#000000</color>
<color name="dark">#141414</color>
<color name="white">#FFFFFF</color>
<color name="niceWhite">#ECF0F1</color>
</resources>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>@array/com_google_android_gms_fonts_certs_dev</item>
<item>@array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
</item>
</string-array>
<string-array name="com_google_android_gms_fonts_certs_prod">
<item>
MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
</item>
</string-array>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts" translatable="false">
<item>@font/exo_2_light</item>
<item>@font/exo_2_medium</item>
</array>
</resources>

View file

@ -1,53 +0,0 @@
<resources>
<string name="app_name" translatable="false">MobiDL</string>
<string name="error">Error</string>
<!-- Login page -->
<string name="titleLogin">Login to your Mobilism account</string>
<string name="userLogin">Username</string>
<string name="passwordLogin">Password</string>
<string name="buttonLogin">Login</string>
<!-- Main page -->
<string name="connected_as">as</string>
<string name="newAppDialogTitle">New app name</string>
<string name="validate">Validate</string>
<string name="remove">Remove</string>
<string name="config">Config</string>
<string name="cancel">Cancel</string>
<string name="forceUpdate">Force update search</string>
<string name="rename">Rename</string>
<string name="updateCheck">Update check</string>
<string name="notConnected">You are not logged in, redirection to the login page</string>
<string name="dropBro">drop bro</string>
<!-- Notifications -->
<string name="descriptionNotification">Application Update</string>
<string name="newUpdateTitleNotification">New version for</string>
<string name="newUpdateVersionNotification">Version</string>
<string name="newUpdateAvailableNotification">available</string>
<!-- Settings page -->
<string name="titleSettings">Settings</string>
<string name="changeCredentials">Change credentials</string>
<string name="deletedCredentials">Deleted credentials</string>
<string name="sourceCode">Source code</string>
<string name="credits">Credits</string>
<!-- Scraper -->
<string name="internetPermission">No permission to use internet</string>
<string name="connectionFailed">Login failed, change your credentials</string>
<string name="credentialsDeleted">Your credentials have been deleted</string>
<string name="loginAttemptsExceeded">You have exceeded the maximum number of connection attempts, please complete captchas</string>
<string name="knownCaptcha">Resolving captchas</string>
<string name="noSID">No SID was found</string>
<string name="badSID">The SID does not work, new attempt</string>
<string name="noResults">No results were found</string>
<string name="gotResults">results were found</string>
<string name="noURL">No URL were found for this post</string>
<!-- App Infos -->
<string name="changelogs">Changelogs</string>
<string name="downloads">Downloads</string>
<string name="noLinkFound">No link found</string>
</resources>

View file

@ -1,16 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.MobiDL" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/amethyst</item>
<item name="colorPrimaryVariant">@color/wisteria</item>
<item name="colorOnPrimary">@color/dark</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/wetasphalt</item>
<item name="colorSecondaryVariant">@color/midnightblue</item>
<item name="colorOnSecondary">@color/niceWhite</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<!-- Exclude specific shared preferences that contain GCM registration Id -->
</full-backup-content>

View file

@ -1,18 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View file

@ -1,21 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

Binary file not shown.

View file

@ -1,6 +0,0 @@
#Wed Aug 25 01:29:46 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

185
gradlew vendored
View file

@ -1,185 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored
View file

@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

202
main.py Normal file
View file

@ -0,0 +1,202 @@
from sys import argv
from os import environ
from dotenv import load_dotenv
from cloudscraper import CloudScraper, create_scraper
from re import findall, sub
class Scraper:
def __init__(self, pseudo: str, password: str, app: str, debug: bool = False):
self.debug = debug
self.url = "https://forum.mobilism.org"
self.requested_app = app
self.loginData = {
"username": pseudo,
"password": password,
"login": "Login"
}
def errorFormat(self, code: int = None, message: str = "") -> str:
"""Pretty error message."""
return f"{f'[{code}]' if code else ''}{' ' if len(message) > 0 and code else ''}{message}."
def connect(self) -> CloudScraper:
"""Login to the forum using credentials."""
session = create_scraper(browser = {"browser": "chrome", "platform": "windows"}) # connect with cloudflare bypasser with a chrome browser on windows
if not session:
raise SystemError(self.errorFormat(message = "The creation of the session failed")) # called only if failed at creating the session
if self.debug: print("Connection attempt...")
reponse = session.post(f"{self.url}/ucp.php", data = self.loginData, params = {"mode": "login"}) # connect to the forum using credentials - params are set by default but its in case forum changing that
if reponse.status_code != 200:
raise ConnectionRefusedError(self.errorFormat(code = reponse.status_code, message = "Unable to connect")) # called only status code isn't 200
return session
def search(self, session: CloudScraper) -> tuple[list[dict], list[dict]]:
"""Do the research."""
if self.debug: print("Going to search page and check connection...", end = " ")
reponse = session.get(f"{self.url}/search.php", params = {"keywords": self.requested_app, "sr": "topics", "sf": "titleonly"}) # fetch results page
if "Sorry but you are not permitted to use the search system. If you're not logged in please" in reponse.text:
raise ConnectionError(self.errorFormat(message = "Connection failed, check credentials")) # called only if login failed
if reponse.status_code != 200:
raise ConnectionError(self.errorFormat(code = reponse.status_code, message = "Impossible to make the search")) # called only status code isn't 200
if self.debug: print(f"Connected.")
if self.debug: print(f"Fetching results for {self.requested_app}...", end = " ")
topics = self.parse(reponse.text)
self.save(topics)
return topics, self.getInfos(session, topics)
def parse(self, htmlPage: str) -> list[dict]:
"""Parse HTML reponse to a clean list."""
if "No suitable matches were found." in htmlPage:
return []
elements = htmlPage.split("<tr>\n<td>")[1:]
elements[-1] = elements[-1].split("</td>\n</tr>")[0]
for i in range(0, len(elements)):
try:
_title = findall(r"class=\"topictitle\">(.*)<\/a>", elements[i])[0]
_title = sub(r" ?&amp; ?", " ", _title)
except:
_title = None
try:
_author = findall(r"(<br />|</strong>)\n\n?<i class=\"icon-user\"></i> by <a href=\"\./memberlist\.php\?mode=viewprofile&amp;u=\d+\"( style=\"color: #.*;\" class=\"username-coloured\")?>(.*)</a>", elements[i])[0][-1]
except:
_author = None
try:
_link = findall(r"\./viewtopic\.php\?f=(\d*)&amp;t=(\d*)&amp", elements[i])[0]
_link = {"f": _link[0], "t": _link[1]}
except:
_link = None
try:
_date = findall(r"</a> <i class=\"icon-time\"></i> <small>(.*)</small>", elements[i])[0]
except:
_date = None
print("\n" + elements[i] + "\n")
elements[i] = {"title": _title, "author": _author, "date": _date, "link": f"{self.url}/viewtopic.php?f={_link['f']}&t={_link['t']}", "linkParams": _link}
return elements
def getInfos(self, session: CloudScraper, elements: list) -> list:
"""Go to the first n pages and get a lot of infos."""
size = len(elements)
if size == 0:
return []
page = 3
if self.debug: print(f"Going to the {page} first pages...", end = " ")
results = []
for i in range(0, size):
if i < page:
reponse = session.get(f"{self.url}/viewtopic.php", params = elements[i]["linkParams"]) # fetch results page
results.append(reponse)
if reponse.status_code != 200:
raise ConnectionError(self.errorFormat(code = reponse.status_code, message = f"Error while doing the search n°{i}")) # called only status code isn't 200
if self.debug: print(f"Done.")
if self.debug: print(f"Parsing results page...", end = " ")
results = self.parsingInfos(results)
if self.debug: print(f"Done.")
return results
def parsingInfos(self, elements: list) -> list[dict]:
"""Parse infos from the page of the app."""
for i in range(0, len(elements)):
elements[i] = elements[i].text
if "Download Instructions" not in elements[i]:
elements[i] = {"changelogs": None, "downloadLinks": None}
continue
try:
_changelogs = findall(r"What's New:</span> ?<br />(.*)<br /><br /><span style=\"c|font-weight: bold\">T", elements[i])[0]
if len(_changelogs) < 2: # if result none, trying other method
_changelogs = findall(r"What's New:</span> ?<br />(.*)<br /><br /><span style=\"font-weight: bold\">T", elements[i])[0]
except:
_changelogs = "No changelog found."
try:
elements[i] = sub(r"Download Instructions:</span>(.*)?<br /><s", "Download Instructions:</span><br /><s", elements[i])
_downloadLinks = findall(r"Download Instructions:</span> ?<br />(.*|[\s\S]*)<br /><br />Trouble downloading|</a></div>", elements[i])[0]
if len(_downloadLinks) < 2:# if result none, trying other method
_downloadLinks = findall(r"Download Instructions:</span> ?<br />(.*|[\s\S]*)</a></div>", elements[i])[0]
except:
_downloadLinks = None
_downloadLinks = sub(r"\n|<a class=\"postlink\" href=\"|\(Closed Filehost\) ?|<span style=\"font-weight: bold\">|</span>|\">(\S*)</a>", "", _downloadLinks) # remove html garbage
_downloadLinks = sub(r"<br />\n?", "\n", _downloadLinks) # convert newline html to \n
_downloadLinks = sub(r"Mirrors(?!:)|Mirror(?!s)(?!:)", "Mirror:", _downloadLinks) # add ":"
_downloadLinks = _downloadLinks.split('">')[0]
elements[i] = {"changelogs": _changelogs, "downloadLinks": _downloadLinks}
return elements
def prettyPrint(self, topics: tuple[list[dict], list[dict]]) -> list:
"""Show a pretty message with all the specialized infos."""
topics, topicsInfos = topics
if len(topics) == 0:
return []
print("\n")
result = []
for i in range(0, len(topicsInfos)):
result.append({
"title": topics[i]["title"],
"author": topics[i]["author"],
"date": topics[i]["date"],
"changelogs": str(topicsInfos[i]["changelogs"]).replace("<br />", "\n"),
"downloadLinks": topicsInfos[i]["downloadLinks"]
})
print(f"Title: {result[i]['title']}\n")
print(f"Author: {result[i]['author']}\n")
print(f"Date of release: {result[i]['date']}\n")
print(f"Changelogs: \n{result[i]['changelogs']}\n")
print(f"Download links: \n{result[i]['downloadLinks']}")
print("\n\n---\n")
return result
def work(self) -> list:
"""Call all the others methods."""
return self.prettyPrint(self.search(self.connect()))
def save(self, elements: list) -> None:
"""Save all the results parsed to a CSV file."""
size = len(elements)
if size == 0:
print("No elements were found with the search.")
return
filename = "results.csv"
with open(filename, "w") as f:
topCSV = list(elements[0].keys()) # create a copy of the first element keys
topCSV.remove("linkParams") # remove linkParams
f.write(";".join(topCSV))
f.write("\n")
for element in elements:
if element != "linkParams":
f.write(";".join(str(e) for e in list(element.values())[:-1]))
f.write("\n")
print(f"{size} elements have been registered in the {filename} file.")
if __name__ == "__main__":
argv = argv[1:]
if len(argv) < 1: # no args
print("No App to retrieve.")
exit(1)
load_dotenv() # load .env file
try:
try: # for logs
debug = environ["DEBUG_MOBILISM"].lower() in ("yes", "true", "1")
except:
debug = False
try: # try to fetch credentials from de .env first
pseudoMobilism = environ["PSEUDO_MOBILISM"]
passwordMobilism = environ["PASSWORD_MOBILISM"]
except: # if it failed try to get from the cli
if len(argv) >= 3:
pseudoMobilism = argv[0]
passwordMobilism = argv[1]
argv = argv[-2:]
else: # if it failed again there is a problem
raise KeyError
Scraper(pseudoMobilism, passwordMobilism, " ".join([n for n in argv]), debug).work() # call the work() function
except KeyError:
print('Please fill in the username and password (with quotes) by args or with .env file and give an app to retrieve.')

4
requirements.txt Normal file
View file

@ -0,0 +1,4 @@
# main script
requests==2.26.0
python-dotenv==0.19.0
cloudscraper==1.2.58

View file

@ -1,10 +0,0 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "MobiDL"
include ':app'