refactor: remove dashboard lock flow and clean non-critical files

This commit is contained in:
Renato
2026-03-02 18:56:32 -03:00
parent 7cdf5534b4
commit 49ed737663
278 changed files with 20 additions and 4105 deletions

5
.gitignore vendored
View File

@@ -129,8 +129,3 @@ lint/tmp/
app/release/ app/release/
app/debug/ app/debug/
*.apk *.apk
# Dashboard local files
dashboard/node_modules/
dashboard/server.log
dashboard/config.json

3
.idea/.gitignore generated vendored
View File

@@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

1
.idea/.name generated
View File

@@ -1 +0,0 @@
StreamPlayer

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

6
.idea/compiler.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DeviceTable">
<option name="columnSorters">
<list>
<ColumnSorterState>
<option name="column" value="Name" />
<option name="order" value="ASCENDING" />
</ColumnSorterState>
</list>
</option>
</component>
</project>

18
.idea/gradle.xml generated
View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

10
.idea/migrations.xml generated
View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

7
.idea/misc.xml generated
View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -113,60 +113,12 @@ StreamPlayer ahora consulta automáticamente las releases públicas del reposito
Si por algún motivo olvidas subir el manifiesto, la app igualmente tomará el primer asset `.apk` de la release, pero no podrá forzar versiones mínimas. Si por algún motivo olvidas subir el manifiesto, la app igualmente tomará el primer asset `.apk` de la release, pero no podrá forzar versiones mínimas.
### Dashboard de Dispositivos y Bloqueo Remoto ### Flujo dentro de la app
Para saber en qué equipo está instalada la app y bloquear el acceso cuando lo necesites, se incluye un dashboard liviano en `dashboard/`:
1. Instala dependencias y ejecuta el servidor:
```bash
cd dashboard
npm install
npm start # escucha en http://localhost:4000
```
2. Copia `dashboard/config.example.json` a `dashboard/config.json` y completa `telegramBotToken` + `telegramChatId` (o usa variables de entorno `TELEGRAM_BOT_TOKEN` / `TELEGRAM_CHAT_ID`).
3. Ajusta `DEVICE_REGISTRY_URL` en `app/build.gradle` para apuntar al dominio/puerto donde despliegues el servidor (ya configurado como `http://194.163.191.200:4000`).
4. Distribuye el APK; cada instalación reportará `ANDROID_ID`, modelo, IP pública y país.
5. Entra a `http://TU_HOST:4000/` para ver el listado, asignar alias, bloquear/desbloquear o validar tokens.
El servidor guarda los datos en `dashboard/data/devices.json`, por lo que puedes versionarlo o respaldarlo fácilmente. Cada registro almacena:
- `deviceId`: `Settings.Secure.ANDROID_ID` del equipo
- `deviceName`, `manufacturer`, `model`, `osVersion`
- `appVersionName`/`Code`
- `ip`, `country` detectados automáticamente
- `firstSeen`, `lastSeen`, `blocked`, `notes`, `verification.status`
Cuando presionas “Bloquear”, la app recibe la respuesta `{"blocked": true}` y muestra un diálogo irreversible hasta que lo habilites. Esto añade una capa adicional de control aparte del sistema de actualizaciones.
### Flujo dentro de la app y tokens divididos
- Cada vez que se abre `MainActivity` se consulta `https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest`. - Cada vez que se abre `MainActivity` se consulta `https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest`.
- Si `versionCode` del servidor es mayor al instalado se muestra un diálogo para actualizar; el usuario puede abrir la release o descargarla directamente. - Si `versionCode` del servidor es mayor al instalado se muestra un diálogo para actualizar; el usuario puede abrir la release o descargarla directamente.
- Si `minSupportedVersionCode` es mayor al instalado la app bloqueará el uso hasta actualizar, cumpliendo con el requerimiento de controlar instalaciones. - Si `minSupportedVersionCode` es mayor al instalado la app bloqueará el uso hasta actualizar, cumpliendo con el requerimiento de controlar instalaciones.
- La descarga se gestiona con `DownloadManager` y, una vez completada, se lanza el instalador usando FileProvider. - La descarga se gestiona con `DownloadManager` y, una vez completada, se lanza el instalador usando FileProvider.
- Mientras el dashboard mantenga un dispositivo "Pendiente" o "Bloqueado", la app muestra un diálogo con el motivo y la mitad del token que debe compartir la persona.
Cada instalación genera un token interno dividido en dos:
1. **Parte cliente**: se muestra en el diálogo del dispositivo bloqueado para que el usuario pueda copiarla.
2. **Parte admin**: llega al bot de Telegram configurado junto con la IP, país y datos del dispositivo.
Para autorizar un dispositivo pendiente:
1. Obtén la parte cliente desde el usuario (visible en pantalla).
2. Copia la parte admin del mensaje de Telegram.
3. En el dashboard presiona “Verificar token” e introduce ambas mitades. Si coinciden, el estado pasa a "Verificado" y la app se desbloquea automáticamente.
4. A partir de allí puedes bloquear/desbloquear manualmente cuando quieras.
También puedes gestionar todo desde Telegram:
- `/allow <deviceId> <token_cliente>` autoriza el dispositivo (verifica el token y lo desbloquea).
- `/deny <deviceId> <token_cliente> [motivo]` lo bloquea con un motivo opcional.
- `/pending` lista los registros que aún esperan un token válido.
Cada nuevo registro dispara una notificación de Telegram con la parte admin del token y recordatorios de esos comandos.
## 📱 Estructura del Proyecto ## 📱 Estructura del Proyecto

View File

@@ -10,7 +10,6 @@ android {
targetSdk 35 targetSdk 35
versionCode 100201 versionCode 100201
versionName "11.0.1" versionName "11.0.1"
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
} }
buildTypes { buildTypes {

View File

@@ -1,169 +0,0 @@
package com.streamplayer;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
/**
* Informa al dashboard qué dispositivos tienen instalada la app y permite bloquearlos remotamente.
*/
public class DeviceRegistry {
public interface Callback {
void onAllowed();
void onBlocked(String reason, String tokenPart);
void onError(String message);
}
private static final String TAG = "DeviceRegistry";
private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
private final Context appContext;
private final OkHttpClient httpClient;
private final ExecutorService executorService;
private final Handler mainHandler = new Handler(Looper.getMainLooper());
public DeviceRegistry(Context context) {
this.appContext = context.getApplicationContext();
// Usar NetworkUtils para obtener cliente con DNS over HTTPS configurado
this.httpClient = NetworkUtils.getClient();
this.executorService = Executors.newSingleThreadExecutor();
}
public void syncDevice(Callback callback) {
if (TextUtils.isEmpty(BuildConfig.DEVICE_REGISTRY_URL)) {
postAllowed(callback);
return;
}
executorService.execute(() -> {
try {
JSONObject payload = new JSONObject();
payload.put("deviceId", getDeviceId());
payload.put("deviceName", Build.MODEL);
payload.put("model", Build.MODEL);
payload.put("manufacturer", capitalize(Build.MANUFACTURER));
payload.put("osVersion", Build.VERSION.RELEASE + " (API " + Build.VERSION.SDK_INT + ")");
payload.put("appVersionName", BuildConfig.VERSION_NAME);
payload.put("appVersionCode", BuildConfig.VERSION_CODE);
String endpoint = sanitizeBaseUrl(BuildConfig.DEVICE_REGISTRY_URL) + "/api/devices/register";
RequestBody body = RequestBody.create(payload.toString(), JSON);
Request request = new Request.Builder()
.url(endpoint)
.post(body)
.build();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful() || response.body() == null) {
throw new IOException("HTTP " + response.code());
}
String responseText = response.body().string();
// Validar que no sea HTML antes de parsear
if (responseText != null) {
String trimmed = responseText.trim();
if (trimmed.startsWith("<!") || trimmed.startsWith("<html")) {
throw new IOException("El servidor devolvió HTML en lugar de JSON");
}
}
JSONObject json = new JSONObject(responseText);
JSONObject deviceJson = json.optJSONObject("device");
JSONObject verificationJson = json.optJSONObject("verification");
boolean blocked = json.optBoolean("blocked", false);
String reason = json.optString("message");
if (TextUtils.isEmpty(reason) && deviceJson != null) {
reason = deviceJson.optString("notes", "");
}
String tokenPart = "";
if (verificationJson != null) {
boolean verificationRequired = verificationJson.optBoolean("required", false);
blocked = blocked || verificationRequired;
tokenPart = verificationJson.optString("clientTokenPart", "");
}
if (blocked) {
postBlocked(callback, reason, tokenPart);
} else {
postAllowed(callback);
}
}
} catch (IOException | JSONException e) {
Log.w(TAG, "Device sync error", e);
postError(callback, e.getMessage());
}
});
}
private String sanitizeBaseUrl(String base) {
if (TextUtils.isEmpty(base)) {
return "";
}
if (base.endsWith("/")) {
return base.substring(0, base.length() - 1);
}
return base;
}
private String getDeviceId() {
String id = Settings.Secure.getString(appContext.getContentResolver(),
Settings.Secure.ANDROID_ID);
if (TextUtils.isEmpty(id)) {
id = Build.MODEL + "-" + Build.BOARD + "-" + BuildConfig.VERSION_CODE;
}
return id;
}
private String capitalize(String value) {
if (TextUtils.isEmpty(value)) {
return "";
}
return value.substring(0, 1).toUpperCase(Locale.ROOT)
+ value.substring(1);
}
public void release() {
executorService.shutdownNow();
}
private void postAllowed(Callback callback) {
if (callback == null) {
return;
}
mainHandler.post(callback::onAllowed);
}
private void postBlocked(Callback callback, String reason, String tokenPart) {
if (callback == null) {
return;
}
String reasonText = reason == null ? "" : reason;
String token = tokenPart == null ? "" : tokenPart;
mainHandler.post(() -> callback.onBlocked(reasonText, token));
}
private void postError(Callback callback, String message) {
if (callback == null) {
return;
}
mainHandler.post(() -> callback.onError(message));
}
}

View File

@@ -2,22 +2,18 @@ package com.streamplayer;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@@ -49,8 +45,6 @@ public class MainActivity extends AppCompatActivity {
private SectionEntry currentSection; private SectionEntry currentSection;
private UpdateManager updateManager; private UpdateManager updateManager;
private AlertDialog updateDialog; private AlertDialog updateDialog;
private AlertDialog blockedDialog;
private DeviceRegistry deviceRegistry;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -113,28 +107,6 @@ public class MainActivity extends AppCompatActivity {
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
}); });
deviceRegistry = new DeviceRegistry(this);
deviceRegistry.syncDevice(new DeviceRegistry.Callback() {
@Override
public void onAllowed() {
// Device authorized, continue normally.
}
@Override
public void onBlocked(String reason, String tokenPart) {
showBlockedDialog(reason, tokenPart);
}
@Override
public void onError(String message) {
if (!TextUtils.isEmpty(message)) {
Toast.makeText(MainActivity.this,
getString(R.string.device_registry_error, message),
Toast.LENGTH_SHORT).show();
}
}
});
} }
@Override @Override
@@ -151,15 +123,9 @@ public class MainActivity extends AppCompatActivity {
if (updateDialog != null && updateDialog.isShowing()) { if (updateDialog != null && updateDialog.isShowing()) {
updateDialog.dismiss(); updateDialog.dismiss();
} }
if (blockedDialog != null && blockedDialog.isShowing()) {
blockedDialog.dismiss();
}
if (updateManager != null) { if (updateManager != null) {
updateManager.release(); updateManager.release();
} }
if (deviceRegistry != null) {
deviceRegistry.release();
}
} }
private void selectSection(int index) { private void selectSection(int index) {
@@ -273,7 +239,7 @@ public class MainActivity extends AppCompatActivity {
if (updateDialog != null && updateDialog.isShowing()) { if (updateDialog != null && updateDialog.isShowing()) {
updateDialog.dismiss(); updateDialog.dismiss();
} }
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ThemeOverlay_StreamPlayer_AlertDialog) AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(mandatory ? R.string.update_required_title : R.string.update_available_title) .setTitle(mandatory ? R.string.update_required_title : R.string.update_available_title)
.setMessage(buildUpdateMessage(info)) .setMessage(buildUpdateMessage(info))
.setPositiveButton(R.string.update_action_download, .setPositiveButton(R.string.update_action_download,
@@ -287,7 +253,23 @@ public class MainActivity extends AppCompatActivity {
} else { } else {
builder.setNegativeButton(R.string.update_action_later, null); builder.setNegativeButton(R.string.update_action_later, null);
} }
updateDialog = builder.show(); updateDialog = builder.create();
updateDialog.setOnShowListener(dialog -> {
int actionColor = ContextCompat.getColor(this, R.color.refresh_button_focused);
Button positive = updateDialog.getButton(AlertDialog.BUTTON_POSITIVE);
Button neutral = updateDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
Button negative = updateDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
if (positive != null) {
positive.setTextColor(actionColor);
}
if (neutral != null) {
neutral.setTextColor(actionColor);
}
if (negative != null) {
negative.setTextColor(actionColor);
}
});
updateDialog.show();
} }
private CharSequence buildUpdateMessage(UpdateManager.UpdateInfo info) { private CharSequence buildUpdateMessage(UpdateManager.UpdateInfo info) {
@@ -339,54 +321,6 @@ public class MainActivity extends AppCompatActivity {
} }
} }
private void showBlockedDialog(String reason, String tokenPart) {
if (isFinishing()) {
return;
}
String finalReason = TextUtils.isEmpty(reason)
? getString(R.string.device_blocked_default_reason)
: reason;
if (blockedDialog != null && blockedDialog.isShowing()) {
blockedDialog.dismiss();
}
View dialogView = getLayoutInflater().inflate(R.layout.dialog_blocked, null);
TextView messageText = dialogView.findViewById(R.id.blocked_message_text);
View tokenContainer = dialogView.findViewById(R.id.blocked_token_container);
TextView tokenValue = dialogView.findViewById(R.id.blocked_token_value);
messageText.setText(getString(R.string.device_blocked_message, finalReason));
boolean hasToken = !TextUtils.isEmpty(tokenPart);
if (hasToken) {
tokenContainer.setVisibility(View.VISIBLE);
tokenValue.setText(tokenPart);
tokenValue.setOnClickListener(v -> copyTokenToClipboard(tokenPart));
} else {
tokenContainer.setVisibility(View.GONE);
}
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ThemeOverlay_StreamPlayer_AlertDialog)
.setTitle(R.string.device_blocked_title)
.setView(dialogView)
.setCancelable(false)
.setPositiveButton(R.string.device_blocked_close,
(dialog, which) -> finish());
if (hasToken) {
builder.setNeutralButton(R.string.device_blocked_copy_token,
(dialog, which) -> copyTokenToClipboard(tokenPart));
}
blockedDialog = builder.create();
blockedDialog.show();
}
private void copyTokenToClipboard(String tokenPart) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard == null) {
Toast.makeText(this, R.string.device_blocked_copy_error, Toast.LENGTH_SHORT).show();
return;
}
ClipData data = ClipData.newPlainText("token", tokenPart);
clipboard.setPrimaryClip(data);
Toast.makeText(this, R.string.device_blocked_copy_success, Toast.LENGTH_SHORT).show();
}
private int getSpanCount() { private int getSpanCount() {
return getResources().getInteger(R.integer.channel_grid_span); return getResources().getInteger(R.integer.channel_grid_span);
} }

View File

@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/blocked_message_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="16sp" />
<LinearLayout
android:id="@+id/blocked_token_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/blocked_token_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/device_blocked_token_label"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/blocked_token_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="@android:color/transparent"
android:padding="8dp"
android:textColor="@android:color/black"
android:textIsSelectable="true"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -40,13 +40,4 @@
<string name="update_error_install_intent">No se pudo abrir el instalador de paquetes</string> <string name="update_error_install_intent">No se pudo abrir el instalador de paquetes</string>
<string name="update_notification_title">StreamPlayer %1$s</string> <string name="update_notification_title">StreamPlayer %1$s</string>
<string name="update_notification_description">Descargando nueva versión</string> <string name="update_notification_description">Descargando nueva versión</string>
<string name="device_blocked_title">Dispositivo bloqueado</string>
<string name="device_blocked_message">Este dispositivo fue bloqueado desde el panel de control. Motivo: %1$s</string>
<string name="device_blocked_default_reason">Sin motivo especificado.</string>
<string name="device_blocked_token_label">Código de verificación</string>
<string name="device_blocked_close">Salir</string>
<string name="device_blocked_copy_token">Copiar código</string>
<string name="device_blocked_copy_success">Código copiado al portapapeles</string>
<string name="device_blocked_copy_error">No se pudo copiar el código</string>
<string name="device_registry_error">No se pudo registrar el dispositivo (%1$s)</string>
</resources> </resources>

View File

@@ -6,10 +6,4 @@
<item name="android:statusBarColor">@color/black</item> <item name="android:statusBarColor">@color/black</item>
<item name="android:navigationBarColor">@color/black</item> <item name="android:navigationBarColor">@color/black</item>
</style> </style>
<style name="ThemeOverlay.StreamPlayer.AlertDialog" parent="ThemeOverlay.AppCompat.Dialog.Alert">
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="colorAccent">@color/white</item>
</style>
</resources> </resources>

View File

@@ -1,4 +0,0 @@
{
"telegramBotToken": "123456:ABCDEF-TOKEN",
"telegramChatId": "123456789"
}

View File

@@ -1,267 +0,0 @@
[
{
"deviceId": "f91f2668e8dfb2a7",
"alias": "",
"deviceName": "SM-S928B",
"model": "SM-S928B",
"manufacturer": "Samsung",
"osVersion": "16 (API 36)",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-11-23T22:31:13.359Z",
"lastSeen": "2025-11-25T19:07:38.445Z",
"blocked": false,
"notes": "",
"installs": 22,
"ip": "181.23.253.20",
"country": "AR",
"verification": {
"clientPart": "1714c2bb93670c3f",
"adminPart": "9924c7049211c58c",
"status": "verified",
"createdAt": "2025-11-23T22:31:13.359Z",
"verifiedAt": "2025-11-23T22:33:11.942Z"
}
},
{
"deviceId": "c8ee9361c07a3245",
"alias": "",
"deviceName": "23113RKC6G",
"model": "23113RKC6G",
"manufacturer": "Xiaomi",
"osVersion": "15 (API 35)",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-11-23T23:19:29.464Z",
"lastSeen": "2025-11-23T23:21:02.377Z",
"blocked": false,
"notes": "",
"installs": 3,
"ip": "181.23.253.20",
"country": "AR",
"verification": {
"clientPart": "f7d5a364822457da",
"adminPart": "b4acb7da77b11ce9",
"status": "verified",
"createdAt": "2025-11-23T23:19:29.464Z",
"verifiedAt": "2025-11-23T23:20:49.579Z"
}
},
{
"deviceId": "c874876530da8f76",
"alias": "",
"deviceName": "2020/2021 UHD Android TV",
"model": "2020/2021 UHD Android TV",
"manufacturer": "TPV",
"osVersion": "11 (API 30)",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-11-24T18:53:40.668Z",
"lastSeen": "2025-11-25T01:33:56.790Z",
"blocked": false,
"notes": "",
"installs": 3,
"ip": "181.23.253.20",
"country": "AR",
"verification": {
"clientPart": "76139a364baeda9b",
"adminPart": "86601e7089416b57",
"status": "verified",
"createdAt": "2025-11-24T18:53:40.668Z",
"verifiedAt": "2025-11-24T18:54:52.788Z"
}
},
{
"deviceId": "879fe5ad6ac80e2d",
"alias": "",
"deviceName": "SM-S928B",
"model": "SM-S928B",
"manufacturer": "Samsung",
"osVersion": "16 (API 36)",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-11-25T19:08:38.948Z",
"lastSeen": "2025-12-23T20:41:59.972Z",
"blocked": false,
"notes": "",
"installs": 9,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "e512eb7d5c026e85",
"adminPart": "1891c4eec608a722",
"status": "verified",
"createdAt": "2025-11-25T19:08:38.948Z",
"verifiedAt": "2025-11-25T19:08:56.806Z"
}
},
{
"deviceId": "97a5c320c47e17ad",
"alias": "",
"deviceName": "Chromecast",
"model": "Chromecast",
"manufacturer": "Google",
"osVersion": "14 (API 34)",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-11-25T19:10:27.358Z",
"lastSeen": "2025-12-29T23:21:36.891Z",
"blocked": false,
"notes": "",
"installs": 26,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "f35ae98e27e9877c",
"adminPart": "e421a660ff38fc67",
"status": "verified",
"createdAt": "2025-11-25T19:10:27.358Z",
"verifiedAt": "2025-11-25T19:10:54.592Z"
}
},
{
"deviceId": "79a556d89cd9f783",
"alias": "",
"deviceName": "motorola edge 30",
"model": "motorola edge 30",
"manufacturer": "Motorola",
"osVersion": "13 (API 33)",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-11-25T19:29:17.916Z",
"lastSeen": "2025-12-14T20:26:50.664Z",
"blocked": false,
"notes": "",
"installs": 5,
"ip": "181.25.52.139",
"country": "AR",
"verification": {
"clientPart": "4aec5b0e2e1c782a",
"adminPart": "7a4bb228e3b5048c",
"status": "verified",
"createdAt": "2025-11-25T19:29:17.916Z",
"verifiedAt": "2025-11-25T19:30:11.849Z"
}
},
{
"deviceId": "309f9f56550fc16bf047d636",
"alias": "",
"deviceName": "WIN-J7S53EBK2BG",
"model": "Microsoft Windows 10.0.26100",
"manufacturer": "Microsoft",
"osVersion": "Microsoft Windows NT 10.0.26100.0",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-12-17T18:37:45.562Z",
"lastSeen": "2025-12-17T19:28:44.530Z",
"blocked": false,
"notes": "por boludo",
"installs": 21,
"ip": "181.25.52.139",
"country": "AR",
"verification": {
"clientPart": "60989c16f0ed61d9",
"adminPart": "c1befd758b4cd459",
"status": "verified",
"createdAt": "2025-12-17T18:37:45.562Z",
"verifiedAt": "2025-12-17T18:38:24.129Z"
},
"blockedAt": "2025-12-17T19:14:30.701Z"
},
{
"deviceId": "12c96524b10b1e15f5611b0a",
"alias": "",
"deviceName": "WIN-1F1PBAQI7PR",
"model": "Microsoft Windows 10.0.26100",
"manufacturer": "Microsoft",
"osVersion": "Microsoft Windows NT 10.0.26100.0",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-12-17T19:35:44.810Z",
"lastSeen": "2025-12-17T19:38:12.510Z",
"blocked": false,
"notes": "",
"installs": 2,
"ip": "181.25.52.139",
"country": "AR",
"verification": {
"clientPart": "d41b6a6bc639fe77",
"adminPart": "dab1fa74da2edab2",
"status": "verified",
"createdAt": "2025-12-17T19:35:44.810Z",
"verifiedAt": "2025-12-17T19:37:59.152Z"
}
},
{
"deviceId": "6623a19316ebbbc1570b31e2",
"alias": "",
"deviceName": "DESKTOP-TF8OENP",
"model": "Microsoft Windows 10.0.19045",
"manufacturer": "Microsoft",
"osVersion": "Microsoft Windows NT 10.0.19045.0",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-12-17T19:53:20.007Z",
"lastSeen": "2025-12-17T19:56:52.028Z",
"blocked": false,
"notes": "",
"installs": 4,
"ip": "190.55.131.98",
"country": "AR",
"verification": {
"clientPart": "e5ed2a5989a8e44a",
"adminPart": "21e79e6e83e662cf",
"status": "verified",
"createdAt": "2025-12-17T19:53:20.007Z",
"verifiedAt": "2025-12-17T19:53:43.017Z"
}
},
{
"deviceId": "8678935B-0B7A-41B0-B6E3-AB205073BE7F",
"alias": "",
"deviceName": "iPhone 17 Pro",
"model": "iPhone",
"manufacturer": "Apple",
"osVersion": "iOS 26.2",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-12-29T22:27:06.203Z",
"lastSeen": "2025-12-29T22:36:32.797Z",
"blocked": false,
"notes": "",
"installs": 3,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "fac4063d6b67ce57",
"adminPart": "667b10f28d37b534",
"status": "verified",
"createdAt": "2025-12-29T22:27:06.203Z",
"verifiedAt": "2025-12-29T22:30:37.120Z"
}
},
{
"deviceId": "FB4B39C0-A766-4A01-980E-763ACE9118A2",
"alias": "",
"deviceName": "iPhone 17 Pro",
"model": "iPhone",
"manufacturer": "Apple",
"osVersion": "iOS 26.2",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-12-29T22:40:54.202Z",
"lastSeen": "2025-12-29T23:04:30.334Z",
"blocked": false,
"notes": "",
"installs": 4,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "353df62e6d1faee3",
"adminPart": "648bd37e530033f7",
"status": "verified",
"createdAt": "2025-12-29T22:40:54.202Z",
"verifiedAt": "2025-12-29T22:44:27.529Z"
}
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
{
"name": "streamplayer-device-dashboard",
"version": "1.0.0",
"description": "Dashboard ligero para controlar instalaciones del APK StreamPlayer",
"main": "server.js",
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js"
},
"author": "StreamPlayer",
"license": "MIT",
"dependencies": {
"axios": "^1.6.7",
"dotenv": "^16.4.5",
"cors": "^2.8.5",
"express": "^4.18.2",
"geoip-lite": "^1.4.6",
"morgan": "^1.10.0",
"request-ip": "^3.3.0"
},
"devDependencies": {
"nodemon": "^3.0.1"
}
}

View File

@@ -1,180 +0,0 @@
const tableBody = document.getElementById('devicesTable');
const refreshBtn = document.getElementById('refreshBtn');
const statusMessage = document.getElementById('statusMessage');
async function fetchDevices() {
setStatus('Cargando dispositivos...');
try {
const response = await fetch('/api/devices');
if (!response.ok) {
throw new Error('Error ' + response.status);
}
const { devices } = await response.json();
renderTable(devices || []);
setStatus('Actualizado ' + new Date().toLocaleTimeString());
} catch (error) {
console.error(error);
setStatus('No se pudo cargar el listado');
}
}
function renderTable(devices) {
tableBody.innerHTML = '';
if (!devices.length) {
tableBody.innerHTML = '<tr><td colspan="10" class="empty">Sin registros</td></tr>';
return;
}
devices.sort((a, b) => (a.lastSeen || '').localeCompare(b.lastSeen || '') * -1);
for (const device of devices) {
const tr = document.createElement('tr');
if (device.blocked) {
tr.classList.add('blocked');
}
const alias = device.alias && device.alias.trim().length ? device.alias : 'Sin alias';
const verificationStatus = device.verification && device.verification.status ? device.verification.status : 'pending';
const needsVerification = verificationStatus !== 'verified';
const verificationText = needsVerification
? `Pendiente - Token cliente: ${device.verification && device.verification.clientPart ? device.verification.clientPart : 'N/A'}`
: `Verificado ${device.verification.verifiedAt ? `(${formatDate(device.verification.verifiedAt)})` : ''}`;
const statusLabel = device.blocked
? 'Bloqueado'
: needsVerification ? 'Pendiente token' : 'Activo';
const actions = [`<button data-action="alias">Alias</button>`];
if (needsVerification) {
actions.push('<button data-action="verify" class="primary">Verificar token</button>');
}
actions.push(device.blocked ? '<button data-action="unblock" class="primary">Desbloquear</button>' : '<button data-action="block" class="danger">Bloquear</button>');
actions.push('<button data-action="delete" class="danger ghost">Borrar</button>');
tr.innerHTML = `
<td>
<div class="alias">${alias}</div>
<div class="device-name">${device.deviceName || '(sin nombre)'} </div>
</td>
<td>${device.deviceId}</td>
<td>${[device.manufacturer, device.model].filter(Boolean).join(' ')}</td>
<td>${device.appVersionName || ''} (${device.appVersionCode || ''})</td>
<td>${device.ip || '-'}</td>
<td>${formatCountry(device.country)}</td>
<td>${verificationText}</td>
<td>${formatDate(device.lastSeen)}</td>
<td>${statusLabel}</td>
<td class="actions-cell">
${actions.join(' ')}
</td>
`;
tr.dataset.deviceId = device.deviceId;
tableBody.appendChild(tr);
}
}
function formatDate(value) {
if (!value) return '-';
const date = new Date(value);
if (Number.isNaN(date.getTime())) return value;
return date.toLocaleString();
}
function formatCountry(value) {
if (!value || value === 'N/A') {
return '-';
}
return value;
}
async function blockDevice(deviceId) {
const reason = prompt('Motivo del bloqueo (opcional):');
await fetch(`/api/devices/${encodeURIComponent(deviceId)}/block`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ reason })
});
await fetchDevices();
}
async function unblockDevice(deviceId) {
await fetch(`/api/devices/${encodeURIComponent(deviceId)}/unblock`, { method: 'POST' });
await fetchDevices();
}
async function deleteDevice(deviceId) {
const confirmation = confirm('¿Seguro que quieres borrar este dispositivo? Generará un nuevo token cuando se registre de nuevo.');
if (!confirmation) {
return;
}
const response = await fetch(`/api/devices/${encodeURIComponent(deviceId)}`, { method: 'DELETE' });
if (!response.ok) {
alert('No se pudo borrar el dispositivo');
return;
}
await fetchDevices();
}
async function verifyDevice(deviceId) {
const clientTokenPart = prompt('Introduce el token que aparece en el dispositivo:');
if (clientTokenPart === null) {
return;
}
const adminTokenPart = prompt('Introduce el token recibido en Telegram:');
if (adminTokenPart === null) {
return;
}
const response = await fetch(`/api/devices/${encodeURIComponent(deviceId)}/verify`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ clientTokenPart, adminTokenPart })
});
if (!response.ok) {
const payload = await response.json().catch(() => ({}));
alert(payload.error || 'No se pudo verificar el token');
return;
}
await fetchDevices();
}
async function updateAlias(deviceId) {
const alias = prompt('Nuevo alias para el dispositivo:');
if (alias === null) {
return;
}
await fetch(`/api/devices/${encodeURIComponent(deviceId)}/alias`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ alias })
});
await fetchDevices();
}
function setStatus(message) {
statusMessage.textContent = message;
}
refreshBtn.addEventListener('click', fetchDevices);
tableBody.addEventListener('click', async (event) => {
const button = event.target.closest('button');
if (!button) return;
const tr = button.closest('tr');
const deviceId = tr && tr.dataset.deviceId;
if (!deviceId) return;
const action = button.dataset.action;
try {
if (action === 'block') {
await blockDevice(deviceId);
} else if (action === 'unblock') {
await unblockDevice(deviceId);
} else if (action === 'alias') {
await updateAlias(deviceId);
} else if (action === 'verify') {
await verifyDevice(deviceId);
} else if (action === 'delete') {
await deleteDevice(deviceId);
}
} catch (error) {
console.error(error);
alert('Operación fallida');
}
});
fetchDevices();

View File

@@ -1,42 +0,0 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>StreamPlayer Device Dashboard</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header>
<h1>Control de Dispositivos StreamPlayer</h1>
<p>Visualiza instalaciones activas y bloquea acceso con un clic.</p>
</header>
<section class="actions">
<button id="refreshBtn">Actualizar listado</button>
<span id="statusMessage"></span>
</section>
<section class="table-wrapper">
<table>
<thead>
<tr>
<th>Alias / Nombre</th>
<th>Device ID</th>
<th>Modelo</th>
<th>Versión app</th>
<th>IP Pública</th>
<th>País</th>
<th>Verificación</th>
<th>Última vez visto</th>
<th>Estado</th>
<th>Acciones</th>
</tr>
</thead>
<tbody id="devicesTable">
<tr>
<td colspan="7" class="empty">No hay datos aún</td>
</tr>
</tbody>
</table>
</section>
<script src="app.js"></script>
</body>
</html>

View File

@@ -1,89 +0,0 @@
:root {
font-family: 'Segoe UI', Tahoma, sans-serif;
color: #202124;
background: #f7f7f7;
}
body {
margin: 0;
padding: 2rem;
}
header {
margin-bottom: 1rem;
}
header h1 {
margin-bottom: 0.2rem;
}
.actions {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1rem;
}
button {
border: none;
background: #4285f4;
color: #fff;
padding: 0.5rem 1rem;
border-radius: 4px;
cursor: pointer;
font-size: 0.9rem;
}
button.danger {
background: #d93025;
}
button.primary {
background: #1a73e8;
}
.table-wrapper {
overflow-x: auto;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 0.8rem;
text-align: left;
border-bottom: 1px solid #eee;
}
th {
background: #fafafa;
font-weight: 600;
}
tr.blocked {
background: #fff4f4;
}
.actions-cell button {
margin-right: 0.3rem;
}
.alias {
font-weight: 600;
}
.device-name {
font-size: 0.85rem;
color: #5f6368;
}
.empty {
text-align: center;
padding: 2rem;
color: #5f6368;
}

View File

@@ -1,464 +0,0 @@
const express = require('express');
const cors = require('cors');
const fs = require('fs');
const path = require('path');
const morgan = require('morgan');
const crypto = require('crypto');
const axios = require('axios');
const requestIp = require('request-ip');
const geoip = require('geoip-lite');
const dotenv = require('dotenv');
const envPath = path.resolve(__dirname, '..', '.env');
if (fs.existsSync(envPath)) {
dotenv.config({ path: envPath });
} else {
dotenv.config();
}
const app = express();
const PORT = process.env.PORT || 4000;
const DATA_PATH = path.join(__dirname, 'data', 'devices.json');
const CONFIG_PATH = path.join(__dirname, 'config.json');
const config = loadConfig();
const TELEGRAM_BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN || config.telegramBotToken || '';
const TELEGRAM_CHAT_ID = (process.env.TELEGRAM_CHAT_ID || config.telegramChatId || '').toString();
let telegramOffset = 0;
let telegramPollingStarted = false;
app.use(cors());
app.use(express.json());
app.use(morgan('dev'));
app.use(express.static(path.join(__dirname, 'public'), {
extensions: ['html']
}));
app.use((req, res, next) => {
res.setHeader('Cache-Control', 'no-store');
next();
});
function loadConfig() {
try {
if (fs.existsSync(CONFIG_PATH)) {
const raw = fs.readFileSync(CONFIG_PATH, 'utf-8');
return JSON.parse(raw);
}
} catch (error) {
console.warn('Could not parse config.json', error);
}
return {};
}
function ensureDataFile() {
if (!fs.existsSync(DATA_PATH)) {
fs.mkdirSync(path.dirname(DATA_PATH), { recursive: true });
fs.writeFileSync(DATA_PATH, JSON.stringify([], null, 2));
}
}
function readDevices() {
ensureDataFile();
try {
const raw = fs.readFileSync(DATA_PATH, 'utf-8');
const devices = JSON.parse(raw);
return Array.isArray(devices) ? devices : [];
} catch (err) {
console.error('Error parsing devices.json', err);
return [];
}
}
function writeDevices(devices) {
ensureDataFile();
fs.writeFileSync(DATA_PATH, JSON.stringify(devices, null, 2));
}
function sanitizeId(input) {
return String(input || '').trim();
}
function sanitizeIp(ip) {
if (!ip) return '';
if (ip.startsWith('::ffff:')) {
return ip.replace('::ffff:', '');
}
return ip;
}
function lookupLocation(ip) {
if (!ip) {
return { country: 'N/A', region: '', city: '' };
}
const geo = geoip.lookup(ip);
if (!geo) {
return { country: 'N/A', region: '', city: '' };
}
return {
country: geo.country || 'N/A',
region: geo.region || '',
city: geo.city || ''
};
}
function generateTokenParts() {
const fullToken = crypto.randomBytes(16).toString('hex');
const mid = Math.floor(fullToken.length / 2);
return {
clientPart: fullToken.slice(0, mid),
adminPart: fullToken.slice(mid)
};
}
async function sendTelegramMessage(message, options = {}) {
if (!TELEGRAM_BOT_TOKEN || !TELEGRAM_CHAT_ID) {
return;
}
const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`;
try {
const payload = {
chat_id: TELEGRAM_CHAT_ID,
text: message,
disable_web_page_preview: true
};
if (options.parseMode) {
payload.parse_mode = options.parseMode;
}
await axios.post(url, payload);
} catch (error) {
console.warn('Failed to send Telegram message', error.response ? error.response.data : error.message);
}
}
async function sendTelegramNotification(message) {
await sendTelegramMessage(message, { parseMode: 'Markdown' });
}
function formatTelegramMessage(device, verificationRequired) {
const lines = [
'*Nuevo registro de dispositivo*',
`ID: ${device.deviceId}`,
`Alias: ${device.alias || '-'}`,
`Modelo: ${device.manufacturer} ${device.model}`,
`Versión app: ${device.appVersionName} (${device.appVersionCode})`,
`IP: ${device.ip || '-'} / País: ${device.country || '-'}`,
`Última vez visto: ${device.lastSeen}`
];
if (verificationRequired && device.verification) {
lines.push('`Token Admin` (guárdalo): `' + device.verification.adminPart + '`');
lines.push('Autorizar: `/allow ' + device.deviceId + ' TOKEN_CLIENTE`');
lines.push('Rechazar: `/deny ' + device.deviceId + ' TOKEN_CLIENTE [motivo]`');
}
return lines.join('\n');
}
async function initializeTelegramOffset() {
if (!TELEGRAM_BOT_TOKEN) {
return;
}
const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getUpdates`;
try {
const { data } = await axios.get(url, { params: { timeout: 1 } });
if (data.ok && Array.isArray(data.result) && data.result.length > 0) {
telegramOffset = data.result[data.result.length - 1].update_id + 1;
}
} catch (error) {
console.warn('Failed to initialize Telegram offset', error.message);
}
}
async function pollTelegramUpdates() {
if (!TELEGRAM_BOT_TOKEN || !TELEGRAM_CHAT_ID) {
return;
}
const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getUpdates`;
const params = {
timeout: 25
};
if (telegramOffset) {
params.offset = telegramOffset;
}
try {
const { data } = await axios.get(url, { params });
if (data.ok && Array.isArray(data.result)) {
for (const update of data.result) {
telegramOffset = update.update_id + 1;
if (update.message) {
processTelegramMessage(update.message);
}
}
}
} catch (error) {
console.warn('Telegram polling error', error.message);
} finally {
setTimeout(pollTelegramUpdates, 3000);
}
}
async function startTelegramPolling() {
if (telegramPollingStarted || !TELEGRAM_BOT_TOKEN || !TELEGRAM_CHAT_ID) {
return;
}
telegramPollingStarted = true;
await initializeTelegramOffset();
pollTelegramUpdates();
}
function processTelegramMessage(message) {
const chatId = message.chat && message.chat.id ? message.chat.id.toString() : '';
if (chatId && TELEGRAM_CHAT_ID && chatId !== TELEGRAM_CHAT_ID.toString()) {
return;
}
const text = (message.text || '').trim();
if (!text.startsWith('/')) {
return;
}
const parts = text.split(/\s+/);
const command = parts[0].toLowerCase();
if (command === '/allow' && parts.length >= 3) {
handleTelegramAllow(parts[1], parts[2]);
} else if (command === '/deny' && parts.length >= 3) {
const reason = parts.slice(3).join(' ') || 'Bloqueado desde Telegram';
handleTelegramDeny(parts[1], parts[2], reason);
} else if (command === '/pending') {
handleTelegramPending();
} else {
sendTelegramMessage('Comandos disponibles:\n/allow <deviceId> <token_cliente>\n/deny <deviceId> <token_cliente> [motivo]\n/pending');
}
}
async function handleTelegramAllow(deviceId, clientToken) {
const devices = readDevices();
const device = devices.find(d => d.deviceId === deviceId);
if (!device || !device.verification) {
await sendTelegramMessage(`❌ Dispositivo ${deviceId} no encontrado.`);
return;
}
if (device.verification.status === 'verified') {
await sendTelegramMessage(` El dispositivo ${deviceId} ya está verificado.`);
return;
}
if (device.verification.clientPart !== clientToken.trim()) {
await sendTelegramMessage('❌ Token del cliente inválido.');
return;
}
device.verification.status = 'verified';
device.verification.verifiedAt = new Date().toISOString();
device.blocked = false;
device.notes = '';
writeDevices(devices);
await sendTelegramMessage(`✅ Dispositivo ${deviceId} autorizado correctamente.`);
}
async function handleTelegramDeny(deviceId, clientToken, reason) {
const devices = readDevices();
const device = devices.find(d => d.deviceId === deviceId);
if (!device || !device.verification) {
await sendTelegramMessage(`❌ Dispositivo ${deviceId} no encontrado.`);
return;
}
if (device.verification.clientPart !== clientToken.trim()) {
await sendTelegramMessage('❌ Token del cliente inválido.');
return;
}
device.verification.status = 'denied';
device.verification.deniedAt = new Date().toISOString();
device.blocked = true;
device.notes = reason;
writeDevices(devices);
await sendTelegramMessage(`🚫 Dispositivo ${deviceId} bloqueado. Motivo: ${reason}`);
}
async function handleTelegramPending() {
const devices = readDevices();
const pending = devices.filter(d => !d.verification || d.verification.status !== 'verified');
if (!pending.length) {
await sendTelegramMessage('No hay dispositivos pendientes.');
return;
}
const lines = pending.slice(0, 10).map(device => {
const token = device.verification ? device.verification.clientPart : 'N/A';
return `${device.deviceId} - Token cliente: ${token}`;
});
await sendTelegramMessage('Pendientes:\n' + lines.join('\n'));
}
app.get('/api/health', (req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
app.get('/api/devices', (req, res) => {
const devices = readDevices();
res.json({ devices });
});
app.post('/api/devices/register', (req, res) => {
const {
deviceId,
deviceName,
model,
manufacturer,
osVersion,
appVersionName,
appVersionCode
} = req.body || {};
const trimmedId = sanitizeId(deviceId);
if (!trimmedId) {
return res.status(400).json({ error: 'deviceId is required' });
}
const devices = readDevices();
const now = new Date().toISOString();
const clientIp = sanitizeIp(requestIp.getClientIp(req) || req.ip || '');
const location = lookupLocation(clientIp);
let existing = devices.find(d => d.deviceId === trimmedId);
let isNew = false;
if (!existing) {
const tokenParts = generateTokenParts();
existing = {
deviceId: trimmedId,
alias: '',
deviceName: deviceName || '',
model: model || '',
manufacturer: manufacturer || '',
osVersion: osVersion || '',
appVersionName: appVersionName || '',
appVersionCode: appVersionCode || 0,
firstSeen: now,
lastSeen: now,
blocked: false,
notes: '',
installs: 1,
ip: clientIp,
country: location.country,
verification: {
clientPart: tokenParts.clientPart,
adminPart: tokenParts.adminPart,
status: 'pending',
createdAt: now
}
};
devices.push(existing);
isNew = true;
} else {
existing.deviceName = deviceName || existing.deviceName;
existing.model = model || existing.model;
existing.manufacturer = manufacturer || existing.manufacturer;
existing.osVersion = osVersion || existing.osVersion;
existing.appVersionName = appVersionName || existing.appVersionName;
existing.appVersionCode = appVersionCode || existing.appVersionCode;
existing.lastSeen = now;
existing.installs = (existing.installs || 1) + 1;
existing.ip = clientIp || existing.ip;
const hasValidCountry = location.country && location.country !== 'N/A';
existing.country = hasValidCountry ? location.country : (existing.country || 'N/A');
existing.verification = existing.verification || {
...generateTokenParts(),
status: 'pending',
createdAt: now
};
}
const verificationRequired = !existing.verification || existing.verification.status !== 'verified';
const blocked = existing.blocked || verificationRequired;
writeDevices(devices);
if (isNew || verificationRequired) {
sendTelegramNotification(formatTelegramMessage(existing, verificationRequired));
}
res.json({
blocked,
device: existing,
message: verificationRequired ? 'Instalación pendiente de verificación.' : (existing.notes || ''),
verification: {
required: verificationRequired,
clientTokenPart: verificationRequired ? existing.verification.clientPart : ''
}
});
});
app.post('/api/devices/:deviceId/block', (req, res) => {
const { deviceId } = req.params;
const { reason } = req.body || {};
const devices = readDevices();
const existing = devices.find(d => d.deviceId === deviceId);
if (!existing) {
return res.status(404).json({ error: 'Device not found' });
}
existing.blocked = true;
existing.notes = reason || existing.notes;
existing.blockedAt = new Date().toISOString();
writeDevices(devices);
res.json({ blocked: true, device: existing });
});
app.post('/api/devices/:deviceId/unblock', (req, res) => {
const { deviceId } = req.params;
const devices = readDevices();
const existing = devices.find(d => d.deviceId === deviceId);
if (!existing) {
return res.status(404).json({ error: 'Device not found' });
}
existing.blocked = false;
writeDevices(devices);
res.json({ blocked: false, device: existing });
});
app.post('/api/devices/:deviceId/verify', (req, res) => {
const { deviceId } = req.params;
const { clientTokenPart, adminTokenPart } = req.body || {};
const devices = readDevices();
const existing = devices.find(d => d.deviceId === deviceId);
if (!existing || !existing.verification) {
return res.status(404).json({ error: 'Device not found' });
}
if (!clientTokenPart || !adminTokenPart) {
return res.status(400).json({ error: 'Both token parts are required' });
}
if (
existing.verification.clientPart !== clientTokenPart.trim() ||
existing.verification.adminPart !== adminTokenPart.trim()
) {
return res.status(400).json({ error: 'Invalid token parts' });
}
existing.verification.status = 'verified';
existing.verification.verifiedAt = new Date().toISOString();
existing.blocked = false;
writeDevices(devices);
res.json({ verified: true, device: existing });
});
app.put('/api/devices/:deviceId/alias', (req, res) => {
const { deviceId } = req.params;
const { alias } = req.body || {};
const devices = readDevices();
const existing = devices.find(d => d.deviceId === deviceId);
if (!existing) {
return res.status(404).json({ error: 'Device not found' });
}
existing.alias = alias || '';
writeDevices(devices);
res.json({ device: existing });
});
app.delete('/api/devices/:deviceId', (req, res) => {
const { deviceId } = req.params;
const devices = readDevices();
const filtered = devices.filter(d => d.deviceId !== deviceId);
if (filtered.length === devices.length) {
return res.status(404).json({ error: 'Device not found' });
}
writeDevices(filtered);
res.json({ removed: true });
});
app.listen(PORT, () => {
ensureDataFile();
console.log(`StreamPlayer dashboard server listening on port ${PORT}`);
startTelegramPolling();
});

View File

@@ -1,16 +0,0 @@
[
{
"title": "Partido de Prueba",
"time": "22:00",
"category": "Fútbol",
"status": "EN VIVO",
"link": "https://streamtpmedia.com/global2.php?stream=espn"
},
{
"title": "Canal Deportivo",
"time": "15:30",
"category": "Deportes",
"status": "PRÓXIMO",
"link": "https://streamtpmedia.com/global2.php?stream=foxsports"
}
]

Submodule everything-claude-code deleted from 56ff5d444b

View File

@@ -1,93 +0,0 @@
#!/usr/bin/env python3
import os
from PIL import Image, ImageDraw, ImageFont
import sys
def create_icon(size, filename):
"""Create a simple streaming app icon"""
# Create image with transparent background
img = Image.new('RGBA', (size, size), (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
# Background circle - dark blue gradient effect
margin = size // 10
draw.ellipse([margin, margin, size-margin, size-margin],
fill=(25, 25, 112, 255), outline=(70, 130, 180, 255), width=2)
# Play button triangle
play_margin = size // 4
play_size = size - 2 * play_margin
points = [
(play_margin + play_size // 4, play_margin),
(play_margin + play_size // 4, play_margin + play_size),
(play_margin + 3 * play_size // 4, play_margin + play_size // 2)
]
draw.polygon(points, fill=(255, 255, 255, 255))
# Save image
img.save(filename, 'PNG')
print(f"Created icon: {filename} ({size}x{size})")
def create_adaptive_icon(filename, size):
"""Create adaptive icon (no background)"""
img = Image.new('RGBA', (size, size), (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
# Center play button
margin = size // 4
play_size = size - 2 * margin
points = [
(margin + play_size // 4, margin),
(margin + play_size // 4, margin + play_size),
(margin + 3 * play_size // 4, margin + play_size // 2)
]
draw.polygon(points, fill=(255, 255, 255, 255))
# Add decorative circle
circle_margin = size // 8
draw.ellipse([circle_margin, circle_margin, size-circle_margin, size-circle_margin],
fill=None, outline=(100, 149, 237, 255), width=3)
img.save(filename, 'PNG')
print(f"Created adaptive icon: {filename} ({size}x{size})")
def main():
# Define icon sizes and paths
icons = [
('app/src/main/res/mipmap-mdpi/ic_launcher.png', 48),
('app/src/main/res/mipmap-hdpi/ic_launcher.png', 72),
('app/src/main/res/mipmap-xhdpi/ic_launcher.png', 96),
('app/src/main/res/mipmap-xxhdpi/ic_launcher.png', 144),
('app/src/main/res/mipmap-xxxhdpi/ic_launcher.png', 192),
]
round_icons = [
('app/src/main/res/mipmap-mdpi/ic_launcher_round.png', 48),
('app/src/main/res/mipmap-hdpi/ic_launcher_round.png', 72),
('app/src/main/res/mipmap-xhdpi/ic_launcher_round.png', 96),
('app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png', 144),
('app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png', 192),
]
adaptive_icons = [
('app/src/main/res/drawable/ic_launcher_foreground.xml', 108), # Not using PIL for XML
]
print("Creating app icons...")
# Create regular icons
for filename, size in icons:
create_icon(size, filename)
# Create round icons
for filename, size in round_icons:
create_icon(size, filename)
# Create adaptive icon foreground
create_adaptive_icon('app/src/main/res/drawable/ic_launcher_foreground.png', 108)
print("All icons created successfully!")
if __name__ == "__main__":
main()

View File

@@ -1,420 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
==============================================================================
Licenses for included components:
------------------------------------------------------------------------------
Eclipse Public License 1.0
https://opensource.org/licenses/EPL-1.0
junit:junit
org.sonatype.aether:aether-api
org.sonatype.aether:aether-connector-wagon
org.sonatype.aether:aether-impl
org.sonatype.aether:aether-spi
org.sonatype.aether:aether-util
------------------------------------------------------------------------------
3-Clause BSD
https://opensource.org/licenses/BSD-3-Clause
com.google.code.findbugs:jsr305
org.hamcrest:hamcrest-core
BSD License
Copyright (c) 2000-2015 www.hamcrest.org
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer. Redistributions in binary form must reproduce
the above copyright notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
Neither the name of Hamcrest nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
com.esotericsoftware.kryo:kryo
com.esotericsoftware.minlog:minlog
Copyright (c) 2008-2018, Nathan Sweet All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Esoteric Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
org.ow2.asm:asm
org.ow2.asm:asm-analysis
org.ow2.asm:asm-commons
org.ow2.asm:asm-tree
org.ow2.asm:asm-util
ASM: a very small and fast Java bytecode manipulation framework
Copyright (c) 2000-2011 INRIA, France Telecom
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
MIT
com.googlecode.plist:dd-plist
dd-plist - An open source library to parse and generate property lists
Copyright (C) 2016 Daniel Dreibrodt
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.
org.bouncycastle:bcpg-jdk15on
org.bouncycastle:bcprov-jdk15on
Copyright (c) 2000 - 2019 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)
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.
org.slf4j:jcl-over-slf4j
org.slf4j:jul-to-slf4j
org.slf4j:log4j-over-slf4j
org.slf4j:slf4j-api
Copyright (c) 2004-2017 QOS.ch
All rights reserved.
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.
------------------------------------------------------------------------------
CDDL
https://opensource.org/licenses/CDDL-1.0
com.sun.xml.bind:jaxb-impl
------------------------------------------------------------------------------
LGPL 2.1
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
org.samba.jcifs:jcifs
org.jetbrains.intellij.deps:trove4j
------------------------------------------------------------------------------
License for the GNU Trove library included by the Kotlin embeddable compiler
------------------------------------------------------------------------------
The source code for GNU Trove is licensed under the Lesser GNU Public License (LGPL).
Copyright (c) 2001, Eric D. Friedman All Rights Reserved. This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Two classes (HashFunctions and PrimeFinder) included in Trove are licensed under the following terms:
Copyright (c) 1999 CERN - European Organization for Nuclear Research. Permission to use, copy, modify, distribute and sell this software
and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear in supporting documentation. CERN makes no representations about the
suitability of this software for any purpose. It is provided "as is" without expressed or implied warranty.
The source code of modified GNU Trove library is available at
https://github.com/JetBrains/intellij-deps-trove4j (with trove4j_changes.txt describing the changes)
------------------------------------------------------------------------------
Eclipse Distribution License 1.0
https://www.eclipse.org/org/documents/edl-v10.php
org.eclipse.jgit:org.eclipse.jgit
------------------------------------------------------------------------------
BSD-style
com.jcraft:jsch
com.jcraft:jzlib
Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
Eclipse Public License 2.0
https://www.eclipse.org/legal/epl-2.0/
org.junit.platform:junit-platform-launcher
------------------------------------------------------------------------------
Mozilla Public License 2.0
https://www.mozilla.org/en-US/MPL/2.0/
org.mozilla:rhino

View File

@@ -1,21 +0,0 @@
=========================================================================
== NOTICE file corresponding to the section 4 d of ==
== the Apache License, Version 2.0, ==
== in this case for the Gradle distribution. ==
=========================================================================
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
It includes the following other software:
Groovy (http://groovy-lang.org)
SLF4J (http://www.slf4j.org)
JUnit (http://www.junit.org)
JCIFS (http://jcifs.samba.org)
HttpClient (https://hc.apache.org/httpcomponents-client-4.5.x/)
For licenses, see the LICENSE file.
If any software distributed with Gradle does not have an Apache 2 License, its license is explicitly listed in the
LICENSE file.

View File

@@ -1,11 +0,0 @@
Gradle is a build tool with a focus on build automation and support for multi-language development. If you are building, testing, publishing, and deploying software on any platform, Gradle offers a flexible model that can support the entire development lifecycle from compiling and packaging code to publishing web sites. Gradle has been designed to support build automation across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is closely integrated with development tools and continuous integration servers including Eclipse, IntelliJ, and Jenkins.
For more information about Gradle, please visit: https://gradle.org
If you are using the "all" distribution, the User Manual is included in your distribution.
If you are using the "bin" distribution, a copy of the User Manual is available on https://docs.gradle.org.
Typing `gradle help` prints the command line help.
Typing `gradle tasks` shows all the tasks of a Gradle build.

View File

@@ -1,248 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# 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 ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/lib/gradle-launcher-8.2.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
if ! command -v java >/dev/null 2>&1
then
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
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# 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"'" \"-javaagent:$APP_HOME/lib/agents/gradle-instrumentation-agent-8.2.jar\""
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.launcher.GradleMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@@ -1,92 +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=.
@rem This is normally unused
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" "-javaagent:%APP_HOME%/lib/agents/gradle-instrumentation-agent-8.2.jar"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 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%\lib\gradle-launcher-8.2.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.launcher.GradleMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 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!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1 +0,0 @@
You can add .gradle (e.g. test.gradle) init scripts to this directory. Each one is executed at the start of the build.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More