[VERSION CONTROL] - Add the killswitch
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6f597ae889
commit
822418fe54
@ -39,19 +39,19 @@ class HomePage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon:
|
icon: isChecking
|
||||||
isChecking
|
? SizedBox(
|
||||||
? SizedBox(
|
width: 24,
|
||||||
width: 24,
|
height: 24,
|
||||||
height: 24,
|
child: CircularProgressIndicator(
|
||||||
child: CircularProgressIndicator(
|
color: Colors.white,
|
||||||
color: Colors.white,
|
strokeWidth: 3,
|
||||||
strokeWidth: 3,
|
),
|
||||||
),
|
)
|
||||||
)
|
: Icon(Icons.refresh),
|
||||||
: Icon(Icons.refresh),
|
tooltip: isChecking
|
||||||
tooltip:
|
? 'Vérification en cours...'
|
||||||
isChecking ? 'Vérification en cours...' : 'Forcer les tests',
|
: 'Forcer les tests',
|
||||||
onPressed: isChecking ? null : forceCheck,
|
onPressed: isChecking ? null : forceCheck,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -69,26 +69,23 @@ class HomePage extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: Text(isOk ? '✅' : '❌', style: TextStyle(fontSize: 24)),
|
leading: Text(isOk ? '✅' : '❌', style: TextStyle(fontSize: 24)),
|
||||||
title: Text(site.url),
|
title: Text(site.url),
|
||||||
subtitle:
|
subtitle: lastLog.statusCode == 0
|
||||||
lastLog.statusCode == 0
|
? Text('Aucune vérification')
|
||||||
? Text('Aucune vérification')
|
: Text(
|
||||||
: Text(
|
isOk ? 'OK' : 'Erreur: ${lastLog.statusCode}',
|
||||||
isOk ? 'OK' : 'Erreur: ${lastLog.statusCode}',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
color: isOk ? Colors.black : Colors.red.withAlpha(10),
|
||||||
color: isOk ? Colors.black : Colors.red.withAlpha(10),
|
fontWeight: isOk ? FontWeight.normal : FontWeight.bold,
|
||||||
fontWeight:
|
|
||||||
isOk ? FontWeight.normal : FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
tileColor: isOk ? null : Colors.red.withAlpha(10),
|
tileColor: isOk ? null : Colors.red.withAlpha(10),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder:
|
builder: (_) => LogsPage(
|
||||||
(_) => LogsPage(
|
logs: logs.where((l) => l.url == site.url).toList(),
|
||||||
logs: logs.where((l) => l.url == site.url).toList(),
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@ import '../monitor/monitor2app.dart';
|
|||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
const String securityURL =
|
const String securityURL =
|
||||||
"https://ididit.bymycode.com/supercodeur/monitor2/isSoftwareActive_1.0.0.txt";
|
"https://ididit.bymycode.com/supercodeur/monitor2/isSoftwareActive_.0.0.txt";
|
||||||
|
|
||||||
class KillSwitchHomePage extends StatefulWidget {
|
class KillSwitchHomePage extends StatefulWidget {
|
||||||
const KillSwitchHomePage({super.key});
|
const KillSwitchHomePage({super.key});
|
||||||
@ -93,78 +93,75 @@ class KillSwitchHomePageState extends State<KillSwitchHomePage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Initialisation')),
|
appBar: AppBar(title: const Text('Initialisation')),
|
||||||
body: Center(
|
body: Center(
|
||||||
child:
|
child: _isLoading
|
||||||
_isLoading
|
? const CircularProgressIndicator()
|
||||||
? const CircularProgressIndicator()
|
: Padding(
|
||||||
: Padding(
|
padding: const EdgeInsets.all(16.0),
|
||||||
padding: const EdgeInsets.all(16.0),
|
child: Column(
|
||||||
child: Column(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
const Text(
|
||||||
const Text(
|
'Monitor2',
|
||||||
'TourPet',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 30,
|
||||||
fontSize: 30,
|
fontWeight: FontWeight.bold,
|
||||||
fontWeight: FontWeight.bold,
|
color: Colors.teal,
|
||||||
color: Colors.teal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(_message, textAlign: TextAlign.center),
|
),
|
||||||
const SizedBox(height: 20),
|
Text(_message, textAlign: TextAlign.center),
|
||||||
Image.asset(
|
const SizedBox(height: 20),
|
||||||
'assets/icon.png',
|
Image.asset(
|
||||||
width: MediaQuery.of(context).size.width * 0.25,
|
'assets/icon.png',
|
||||||
fit: BoxFit.contain,
|
width: MediaQuery.of(context).size.width * 0.25,
|
||||||
),
|
fit: BoxFit.contain,
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
Text(
|
const SizedBox(height: 20),
|
||||||
'Copyright (c) 2025 SuperCodeur',
|
Text(
|
||||||
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
|
'Copyright (c) 2025 SuperCodeur',
|
||||||
),
|
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
GestureDetector(
|
const SizedBox(height: 10),
|
||||||
onTap:
|
GestureDetector(
|
||||||
() =>
|
onTap: () =>
|
||||||
_launchEmail('cgifl300+supercodeur@gmail.com'),
|
_launchEmail('cgifl300+supercodeur@gmail.com'),
|
||||||
child: const Row(
|
child: const Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text('✉️ ', style: TextStyle(fontSize: 18)),
|
Text('✉️ ', style: TextStyle(fontSize: 18)),
|
||||||
Text(
|
Text(
|
||||||
'cgifl300+supercodeur@gmail.com',
|
'cgifl300+supercodeur@gmail.com',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
GestureDetector(
|
const SizedBox(height: 10),
|
||||||
onTap:
|
GestureDetector(
|
||||||
() => _launchUrl(
|
onTap: () => _launchUrl(
|
||||||
'https://ididit.bymycode.com/supercodeur/monitor2/',
|
'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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -28,14 +28,10 @@ class _LogsPageState extends State<LogsPage> {
|
|||||||
actions: [
|
actions: [
|
||||||
PopupMenuButton<String>(
|
PopupMenuButton<String>(
|
||||||
onSelected: (value) => setState(() => sortBy = value),
|
onSelected: (value) => setState(() => sortBy = value),
|
||||||
itemBuilder:
|
itemBuilder: (context) => [
|
||||||
(context) => [
|
PopupMenuItem(value: 'date', child: Text('Trier par date')),
|
||||||
PopupMenuItem(value: 'date', child: Text('Trier par date')),
|
PopupMenuItem(value: 'status', child: Text('Trier par statut')),
|
||||||
PopupMenuItem(
|
],
|
||||||
value: 'status',
|
|
||||||
child: Text('Trier par statut'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,6 +1,19 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'monitor/monitor2app.dart';
|
import 'kill_switch/screen_killswitch.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(Monitor2App());
|
runApp(const MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: 'Monitor2',
|
||||||
|
theme: ThemeData(primarySwatch: Colors.teal),
|
||||||
|
home: const KillSwitchHomePage(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,9 @@ class Monitor2AppState extends State<Monitor2App> {
|
|||||||
|
|
||||||
Future<void> saveLogs() async {
|
Future<void> saveLogs() async {
|
||||||
final file = await getLogFile();
|
final file = await getLogFile();
|
||||||
final lastLogs =
|
final lastLogs = logs.length > 10000
|
||||||
logs.length > 10000 ? logs.sublist(logs.length - 10000) : logs;
|
? logs.sublist(logs.length - 10000)
|
||||||
|
: logs;
|
||||||
await file.writeAsString(lastLogs.map((l) => l.toCsv()).join('\n'));
|
await file.writeAsString(lastLogs.map((l) => l.toCsv()).join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,8 +96,9 @@ class Monitor2AppState extends State<Monitor2App> {
|
|||||||
|
|
||||||
Future<void> saveSites() async {
|
Future<void> saveSites() async {
|
||||||
final file = await getSitesFile();
|
final file = await getSitesFile();
|
||||||
final lastSites =
|
final lastSites = sites.length > 100
|
||||||
sites.length > 100 ? sites.sublist(sites.length - 100) : sites;
|
? sites.sublist(sites.length - 100)
|
||||||
|
: sites;
|
||||||
await file.writeAsString(lastSites.map((s) => s.toLine()).join('\n'));
|
await file.writeAsString(lastSites.map((s) => s.toLine()).join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ flutter:
|
|||||||
# assets:
|
# assets:
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
# - images/a_dot_ham.jpeg
|
# - images/a_dot_ham.jpeg
|
||||||
|
assets:
|
||||||
|
- assets/icon.png
|
||||||
|
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/to/resolution-aware-images
|
# https://flutter.dev/to/resolution-aware-images
|
||||||
|
Loading…
x
Reference in New Issue
Block a user