Skip to content

Commit

Permalink
Update tools (#11)
Browse files Browse the repository at this point in the history
* util: added delete node from map

* util: add searchable node list

* workflows: do not lint 3rd party CSS and JavaScript libraries

* redesign index page to make it more useful
  • Loading branch information
Noki committed Jun 5, 2023
1 parent 102701d commit c4990cb
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ jobs:
# Change to 'master' if your main branch differs
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Do not lint 3rd party CSS and JavaScript libraries
FILTER_REGEX_EXCLUDE: .*/(css|javascript)/3rd-party/.*
1 change: 1 addition & 0 deletions www/css/3rd-party/jquery.dataTables.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions www/css/3rd-party/searchBuilder.dataTables.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions www/delete-node-from-map.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

// $node = 'example-host';
$node = is_string($_GET["name"]) ? $_GET["name"] : "";

if (empty($node)) {
echo "please provide a non empty node name";
} else {
// API URL
$url = 'http://api.openwifimap.net/update_node/' . $node . '.olsr';

// Create a new cURL resource
$ch = curl_init($url);

// Setup payload
$data = array(
"hostname" => $node
);
$payload = json_encode($data);

// Attach encoded JSON string to the POST fields
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

// Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
));

// Return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// set PUT method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

// Execute the PUT request
$result = curl_exec($ch);

// Close cURL resource
curl_close($ch);

// Output result
echo $result;
}
177 changes: 160 additions & 17 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,160 @@
<body>
<pre>
// https://util.berlin.freifunk.net/knoteninfo?knoten=Zwingli-Nord-2GHz&typ=wiki
// typ (optional): wiki, monitor, owm, hopglass

// https://util.berlin.freifunk.net/mapcenter?latlon=a,b&map=owm
// map: owm/osm/gmap

// https://util.berlin.freifunk.net/hardware?name=gl-ar150
// Berliner Firmware-Downloads

// http://util.berlin.freifunk.net/update_node/
// Berliner OWM-API-Endpoint (identisch zu api.openwifimap.net)
</pre>
Du kannst <a href="https://github.com/freifunk-berlin/util.berlin.freifunk.net">auf Github</a> zu dieser Software beitragen und &Auml;nderungen besprechen.
<br/>Infos zu diesem Server siehe Wiki-Artikel <a href="https://wiki.freifunk.net/Berlin:Server#util.berlin.freifunk.net">Berlin:Server</a>.
</body>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">

<title>Werkzeuge für Freifunk Berlin</title>
<meta name="description" content="Die Seite hält eine Sammlung nützlicher kleiner Werkzeuge für Freifunk Berlin bereit."/>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
max-width: 800px;
}

h2 {
margin-top: 40px;
margin-bottom: 10px;
}

p {
margin-top: 0;
}

code {
background-color: #f7f7f7;
padding: 10px;
border-radius: 5px;
font-size: 14px;
display: block;
margin-bottom: 10px;
}

form {
margin-bottom: 20px;
}

label {
display: inline-block;
width: 200px;
font-weight: bold;
}

input[type="text"],
select {
width: 200px;
padding: 5px;
margin-bottom: 10px;
}

input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-top: 10px;
cursor: pointer;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>Werkzeuge für Freifunk Berlin</h1>
<p>Die Seite hält eine Sammlung nützlicher kleiner Werkzeuge für Freifunk Berlin bereit.</p>

<h2>Knoteninfo</h2>
<p>Dieses Tool erlaubt es unter Eingabe des Knotennamens zu den zugehörigen Zielseiten im Wiki, Monitor, OWM und Hopglass zu springen, falls diese existieren.</p>
<code>
// https://util.berlin.freifunk.net/knoteninfo?knoten=zwingli-core&typ=wiki<br>
// knoten (string): name of the node<br>
// typ (enum, optional): wiki, monitor, owm, hopglass
</code>
<form action="https://util.berlin.freifunk.net/knoteninfo" method="GET" target="_blank">
<label for="knoten">Node Name:</label>
<input type="text" id="knoten" name="knoten" required>
<br>
<label for="typ">Type:</label>
<select id="typ" name="typ">
<option value="wiki">Wiki</option>
<option value="monitor">Monitor</option>
<option value="owm">OWM</option>
<option value="hopglass">Hopglass</option>
</select>
<br>
<input type="submit" value="Submit">
</form>
<h2>Durchsuchbare Knotenliste</h2>
<p>Dieses Tool stellt eine durchsuchbare Knotenliste mit Firmware-Versionen und Kontaktdaten bereit.</p>
<form action="https://util.berlin.freifunk.net/nodelist.html" method="GET" target="_blank">
<input type="submit" value="Zum Tool">
</form>

<h2>Kartenzentrierung</h2>
<p>Dieses Tool nimm durch Komma getrennte Koordinaten entgegen und erlaubt es die OWM, OSM und GMap Karte auf diese zu zentrieren.</p>
<code>
// https://util.berlin.freifunk.net/mapcenter?latlon=a,b&map=owm<br>
// latlon (sting): latitude and longitude separated by ","<br>
// map (enum): owm/osm/gmap
</code>
<form action="https://util.berlin.freifunk.net/mapcenter" method="GET" target="_blank">
<label for="latlon">Latitude, Longitude:</label>
<input type="text" id="latlon" name="latlon" required>
<br>
<label for="map">Map:</label>
<select id="map" name="map">
<option value="owm">OWM</option>
<option value="osm">OSM</option>
<option value="gmap">GMap</option>
</select>
<br>
<input type="submit" value="Submit">
</form>

<h2>Firmware-Downloads</h2>
<p>Dieses Tool listet auf Basis eines Routermodels Informationen zur zugehörigen Firmware auf. Das Tool ist veraltet und es sollte stattdessen der neuere
<a href="https://selector.berlin.freifunk.net/">Firmware-Selector verwendet werden.</a>
</p>
<code>
// https://util.berlin.freifunk.net/hardware?name=gl-ar150<br>
// name (sting): model of the router<br>
</code>
<form action="https://util.berlin.freifunk.net/hardware" method="GET" target="_blank">
<label for="name">Router Model:</label>
<input type="text" id="name" name="name" required>
<br>
<input type="submit" value="Submit">
</form>

<h2>Knoten von Karte entfernen</h2>
<p>Dieses Tool löscht einen Node von der OWM und Hopglass-Karte indem es ein Updat mit leeren Informationen sendet. Es ist ausschließlich dazu gedacht zum Test aufgesetzte Knoten und dauerhaft entfernte Knoten zu löschen.</p>
<code>
// https://util.berlin.freifunk.net/delete-node-from-map?name=example<br>
// name (sting): name of the node<br>
</code>
<form action="https://util.berlin.freifunk.net/delete-node-from-map.php" method="GET" target="_blank">
<label for="node-name">Node Name:</label>
<input type="text" id="node-name" name="name" required>
<br>
<input type="submit" value="Submit">
</form>

<h2>Node-Update</h2>
<p>Berliner OWM-API-Endpoint (identisch zu api.openwifimap.net)</p>
<code>
// http://util.berlin.freifunk.net/update_node/
</code>
<br>
<p>
Du kannst
<a href="https://github.com/freifunk-berlin/util.berlin.freifunk.net">auf Github</a>
zu dieser Software beitragen und &Auml;nderungen besprechen.
<br/>Infos zu diesem Server siehe Wiki-Artikel
<a href="https://wiki.freifunk.net/Berlin:Server#util.berlin.freifunk.net">Berlin:Server</a>.
</p>
</body>
</html>
Loading

0 comments on commit c4990cb

Please sign in to comment.