Compare commits

...

No commits in common. "master" and "ffle" have entirely different histories.
master ... ffle

23 changed files with 1972 additions and 27330 deletions

20
.editorconfig Normal file
View File

@ -0,0 +1,20 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
# Get rid of whitespace to avoid diffs with a bunch of EOL changes
trim_trailing_whitespace = true
[*.{js,html,scss,json,yml,md}]
indent_size = 2
indent_style = space
[assets/favicon/manifest.json]
indent_size = 4

14
.eslintrc Normal file
View File

@ -0,0 +1,14 @@
---
"extends":
- "eslint-config-airbnb-es5"
rules:
"no-undef": 0
"no-console": ["warn", { allow: ["warn", "error"] }]
"no-param-reassign": 0
"func-names": 0
"guard-for-in": 0
"no-undefined": 0
"consistent-return": 0
"no-nested-ternary": 0
"no-extend-native": ["error", { "exceptions": ["String"] }]

6
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1,6 @@
## Contributing is welcome
Pull requests are welcome without the need of opening an issue. If you're unsure
about your feature or your implementation open an issue and discuss your
suggested changes. Meshviewer is a frontend application and the code needs to be
loaded fast and perform with many nodes and clients on slow mobile devices.

42
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
---
<!--- Provide a general summary of the issue in the Title above -->
<!--- This template should help to improve the report, unneeded parts can be remvoed -->
## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->
## Steps to Reproduce
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.
## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Browser Name and version:
* Operating System and version (desktop or mobile):
* Link to your project:
## Screenshots
<!--- If applicable, add screenshots to help explain your problem. -->

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
---
<!--- Provide a general summary of the issue in the Title above -->
<!--- This template should help to improve the report, unneeded parts can be remvoed -->
## Is your feature request related to a problem? Please describe.
<!--- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
## Describe the solution you'd like
<!--- A clear and concise description of what you want to happen. -->
## Describe alternatives you've considered
<!--- A clear and concise description of any alternative solutions or features you've considered. -->
## Additional context
<!--- Add any other context or screenshots about the feature request here. -->

20
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,20 @@
<!--- Use a prefix like [TASK], [BUGFIX], [DOC] or [CGL] and provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes -->
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
## How Has This Been Tested?
<!--- Please try to test the code in multiple browsers and also on a mobile device -->
## Screenshots/links (if appropriate):
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project. (CI will test it anyway and also needs approval)
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
build/

10
.stylelintrc Normal file
View File

@ -0,0 +1,10 @@
{
"extends": "stylelint-config-standard",
"rules": {
"at-rule-no-unknown": [true, {
"ignoreAtRules": ["function", "if", "each", "include", "mixin"]
}],
"number-leading-zero": "never",
"no-descending-specificity": null
}
}

24
.travis.yml Normal file
View File

@ -0,0 +1,24 @@
sudo: false
dist: trusty
language: node_js
node_js:
- "14"
os:
- linux
- osx
matrix:
include:
- node_js: "12"
os: linux
cache:
yarn: true
before_script:
- if git status | grep -q "modified. \.travis\.yml"; then echo "Dirty yarn.lock"; exit 1; fi
script:
- gulp

View File

@ -18,3 +18,26 @@ Standalone: https://regensburg.freifunk.net/meshviewer/
- [POEditor](https://poeditor.com/join/project/VZBjPNNic9) for providing an easy non-developer translation environment
These tools need a lot of infrastructures and provide a free account for open source software.
## Building / Running
Required tools:
* yarn
* gulp
1st install the dependencies by running
```
yarn
```
Then you can start a development server with
```
gulp serve
```
To build a release, run
```
gulp
```
The result will be in the "build" folder afterwards.

View File

@ -1,8 +1,8 @@
module.exports = function () {
return {
'reverseGeocodingApi': 'https://nominatim.openstreetmap.org/reverse',
'maxAge': 60,
'maxAgeAlert': 30,
'maxAge': 14,
'maxAgeAlert': 3,
'nodeZoom': 18,
'labelZoom': 13,
'clientZoom': 15,
@ -14,11 +14,6 @@ module.exports = function () {
'name': 'node.status',
'value': 'Status'
},
{
'name': 'node.databaseid',
'value': 'DatabaseID'
},
{
'name': 'node.gateway',
'value': 'Gateway'
@ -27,10 +22,28 @@ module.exports = function () {
'name': 'node.coordinates',
'value': 'GeoURI'
},
{
"name": "node.contact",
"value": "owner"
},
// {
// "name": "node.contact",
// "value": "owner"
// },
// Examples for functions
// {
// // no name will remove first column
// 'value': function (d) {
// var moment = require('moment');
// var V = require('snabbdom').default;
// return V.h('td', { props: { colSpan: 2 }, style: { background: '#49a' } },
// _.t('sidebar.nodeOnline') + ' translate, ' + moment(d.firstseen).get('month') +
// ' Month require libs like moment, access config ' + config.siteName);
// }
// },
// {
// 'name': 'Neighbour first seen',
// 'value': function (d, nodeDict) {
// return nodeDict[d.gateway_nexthop].firstseen.format() + 'access node object';
// }
// },
{
'name': 'node.hardware',
'value': 'model'
@ -39,10 +52,6 @@ module.exports = function () {
'name': 'node.primaryMac',
'value': 'mac'
},
{
'name': 'node.macs',
'value': 'MACs'
},
{
'name': 'node.firmware',
'value': 'Firmware'
@ -183,4 +192,3 @@ module.exports = function () {
'cacheBreaker': '<!-- inject:cache-breaker -->'
};
};

View File

@ -3,23 +3,31 @@ module.exports = function () {
'nodeInfos': [
{
'name': 'Clientstatistik',
'href': 'https://stats.freifunk-leipzig.de/d/GVI39bqGk/nodespublic?orgId=1&refresh=5m&var-nodeid={NODE_ID}',
'image': 'https://stats.freifunk-leipzig.de/render/d-solo/GVI39bqGk/statistiken?orgId=1&panelId=2&var-nodeid={NODE_ID}&width=650&height=350&from=now-1d&theme=light',
'title': 'Entwicklung der Anzahl der Clients innerhalb des letzten Tages'
'href': '/grafana/d/KoKOqJc7k/node-public?orgId=1&refresh=30s&from=now-24h&to=now&var-node_id={NODE_ID}',
'image': '/render/clients/{NODE_ID}',
'title': 'Entwicklung der Anzahl der Clients'
},
{
'name': 'Traffic',
'href': 'https://stats.freifunk-leipzig.de/d/GVI39bqGk/nodespublic?orgId=1&refresh=5m&var-nodeid={NODE_ID}',
'image': 'https://stats.freifunk-leipzig.de/render/d-solo/GVI39bqGk/statistiken?orgId=1&panelId=6&var-nodeid={NODE_ID}&width=650&height=350&from=now-1d&theme=light',
'title': 'Traffic innerhalb des letzten Tages'
'href': '/grafana/d/KoKOqJc7k/node-public?orgId=1&refresh=30s&from=now-24h&to=now&var-node_id={NODE_ID}',
'image': '/render/traffic/{NODE_ID}',
'title': 'Traffic'
}
],
// Array of data provider are supported
'dataPath': [
'https://meshviewer.freifunk-leipzig.de/data/'
'/data/'
],
'siteName': 'Freifunk Leipzig',
'mapLayers': [
{
'name': 'OpenStreetMap.de',
'url': 'https://d.tile.openstreetmap.de/{z}/{x}/{y}.png',
'config': {
'maxZoom': 19,
'attribution': '&copy; Openstreetmap | &copy; <a href="http://www.openstreetmap.de">OpenStreetMap</a>'
}
},
{
'name': 'OpenStreetMap.HOT',
'url': 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
@ -28,6 +36,14 @@ module.exports = function () {
'attribution': '&copy; Openstreetmap France | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}
},
{
'name': 'Stamen Toner',
'url': 'http://stamen-tiles-c.a.ssl.fastly.net/toner/{z}/{x}/{y}.png',
'config': {
'maxZoom': 20,
'attribution': 'https://stamen.com/open-source/'
}
},
{
'name': 'Esri.WorldImagery',
'url': '//server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',

View File

@ -1,92 +0,0 @@
module.exports = function () {
return {
'nodeInfos': [
{
'name': 'Clientstatistik',
'href': 'https://stats.freifunk-leipzig.de/d/hRIn3dRWk/nodes?viewPanel=2&orgId=1&refresh=5m&var-nodeid={NODE_ID}from=now-24h&to=now',
'href': 'https://stats.freifunk-leipzig.de/d/hRIn3dRWk/nodes?orgId=1&refresh=5m&var-nodeid=={NODE_ID}',
'image': 'https://multi.meshviewer.org/graph/000000002/node?panelId=1&var-node={NODE_ID}&from=now-86399s&width=650&height=350&theme=light',
'title': 'Entwicklung der Anzahl der Clients innerhalb des letzten Tages'
},
{
'name': 'Hardwareauslastung',
'href': 'https://data.meshviewer.org/d/000000002/node?var-node={NODE_ID}',
'image': 'https://multi.meshviewer.org/graph/000000002/node?panelId=4&var-node={NODE_ID}&from=now-86399s&width=650&height=350&theme=light',
'title': 'Loadavg und Arbeitspeicherauslastung innerhalb des letzten Tages'
}
],
'linkInfos': [
{
'name': 'Statistik für alle Links zwischen diese Knoten',
'href': 'https://data.meshviewer.org/d/nvSNqoHmz/link?var-node={SOURCE_ID}&var-nodetolink={TARGET_ID}',
'image': 'https://multi.meshviewer.org/graph/nvSNqoHmz/link?panelId=7&var-node={SOURCE_ID}&var-nodetolink={TARGET_ID}&from=now-86399s&width=650&height=350&theme=light',
'title': 'Linkstatistik des letzten Tages, min und max aller Links zwischen diesen Knoten'
}
],
'linkTypeInfos': [
{
'name': 'Statistik für {TYPE}',
'href': 'https://data.meshviewer.org/d/nvSNqoHmz/link?var-node={SOURCE_ID}&var-nodetolink={TARGET_ID}&var-source_mac={SOURCE_MAC}&var-target_mac={TARGET_MAC}',
'image': 'https://multi.meshviewer.org/graph/nvSNqoHmz/link?panelId=8&var-node={SOURCE_ID}&var-nodetolink={TARGET_ID}&var-source_mac={SOURCE_MAC}&var-target_mac={TARGET_MAC}&from=now-86399s&width=650&height=350&theme=light',
'title': 'Linkstatistik des letzten Tages des einzelnen Links in beide Richtungen'
}
],
// Array of data provider are supported
'dataPath': [
'https://bhc-pn.de/meshviewer/data/'
],
'siteName': 'Freifunk Leipzig',
'mapLayers': [
{
'name': 'OpenStreetMap.HOT',
'url': 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
'config': {
'maxZoom': 19,
'attribution': '&copy; Openstreetmap France | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}
},
{
'name': 'Esri.WorldImagery',
'url': '//server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
'config': {
'maxZoom': 20,
'attribution': 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
}
}
],
// Set a visible frame
'fixedCenter': [
// Northwest
[
51.4168,
12.1983
],
// Southeast
[
51.2516,
12.4791
]
],
'domainNames': [
{
'domain': 'l',
'name': 'Leipzig (Gluon)'
},
{
'domain': 'meshkit',
'name': 'Leipzig (meshkit)'
}
],
'linkList': [
{
'title': 'Impressum',
'href': 'https://freifunk.net/impressum/'
},
{
'title': 'Datenschutz',
'href': 'https://freifunk.net/datenschutz/'
}
]
};
};

View File

@ -1,6 +1,6 @@
module.exports = function (gulp, plugins, config) {
return function copy() {
gulp.src(['html/*.html', 'assets/favicon/*'])
gulp.src(['html/*.html', 'html/*.js', 'assets/favicon/*'])
.pipe(gulp.dest(config.build));
gulp.src(['assets/logo.svg', 'service-worker.js'])
.pipe(gulp.dest(config.build));

View File

@ -2,7 +2,7 @@ module.exports = function (gulp, plugins, config, env) {
return function sass() {
return gulp.src('scss/*.scss')
.pipe(env.development(plugins.sourcemaps.init()))
.pipe(plugins.sass({
.pipe(require('gulp-sass')(require('sass'))({
outputStyle: 'compressed',
sourceMap: false
}))

6
html/embed.html Normal file
View File

@ -0,0 +1,6 @@
<html>
<iframe src="./index.html" style="border: 1px solid red; width: 95%; height: 95%" id="meshviewer-embedded"></iframe>
<script type="text/javascript" src="./embed.js"></script>
</html>

30
html/embed.js Normal file
View File

@ -0,0 +1,30 @@
(function() {
var iframe=document.getElementById("meshviewer-embedded")
if (!iframe) {
console.log("IFrame 'meshviewer-embedded' not found")
return;
}
if (!iframe.contentWindow) {
console.log("Element 'meshviewer-embedded' seems not to be a valid iframe")
return;
}
function updateIframeHash() { // see https://gist.github.com/manufitoussi/7529fa882ff0b737f257
// iframe is just starting.
var newHash = window.location.hash;
var srcStr = iframe.getAttribute('src');
var words = srcStr.split('#');
var href = words[0];
var newSrc = href + newHash;
iframe.setAttribute('src', newSrc);
};
updateIframeHash();
window.addEventListener("message", (event) => {
if (event && event.data && event.data.hash) {
window.location.replace(event.data.hash);
}
}, false);
window.onhashchange = updateIframeHash;
}) ();

View File

@ -71,6 +71,10 @@ define(['moment', 'utils/router', 'leaflet', 'gui', 'helper', 'utils/language'],
};
}
window.onhashchange = function () {
parent.postMessage({hash: window.location.hash}, '*');
};
var language = new Language();
window.router = new Router(language);

24959
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,14 +11,14 @@
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"browser-sync": "^2.26.14",
"browser-sync": "^2.27.4",
"del": "^6.0.0",
"eslint": "^7.20.0",
"eslint": "^7.31.0",
"eslint-config-airbnb-es5": "^1.2.0",
"eslint-config-defaults": "^9.0.0",
"eslint-plugin-react": "^7.22.0",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"eslint-plugin-react": "^7.24.0",
"gulp": "^4.0.1",
"gulp-autoprefixer": "^8.0.0",
"gulp-cache-bust": "^1.4.0",
"gulp-cli": "^2.3.0",
"gulp-environments": "^1.0.1",
@ -27,15 +27,16 @@
"gulp-inject": "^5.0.2",
"gulp-inline-source": "^4.0.0",
"gulp-jsonminify": "^1.1.0",
"gulp-load-plugins": "^2.0.6",
"gulp-real-favicon": "^0.3.2",
"gulp-load-plugins": "^2.0.7",
"gulp-real-favicon": "^0.3.0",
"gulp-requirejs-optimize": "^1.3.0",
"gulp-sass": "^4.1.0",
"gulp-sass": "^5.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-stylelint": "^13.0.0",
"gulp-uglify": "^3.0.2",
"sass": "^1.35.2",
"stylelint": "^13.10.0",
"stylelint-config-standard": "^20.0.0"
"stylelint-config-standard": "^22.0.0"
},
"eslintConfig": {
"env": {

View File

@ -1,7 +0,0 @@
@mixin icon($name, $code, $prefix: 'ion-') {
.#{$prefix}#{$name} {
&::before {
content: '#{$code}';
}
}
}

1
scss/mixins/_icon.scss Symbolic link
View File

@ -0,0 +1 @@
../../assets/icons/_icon-mixin.scss

View File

@ -1,54 +0,0 @@
// Needed for standalone scss
// @import 'icon-mixin';
$cache-breaker: unique-id();
@font-face {
font-family: 'ionicons';
font-style: normal;
font-weight: normal;
src:
url('fonts/meshviewer.woff2?rel=#{$cache-breaker}') format('woff2'),
url('fonts/meshviewer.woff?rel=#{$cache-breaker}') format('woff'),
url('fonts/meshviewer.ttf?rel=#{$cache-breaker}') format('truetype');
}
[class^='ion-'],
[class*=' ion-'] {
&::before {
display: inline-block;
font-family: $font-family-icons;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1;
speak: none;
text-rendering: auto;
text-transform: none;
vertical-align: 0;
}
}
@include icon('chevron-left', '\f124');
@include icon('chevron-right', '\f125');
@include icon('pin', '\f3a3');
@include icon('wifi', '\f25c');
@include icon('eye', '\f133');
@include icon('up-b', '\f10d');
@include icon('down-b', '\f104');
@include icon('locate', '\f2e9');
@include icon('close', '\f2d7');
@include icon('location', '\f456');
@include icon('layer', '\f229');
@include icon('filter', '\f38B');
@include icon('connection-bars', '\f274');
@include icon('share-alt', '\f3ac');
@include icon('clipboard', '\f376');
@include icon('people', '\f39e');
@include icon('person', '\f3a0');
@include icon('time', '\f3b3');
@include icon('arrow-resize', '\f264');
@include icon('arrow-left-c', '\f108');
@include icon('arrow-right-c', '\f10b');
@include icon('full-enter', '\e901');
@include icon('full-exit', '\e900');

View File

@ -0,0 +1 @@
../../../assets/icons/icon.scss

3874
yarn.lock

File diff suppressed because it is too large Load Diff