commit 6f597ae889cdf0dcbd7bab70eb2bfeb796b9f740 Author: supercodeur Date: Sat May 24 20:12:35 2025 +0200 Let's start diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..272296c --- /dev/null +++ b/.drone.yml @@ -0,0 +1,171 @@ +kind: pipeline +type: docker +name: deploy-static-site + +steps: + - name: deploy public_html + image: alpine:3.20 + volumes: + - name: ididit + path: /var/www/ididit + commands: + - | + if [ -d public_html ] && [ "$(ls -A public_html)" ]; then + target="/var/www/ididit/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}" + echo "Déploiement vers $target" + rm -rf "$target" + mkdir -p "$target" + cp -r public_html/* "$target/" + echo "Déploiement terminé." + ls -alh "$target" + else + echo "Aucun dossier public_html à déployer." + fi + when: + branch: + - main + event: + - push + + - name: build-linux + image: ghcr.io/cirruslabs/flutter:latest + volumes: + - name: ididit + path: /var/www/ididit + commands: + - apt-get update && apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev tar + - VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}') + - | + if [ -d linux ]; then + echo "Build Linux..." + flutter pub get + flutter build linux --release + TARGET="/var/www/ididit/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/releases/$VERSION/linux" + mkdir -p "$TARGET" + tar czf "$TARGET/linux-$VERSION.tgz" -C build/linux/x64/release/bundle . + echo "Linux bundle published as $TARGET/linux-$VERSION.tgz" + else + echo "No linux/ directory, skipping." + fi + + - name: build-android + image: ghcr.io/cirruslabs/flutter:latest + volumes: + - name: ididit + path: /var/www/ididit + environment: + ANDROID_HOME: /opt/android-sdk + commands: + - VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}') + - | + if [ -d android ]; then + echo "Build Android..." + flutter pub get + flutter build apk --release + TARGET="/var/www/ididit/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/releases/$VERSION/android" + mkdir -p "$TARGET" + cp build/app/outputs/flutter-apk/app-release.apk "$TARGET/$DRONE_REPO_NAME-$VERSION.apk" + echo "Android build published to $TARGET" + else + echo "No android/ directory, skipping." + fi + + - name: build-web + image: ghcr.io/cirruslabs/flutter:latest + volumes: + - name: ididit + path: /var/www/ididit + commands: + - apt-get update && apt-get install -y tar + - VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}') + - | + if [ -d web ]; then + echo "Build Web..." + flutter pub get + flutter build web --release + TARGET="/var/www/ididit/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/releases/$VERSION/web" + mkdir -p "$TARGET" + tar czf "$TARGET/web-$VERSION.tgz" -C build/web . + echo "Web bundle published as $TARGET/web-$VERSION.tgz" + else + echo "No web/ directory, skipping." + fi + + - name: generate-versions-html + image: alpine:3.20 + volumes: + - name: ididit + path: /var/www/ididit + commands: + - OWNER="$DRONE_REPO_OWNER" + - REPO="$DRONE_REPO_NAME" + - RELEASES_DIR="/var/www/ididit/$OWNER/$REPO/releases" + - REPO_URL="https://gitea.bymycode.com/$OWNER/$REPO" + - | + HTML="$RELEASES_DIR/index.html" + echo '' > "$HTML" + echo '' >> "$HTML" + echo '' >> "$HTML" + echo ' ' >> "$HTML" + echo " Versions disponibles pour $REPO" >> "$HTML" + echo ' ' >> "$HTML" + echo '' >> "$HTML" + echo '' >> "$HTML" + echo "

Versions disponibles pour $REPO

" >> "$HTML" + echo "
" >> "$HTML" + echo " 📦 Voir le repository sur gitea.ByMyCode.com" >> "$HTML" + echo "
" >> "$HTML" + echo "
" >> "$HTML" + for version_dir in $(ls -1 "$RELEASES_DIR" | sort -Vr); do + if [ -d "$RELEASES_DIR/$version_dir" ]; then + echo "

Version $version_dir

" >> "$HTML" + # Linux bundle + if [ -f "$RELEASES_DIR/$version_dir/linux/linux-$version_dir.tgz" ]; then + echo "" >> "$HTML" + fi + # Android + if [ -d "$RELEASES_DIR/$version_dir/android" ]; then + for f in "$RELEASES_DIR/$version_dir/android/"*; do + fname=$(basename "$f") + echo "" >> "$HTML" + done + fi + # Web bundle + if [ -f "$RELEASES_DIR/$version_dir/web/web-$version_dir.tgz" ]; then + echo "" >> "$HTML" + fi + echo "
" >> "$HTML" + fi + done + echo "" >> "$HTML" + echo "" >> "$HTML" + echo "" >> "$HTML" + echo "Fichier versions.html généré dans $HTML" + + - name: list-published + image: alpine:3.20 + volumes: + - name: ididit + path: /var/www/ididit + commands: + - ls -alR /var/www/ididit/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/releases || echo "No releases published." + +volumes: + - name: ididit + host: + path: /var/www/ididit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79c113f --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..e8f7bf9 --- /dev/null +++ b/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "ea121f8859e4b13e47a8f845e4586164519588bc" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: android + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: ios + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: linux + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: macos + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: web + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: windows + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d2cb98 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# monitor2 + +Because the first one were fucked up. + +Monitors URLs you need. + +## Getting Started + +All you need is flutter. Enjoy. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..a32fe8a --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.bymycode.supercodeur.monitor2" + compileSdk = flutter.compileSdkVersion + ndkVersion = "27.0.12077973" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.bymycode.supercodeur.monitor2" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..974d02f --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/monitor2/MainActivity.kt b/android/app/src/main/kotlin/com/example/monitor2/MainActivity.kt new file mode 100644 index 0000000..ec9f050 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/monitor2/MainActivity.kt @@ -0,0 +1,5 @@ +package com.bymycode.supercodeur.monitor2 + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..5f682ea Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..03ed01a Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..0dad5a0 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..ffbbc71 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..26ea5c7 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..89176ef --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,21 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..f018a61 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..afa1e8e --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..a439442 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.0" apply false + id("org.jetbrains.kotlin.android") version "1.8.22" apply false +} + +include(":app") diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000..85d1b38 Binary files /dev/null and b/assets/icon.png differ diff --git a/lib/homepage/dialog_addsite.dart b/lib/homepage/dialog_addsite.dart new file mode 100644 index 0000000..b681ab5 --- /dev/null +++ b/lib/homepage/dialog_addsite.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +class AddSiteDialog extends StatefulWidget { + const AddSiteDialog({super.key}); + + @override + State createState() => _AddSiteDialogState(); +} + +class _AddSiteDialogState extends State { + final controller = TextEditingController(); + + @override + Widget build(BuildContext context) { + return AlertDialog( + title: Text('Ajouter une URL'), + content: TextField( + controller: controller, + decoration: InputDecoration(hintText: 'https://exemple.com'), + autofocus: true, + ), + actions: [ + TextButton( + child: Text('Annuler'), + onPressed: () => Navigator.pop(context), + ), + ElevatedButton( + child: Text('Ajouter'), + onPressed: () => Navigator.pop(context, controller.text.trim()), + ), + ], + ); + } +} diff --git a/lib/homepage/screen_homepage.dart b/lib/homepage/screen_homepage.dart new file mode 100644 index 0000000..b593c2a --- /dev/null +++ b/lib/homepage/screen_homepage.dart @@ -0,0 +1,117 @@ +import 'package:flutter/material.dart'; +import '../log/screen_logspage.dart'; +import '../log/class_sitecheck.dart'; +import '../log/class_sitelog.dart'; +import 'dialog_addsite.dart'; + +class HomePage extends StatelessWidget { + final List sites; + final List logs; + final Function(String) addSite; + final Function(int) removeSite; + final VoidCallback forceCheck; + final bool isChecking; + + const HomePage({ + super.key, + required this.sites, + required this.logs, + required this.addSite, + required this.removeSite, + required this.forceCheck, + required this.isChecking, + }); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('🌐 Surveillance de sites'), + actions: [ + IconButton( + icon: Icon(Icons.list_alt), + tooltip: 'Voir tous les logs', + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (_) => LogsPage(logs: logs)), + ); + }, + ), + IconButton( + icon: + isChecking + ? SizedBox( + width: 24, + height: 24, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 3, + ), + ) + : Icon(Icons.refresh), + tooltip: + isChecking ? 'Vérification en cours...' : 'Forcer les tests', + onPressed: isChecking ? null : forceCheck, + ), + ], + ), + body: ListView.builder( + itemCount: sites.length, + itemBuilder: (context, index) { + final site = sites[index]; + final lastLog = logs.lastWhere( + (l) => l.url == site.url, + orElse: () => SiteLog(DateTime.now(), site.url, 0), + ); + final isOk = lastLog.statusCode == 200; + return Card( + child: ListTile( + leading: Text(isOk ? '✅' : '❌', style: TextStyle(fontSize: 24)), + title: Text(site.url), + subtitle: + lastLog.statusCode == 0 + ? Text('Aucune vérification') + : Text( + isOk ? 'OK' : 'Erreur: ${lastLog.statusCode}', + style: TextStyle( + color: isOk ? Colors.black : Colors.red.withAlpha(10), + fontWeight: + isOk ? FontWeight.normal : FontWeight.bold, + ), + ), + tileColor: isOk ? null : Colors.red.withAlpha(10), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (_) => LogsPage( + logs: logs.where((l) => l.url == site.url).toList(), + ), + ), + ); + }, + trailing: IconButton( + icon: Icon(Icons.delete, color: Colors.grey), + onPressed: () => removeSite(index), + ), + ), + ); + }, + ), + floatingActionButton: FloatingActionButton( + child: Text('➕', style: TextStyle(fontSize: 24)), + onPressed: () async { + final url = await showDialog( + context: context, + builder: (context) => AddSiteDialog(), + ); + if (url != null && url.isNotEmpty) { + addSite(url); + } + }, + ), + ); + } +} diff --git a/lib/kill_switch/screen_killswitch.dart b/lib/kill_switch/screen_killswitch.dart new file mode 100644 index 0000000..ebc1684 --- /dev/null +++ b/lib/kill_switch/screen_killswitch.dart @@ -0,0 +1,191 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import '../monitor/monitor2app.dart'; +import 'package:url_launcher/url_launcher.dart'; + +const String securityURL = + "https://ididit.bymycode.com/supercodeur/monitor2/isSoftwareActive_1.0.0.txt"; + +class KillSwitchHomePage extends StatefulWidget { + const KillSwitchHomePage({super.key}); + + @override + KillSwitchHomePageState createState() => KillSwitchHomePageState(); +} + +class KillSwitchHomePageState extends State { + String _message = "Vérification de l'état..."; + bool _isLoading = true; + + @override + void initState() { + super.initState(); + _checkStatus(); + } + + Future _checkStatus() async { + setState(() { + _isLoading = true; + _message = "Vérification de l'état..."; + }); + + try { + final response = await http.get(Uri.parse(securityURL)); + + if (!mounted) return; + + if (response.statusCode >= 200 && response.statusCode < 300) { + final data = response.body; + if (data.contains('active: true')) { + setState(() { + _isLoading = false; + _message = "Application active, c'est parti..."; + }); + if (!mounted) return; + await Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => const Monitor2App()), + ); + } else { + _updateMessage("L'application est désormais bloquée."); + } + } else if (response.statusCode >= 400 && response.statusCode < 500) { + _updateMessage("Veuillez mettre à jour l'application."); + } else { + _showNetworkError(); + } + } catch (e) { + _showNetworkError(); + } finally { + if (mounted) { + setState(() { + _isLoading = false; + }); + } + } + } + + void _showNetworkError() { + setState(() { + _message = + "Une connexion réseau est nécessaire pour accéder à l'application."; + _isLoading = false; + }); + + Timer(const Duration(seconds: 5), () { + setState(() { + _isLoading = true; + _checkStatus(); + }); + }); + } + + void _updateMessage(String message) { + setState(() { + _message = message; + _isLoading = false; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Initialisation')), + body: Center( + child: + _isLoading + ? const CircularProgressIndicator() + : Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'TourPet', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.teal, + ), + ), + Text(_message, textAlign: TextAlign.center), + const SizedBox(height: 20), + Image.asset( + 'assets/icon.png', + width: MediaQuery.of(context).size.width * 0.25, + fit: BoxFit.contain, + ), + const SizedBox(height: 20), + Text( + 'Copyright (c) 2025 SuperCodeur', + style: TextStyle(fontSize: 14, color: Colors.grey[600]), + ), + const SizedBox(height: 10), + GestureDetector( + onTap: + () => + _launchEmail('cgifl300+supercodeur@gmail.com'), + child: const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('✉️ ', style: TextStyle(fontSize: 18)), + Text( + 'cgifl300+supercodeur@gmail.com', + style: TextStyle( + color: Colors.blue, + fontSize: 14, + decoration: TextDecoration.underline, + ), + ), + ], + ), + ), + const SizedBox(height: 10), + GestureDetector( + onTap: + () => _launchUrl( + 'https://ididit.bymycode.com/supercodeur/monitor2/', + ), + child: const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('🌐 ', style: TextStyle(fontSize: 18)), + Text( + 'Visiter le site du projet', + style: TextStyle( + color: Colors.blue, + fontSize: 14, + decoration: TextDecoration.underline, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + Future _launchUrl(String url) async { + final Uri uri = Uri.parse(url); + if (!await launchUrl(uri, mode: LaunchMode.externalApplication)) { + throw Exception('Could not launch $url'); + } + } + + void _launchEmail(String email) async { + final Uri emailUri = Uri( + scheme: 'mailto', + path: email, + queryParameters: {'subject': 'Hello', 'body': 'Test'}, + ); + if (await canLaunchUrl(emailUri)) { + await launchUrl(emailUri); + } else { + throw 'Could not launch email client'; + } + } +} diff --git a/lib/log/class_sitecheck.dart b/lib/log/class_sitecheck.dart new file mode 100644 index 0000000..5663801 --- /dev/null +++ b/lib/log/class_sitecheck.dart @@ -0,0 +1,7 @@ +class SiteCheck { + final String url; + SiteCheck(this.url); + + String toLine() => url; + static SiteCheck fromLine(String line) => SiteCheck(line); +} diff --git a/lib/log/class_sitelog.dart b/lib/log/class_sitelog.dart new file mode 100644 index 0000000..e4f294a --- /dev/null +++ b/lib/log/class_sitelog.dart @@ -0,0 +1,14 @@ +class SiteLog { + final DateTime date; + final String url; + final int statusCode; + + SiteLog(this.date, this.url, this.statusCode); + + String toCsv() => '${date.toIso8601String()},$url,$statusCode'; + + static SiteLog fromCsv(String line) { + final parts = line.split(','); + return SiteLog(DateTime.parse(parts[0]), parts[1], int.parse(parts[2])); + } +} diff --git a/lib/log/screen_logspage.dart b/lib/log/screen_logspage.dart new file mode 100644 index 0000000..9dad0bb --- /dev/null +++ b/lib/log/screen_logspage.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:monitor2/log/class_sitelog.dart'; + +class LogsPage extends StatefulWidget { + final List logs; + + const LogsPage({super.key, required this.logs}); + + @override + State createState() => _LogsPageState(); +} + +class _LogsPageState extends State { + String sortBy = 'date'; + + @override + Widget build(BuildContext context) { + final logs = List.of(widget.logs); + if (sortBy == 'date') { + logs.sort((a, b) => b.date.compareTo(a.date)); + } else { + logs.sort((a, b) => a.statusCode.compareTo(b.statusCode)); + } + + return Scaffold( + appBar: AppBar( + title: Text('📝 Logs'), + actions: [ + PopupMenuButton( + onSelected: (value) => setState(() => sortBy = value), + itemBuilder: + (context) => [ + PopupMenuItem(value: 'date', child: Text('Trier par date')), + PopupMenuItem( + value: 'status', + child: Text('Trier par statut'), + ), + ], + ), + ], + ), + body: ListView.builder( + itemCount: logs.length, + itemBuilder: (context, index) { + final log = logs[index]; + final isOk = log.statusCode == 200; + return ListTile( + leading: Text(isOk ? '🟢' : '🔴', style: TextStyle(fontSize: 20)), + title: Text(log.url), + subtitle: Text( + '${log.date.toLocal()} - ' + '${isOk ? 'OK' : 'Erreur: ${log.statusCode == -1 ? 'Timeout/Network' : log.statusCode}'}', + ), + tileColor: isOk ? null : Colors.red.withAlpha(10), + ); + }, + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..0d256de --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,6 @@ +import 'package:flutter/material.dart'; +import 'monitor/monitor2app.dart'; + +void main() { + runApp(Monitor2App()); +} diff --git a/lib/monitor/monitor2app.dart b/lib/monitor/monitor2app.dart new file mode 100644 index 0000000..951b699 --- /dev/null +++ b/lib/monitor/monitor2app.dart @@ -0,0 +1,175 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'package:path_provider/path_provider.dart'; +import '../homepage/screen_homepage.dart'; +import '../log/class_sitecheck.dart'; +import '../log/class_sitelog.dart'; + +class Monitor2App extends StatefulWidget { + const Monitor2App({super.key}); + + @override + State createState() => Monitor2AppState(); +} + +class Monitor2AppState extends State { + List sites = []; + List logs = []; + Timer? timer; + bool isChecking = false; + + final GlobalKey messengerKey = + GlobalKey(); + + @override + void initState() { + super.initState(); + loadSites().then((_) { + loadLogs().then((_) { + setState(() {}); + checkAllSites(); + timer = Timer.periodic( + const Duration(hours: 1), + (_) => checkAllSites(), + ); + }); + }); + } + + @override + void dispose() { + timer?.cancel(); + super.dispose(); + } + + Future getLogFile() async { + final dir = await getApplicationDocumentsDirectory(); + return File('${dir.path}/logs.dat'); + } + + Future getSitesFile() async { + final dir = await getApplicationDocumentsDirectory(); + return File('${dir.path}/sites.dat'); + } + + Future loadLogs() async { + try { + final file = await getLogFile(); + if (await file.exists()) { + final lines = await file.readAsLines(); + logs = lines.map((l) => SiteLog.fromCsv(l)).toList(); + } + } catch (_) {} + } + + Future saveLogs() async { + final file = await getLogFile(); + final lastLogs = + logs.length > 10000 ? logs.sublist(logs.length - 10000) : logs; + await file.writeAsString(lastLogs.map((l) => l.toCsv()).join('\n')); + } + + Future loadSites() async { + try { + final file = await getSitesFile(); + if (await file.exists()) { + final lines = await file.readAsLines(); + sites = lines.map((l) => SiteCheck.fromLine(l)).toList(); + } else { + sites = [ + SiteCheck('https://flutter.dev'), + SiteCheck('https://google.com'), + ]; + await saveSites(); + } + } catch (_) { + sites = [ + SiteCheck('https://flutter.dev'), + SiteCheck('https://google.com'), + ]; + await saveSites(); + } + } + + Future saveSites() async { + final file = await getSitesFile(); + final lastSites = + sites.length > 100 ? sites.sublist(sites.length - 100) : sites; + await file.writeAsString(lastSites.map((s) => s.toLine()).join('\n')); + } + + Future checkAllSites({bool showSnackBar = false}) async { + if (isChecking) return; + setState(() { + isChecking = true; + }); + + for (var site in sites) { + try { + final response = await http + .get(Uri.parse(site.url)) + .timeout(const Duration(seconds: 10)); + addLog(site.url, response.statusCode); + } catch (e) { + addLog(site.url, -1); + } + } + + setState(() { + isChecking = false; + }); + + if (showSnackBar) { + messengerKey.currentState?.showSnackBar( + const SnackBar(content: Text('Vérification des sites terminée ✅')), + ); + } + } + + void addLog(String url, int statusCode) { + logs.add(SiteLog(DateTime.now(), url, statusCode)); + if (logs.length > 10000) { + logs = logs.sublist(logs.length - 10000); + } + saveLogs(); + } + + void addSite(String url) async { + if (sites.length >= 100) { + messengerKey.currentState?.showSnackBar( + const SnackBar(content: Text('Limite de 100 sites atteinte 🚫')), + ); + return; + } + setState(() { + sites.add(SiteCheck(url)); + }); + await saveSites(); + } + + void removeSite(int index) async { + setState(() { + sites.removeAt(index); + }); + await saveSites(); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + scaffoldMessengerKey: messengerKey, + title: 'Surveillance de sites', + theme: ThemeData(primarySwatch: Colors.blue), + home: HomePage( + sites: sites, + logs: logs, + addSite: addSite, + removeSite: removeSite, + forceCheck: () => checkAllSites(showSnackBar: true), + isChecking: isChecking, + ), + ); + } +} diff --git a/public_html/index.html b/public_html/index.html new file mode 100644 index 0000000..2e0c8e0 --- /dev/null +++ b/public_html/index.html @@ -0,0 +1,147 @@ + + + + + 🌐 monitor2 – Surveillance d'URL + + + + +
+

🌐 monitor2 🔎

+

Surveillez la disponibilité de vos URL favorites, simplement et efficacement ! 🚦

+
+
+
+

✨ À propos du projet

+
    +
  • 🕒 Vérifie automatiquement la disponibilité de vos URL toutes les heures.
  • +
  • 📱 Fonctionne directement sur votre téléphone, sans serveur externe.
  • +
  • 📝 Enregistre des logs localement pour chaque vérification.
  • +
  • 🔒 Respecte votre vie privée : aucune donnée transmise en dehors de votre appareil.
  • +
+
+ +
+

🔗 Ressources du projet

+ +
+
+
+ Fait avec ❤️ par SuperCodeur  |  Projet open-source – 2025 +
+ + diff --git a/public_html/isSoftwareActive_1.0.0.txt b/public_html/isSoftwareActive_1.0.0.txt new file mode 100644 index 0000000..8bc0d5e --- /dev/null +++ b/public_html/isSoftwareActive_1.0.0.txt @@ -0,0 +1 @@ +active: true \ No newline at end of file diff --git a/public_html/releases/index.html b/public_html/releases/index.html new file mode 100644 index 0000000..14b324c --- /dev/null +++ b/public_html/releases/index.html @@ -0,0 +1,130 @@ + + + + + monitor2 – En construction 🏗️ + + + + +
+

monitor2 🏗️

+
🚧⏳🕒
+
+ Ce projet est actuellement en construction.
+ Le téléchargement sera bientôt disponible ! +
+
+ Merci de votre patience 😊
+ Prenez un café ☕ ou rafraîchissez la page plus tard ! +
+
+
+
+ ⬅️ Retour à la racine du projet +
+
+ monitor2 – ByMyCode.com
+ Dernière mise à jour : 2025 +
+ + + diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..3c2e43c --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,490 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.dev" + source: hosted + version: "4.0.7" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_launcher_icons: + dependency: "direct main" + description: + name: flutter_launcher_icons + sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" + url: "https://pub.dev" + source: hosted + version: "0.13.1" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: "direct main" + description: + name: http + sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" + url: "https://pub.dev" + source: hosted + version: "4.5.4" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + url: "https://pub.dev" + source: hosted + version: "10.0.9" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" + source: hosted + version: "3.0.9" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9 + url: "https://pub.dev" + source: hosted + version: "2.2.17" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" + source: hosted + version: "0.7.4" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" + url: "https://pub.dev" + source: hosted + version: "6.3.1" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "8582d7f6fe14d2652b4c45c9b6c14c0b678c2af2d083a11b604caeba51930d79" + url: "https://pub.dev" + source: hosted + version: "6.3.16" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb" + url: "https://pub.dev" + source: hosted + version: "6.3.3" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" + url: "https://pub.dev" + source: hosted + version: "3.2.2" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + url: "https://pub.dev" + source: hosted + version: "15.0.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.7.2 <4.0.0" + flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..0b55fa4 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,96 @@ +name: monitor2 +description: "Monitor your URLs" +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0 + +environment: + sdk: ^3.7.2 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + http: ^1.2.1 + path_provider: ^2.1.2 + flutter_launcher_icons: ^0.13.1 + url_launcher: ^6.0.20 + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package +flutter_icons: + android: true + image_path: "assets/icon.png" \ No newline at end of file diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..0fe4907 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,29 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:monitor2/monitor/monitor2app.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const Monitor2App()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}