tweaks to first_boot.html -- hoping to test soon

This commit is contained in:
mcguirepr89
2022-02-02 10:48:48 -05:00
parent 7a4cc4bc70
commit a7aab7cb1d
5 changed files with 56 additions and 41 deletions
+8 -5
View File
@@ -1,3 +1,9 @@
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors',1);
?>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<style> <style>
/* Chrome, Safari, Edge, Opera */ /* Chrome, Safari, Edge, Opera */
@@ -107,7 +113,7 @@ input {
<body style="background-color: rgb(119, 196, 135);"> <body style="background-color: rgb(119, 196, 135);">
<div class="row"> <div class="row">
<div class="column first"> <div class="column first">
<form action="write_config.php" method="POST"> <form action="write_config.php" method="POST" name="normal">
<?php <?php
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) { if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt'); $config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
@@ -159,9 +165,7 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
<option value="labels_uk.txt">Ukrainian</option> <option value="labels_uk.txt">Ukrainian</option>
</select> </select>
<br><br> <br><br>
<button type="submit" class="block"><?php <button type="submit" name="normal" class="block"><?php
@session_start();
if(isset($_SESSION['success'])){ if(isset($_SESSION['success'])){
echo "Success!"; echo "Success!";
unset($_SESSION['success']); unset($_SESSION['success']);
@@ -179,5 +183,4 @@ if(isset($_SESSION['success'])){
</div> </div>
</div> </div>
</body> </body>
<input type="reset" form=">
+2 -2
View File
@@ -8,6 +8,6 @@ Location= [ Create a location name ]%0A
%0A%0A %0A%0A
Thank you so much!%0A Thank you so much!%0A
[ Your Name Here ] [ Your Name Here ]
%0A%0A
Disclaimer: By requesting this BirdWeather ID, I acknowledge that my location Disclaimer: By requesting this BirdWeather ID, I acknowledge that my location%0A
and recording data will be made public. and recording data will be made public.
-10
View File
@@ -1,10 +0,0 @@
Hi, Tim, and thank you so much for BirdWeather.com!
%0A%0A
Below is the information I would like to use to request a BirdWeather ID
%0A%0A
Latitude={{ LATITUDE }}%0A
Longitude={{ LONGITUDE }}%0A
Location= [ Create a location name ]%0A
%0A%0A
Thank you so much!%0A
[ Your Name Here ]
@@ -1,5 +1,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<style> <style>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
* { * {
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT', font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
' Calibri', 'Trebuchet MS', 'sans-serif'; ' Calibri', 'Trebuchet MS', 'sans-serif';
@@ -38,7 +49,7 @@ form {
padding:10px; padding:10px;
} }
h1, h2 { h1 {
margin-bottom:0px; margin-bottom:0px;
} }
@@ -74,22 +85,30 @@ input {
} }
</style> </style>
</head> </head>
<h1 style="text-align:center;">Welcome!</h1> <?php
<img class="center" alt="Can't Load Logo" src="../red-cardinal.png"/> if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
} ?>
<h1 style="float:top;text-align:center;">Welcome!</h1>
<img class="center" alt="Can't Load Logo" src="../images/red-cardinal.png"/>
<body style="background-color: rgb(119, 196, 135);"> <body style="background-color: rgb(119, 196, 135);">
<form action="write_config.php" method="POST"> <form action="write_config.php" method="POST" name="firstboot">
<p style="font-size:large">Thank you for installing BirdNET-Pi! <p style="font-size:large">Thank you for installing BirdNET-Pi!
to get started, fill out the Required sections below.</p> to get started, fill out the Required sections below.</p>
<h2>Required</h2> <h2>Required</h2>
<label for="latitude">Latitude: </label> <label for="latitude">Latitude: </label>
<input name="latitude" type="text" value="" required/><br> <input name="latitude" type="number" min="-90" max="90" step="0.0001" value="<?php print($config['LATITUDE']);?>" required/><br>
<label for="longitude">Longitude: </label> <label for="longitude">Longitude: </label>
<input name="longitude" type="text" value="" required/><br> <input name="longitude" type="number" min="-180" max="180" step="0.0001" value="<?php print($config['LONGITUDE']);?>" required/><br>
<h2>Optional Services</h2> <h2>Optional Services</h2>
<p>The services below are not required, but they are pretty cool.</p> <p>The services below are not required, but they are pretty cool.</p>
<label for="birdweather_id">BirdWeather ID: </label> <label for="birdweather_id">BirdWeather ID: </label>
<input name="birdweather_id" type="text" value="" /><br> <input name="birdweather_id" type="text" value="<?php print($config['BIRDWEATHER_ID']);?>" /><br>
<p>app.BirdWeather.com is a weather map for bird sounds. Stations around the world supply audio and video streams to BirdWeather where they are then analyzed by BirdNET and compared to eBird Grid data. BirdWeather catalogues the detections and visualizations so that you can listen to, view, and read about the birds in various regions across the globe! Pretty cool!</p> <p>app.BirdWeather.com is a weather map for bird sounds. Stations around the world supply audio and video streams to BirdWeather where they are then analyzed by BirdNET and compared to eBird Grid data. BirdWeather catalogues the detections and visualizations so that you can listen to, view, and read about the birds in various regions across the globe! Pretty cool! <a href="mailto:tim@birdweather.com?subject=Request%20BirdWeather%20ID&body=<?php include('birdweather_request.php'); ?>" target="top">Email Tim</a> to request a BirdWeather ID</p>
<label for="pushed_app_key">Pushed App Key: </label> <label for="pushed_app_key">Pushed App Key: </label>
<input name="pushed_app_key" type="text" value="" /><br> <input name="pushed_app_key" type="text" value="" /><br>
<label for="pushed_app_secret">Pushed App Secret: </label> <label for="pushed_app_secret">Pushed App Secret: </label>
@@ -97,7 +116,7 @@ input {
<p>Pushed.co is used to offer New Species notifications. Sorry Android users, but the Pushed.co Application is only for iOS.</p> <p>Pushed.co is used to offer New Species notifications. Sorry Android users, but the Pushed.co Application is only for iOS.</p>
<label for="language">Database Language: </label> <label for="language">Database Language: </label>
<select name="language"> <select name="language">
<option value="none">Select your language</option> <option value="none">English</option>
<option value="labels_af.txt">Afrikaans</option> <option value="labels_af.txt">Afrikaans</option>
<option value="labels_ca.txt">Catalan</option> <option value="labels_ca.txt">Catalan</option>
<option value="labels_cs.txt">Czech</option> <option value="labels_cs.txt">Czech</option>
@@ -105,7 +124,6 @@ input {
<option value="labels_hr.txt">Croatian</option> <option value="labels_hr.txt">Croatian</option>
<option value="labels_da.txt">Danish</option> <option value="labels_da.txt">Danish</option>
<option value="labels_nl.txt">Dutch</option> <option value="labels_nl.txt">Dutch</option>
<option value="labels_en.txt">English</option>
<option value="labels_et.txt">Estonian</option> <option value="labels_et.txt">Estonian</option>
<option value="labels_fi.txt">Finnish</option> <option value="labels_fi.txt">Finnish</option>
<option value="labels_fr.txt">French</option> <option value="labels_fr.txt">French</option>
@@ -131,6 +149,6 @@ input {
<br><br> <br><br>
</body> </body>
<footer> <footer>
<button type="submit" class="block">I Am Finished!</button> <button type="submit" name"firstboot" class="block">I Am Finished!</button>
</footer> </footer>
</form> </form>
+14 -10
View File
@@ -1,4 +1,7 @@
<?php <?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$latitude = $_POST["latitude"]; $latitude = $_POST["latitude"];
$longitude = $_POST["longitude"]; $longitude = $_POST["longitude"];
$birdweather_id = $_POST["birdweather_id"]; $birdweather_id = $_POST["birdweather_id"];
@@ -23,23 +26,24 @@ $fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w"); $fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
fwrite($fh, $contents); fwrite($fh, $contents);
fwrite($fh2, $contents2); fwrite($fh2, $contents2);
@session_start(); session_start();
if(true){
$_SESSION['success'] = 1; $_SESSION['success'] = 1;
header("Location:config.php"); if(isset($_POST["normal"])){
header('Location:config.php');
}else{
header('Location:../../');
} }
$language = $_POST["language"]; $language = $_POST["language"];
if ($language != "none"){ if ($language != "none"){
$command = "sudo -upi set -x; sudo -upi mv /home/pi/BirdNET-Pi/model/labels.txt /home/pi/BirdNET-Pi/model/labels.txt.old && sudo -upi unzip /home/pi/BirdNET-Pi/model/labels_l18n.zip $language -d /home/pi/BirdNET-Pi/model && sudo -upi mv /home/pi/BirdNET-Pi/model/$language /home/pi/BirdNET-Pi/model/labels.txt"; $command = "sudo -upi mv /home/pi/BirdNET-Pi/model/labels.txt /home/pi/BirdNET-Pi/model/labels.txt.old && sudo -upi unzip /home/pi/BirdNET-Pi/model/labels_l18n.zip $language -d /home/pi/BirdNET-Pi/model && sudo -upi mv /home/pi/BirdNET-Pi/model/$language /home/pi/BirdNET-Pi/model/labels.txt";
$command_output = `$command`; $command_output = `$command`;
echo $command_output; session_start();
@session_start();
if(true){
$_SESSION['success'] = 1; $_SESSION['success'] = 1;
header("Location:config.php"); if(isset($_POST["normal"])){
header('Location:config.php');
}else{
header('Location:../../');
} }
} }
?> ?>