webmanifest tests (not working)
probably not working because it is not served over HTTPS
This commit is contained in:
parent
47e1a429b9
commit
1b81c2764d
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#define DUMMY_DATA 0
|
#define DUMMY_DATA 1
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
|
|
||||||
@ -262,6 +262,11 @@ void setup()
|
|||||||
// Special case to send index.html without caching
|
// Special case to send index.html without caching
|
||||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(SPIFFS, "/www/index.html", "text/html"); });
|
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(SPIFFS, "/www/index.html", "text/html"); });
|
||||||
server.serveStatic("/index.html", SPIFFS, "/www/index.html");
|
server.serveStatic("/index.html", SPIFFS, "/www/index.html");
|
||||||
|
server.on("/manifest.webmanifest", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
|
AsyncWebServerResponse* response = request->beginResponse(SPIFFS, "/www/manifest.webmanifest", "application/manifest+json; charset=utf-8");
|
||||||
|
//response->addHeader("Content-Disposition", "inline");
|
||||||
|
request->send(response);
|
||||||
|
});
|
||||||
|
|
||||||
// Log files (not cached)
|
// Log files (not cached)
|
||||||
server.serveStatic("/api/log", SPIFFS, "/log/");
|
server.serveStatic("/api/log", SPIFFS, "/log/");
|
||||||
@ -493,8 +498,11 @@ void loop()
|
|||||||
if(altitudeChange > 0)
|
if(altitudeChange > 0)
|
||||||
tripAscendingElevation += altitudeChange;
|
tripAscendingElevation += altitudeChange;
|
||||||
|
|
||||||
uint32_t newEnergy = entry.batteryVoltage * entry.batteryOutputCurrent * ((float)dt / 1000.0f);
|
static float remainingEnergy = 0.0f;
|
||||||
tripMotorEnergy += newEnergy;
|
float newEnergy = entry.batteryVoltage * entry.batteryOutputCurrent * ((float)dt / 1000.0f) + remainingEnergy;
|
||||||
|
uint32_t newEnergyIntegralJoules = (uint32_t)newEnergy;
|
||||||
|
remainingEnergy = newEnergy - (float)newEnergyIntegralJoules;
|
||||||
|
tripMotorEnergy += newEnergyIntegralJoules;
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(isOnTrip ? 10 : 1000);
|
delay(isOnTrip ? 10 : 1000);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mithril": "^2.0.9",
|
"@types/mithril": "^2.0.9",
|
||||||
"bulma": "^0.9.3",
|
"bulma": "^0.9.3",
|
||||||
|
"copy-webpack-plugin": "^10.2.4",
|
||||||
"css-loader": "^6.7.1",
|
"css-loader": "^6.7.1",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"html-webpack-plugin": "^5.5.0",
|
||||||
"mini-css-extract-plugin": "^2.6.0",
|
"mini-css-extract-plugin": "^2.6.0",
|
||||||
|
3
WebApp/src/app.css
Normal file
3
WebApp/src/app.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
html {
|
||||||
|
font-size: 3.24vmin;
|
||||||
|
}
|
@ -5,6 +5,7 @@ import { RawDataPage } from 'pages/raw-data/raw-data-page';
|
|||||||
import { DashboardPage } from 'pages/dashboard/dashboard-page';
|
import { DashboardPage } from 'pages/dashboard/dashboard-page';
|
||||||
|
|
||||||
require('../node_modules/bulma/css/bulma.css');
|
require('../node_modules/bulma/css/bulma.css');
|
||||||
|
require('./app.css');
|
||||||
|
|
||||||
m.route(document.body, "/raw", {
|
m.route(document.body, "/raw", {
|
||||||
"/dashboard": { render: () => m(Layout, m(DashboardPage)) },
|
"/dashboard": { render: () => m(Layout, m(DashboardPage)) },
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<title>Ordinateur de bord</title>
|
<title>Ordinateur de bord</title>
|
||||||
|
<link rel="manifest" href="/manifest.webmanifest" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>Chargement...</p>
|
<p>Chargement...</p>
|
||||||
|
8
WebApp/src/manifest.webmanifest
Normal file
8
WebApp/src/manifest.webmanifest
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"background_color": "purple",
|
||||||
|
"description": "Shows random fox pictures. Hey, at least it isn't cats.",
|
||||||
|
"display": "fullscreen",
|
||||||
|
"name": "Awesome fox pictures",
|
||||||
|
"short_name": "Foxes",
|
||||||
|
"start_url": "/index.html"
|
||||||
|
}
|
@ -6,6 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const PurgecssPlugin = require('purgecss-webpack-plugin');
|
const PurgecssPlugin = require('purgecss-webpack-plugin');
|
||||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||||
|
const CopyPlugin = require('copy-webpack-plugin');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './src/app.ts',
|
entry: './src/app.ts',
|
||||||
@ -46,6 +47,11 @@ module.exports = {
|
|||||||
new PurgecssPlugin({
|
new PurgecssPlugin({
|
||||||
paths: glob.sync('./src/**/*', { nodir: true }),
|
paths: glob.sync('./src/**/*', { nodir: true }),
|
||||||
safelist: ['html', 'body']
|
safelist: ['html', 'body']
|
||||||
})
|
}),
|
||||||
|
new CopyPlugin({
|
||||||
|
patterns: [
|
||||||
|
'src/manifest.webmanifest'
|
||||||
|
],
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user