optimise (lighthouse): apply optimisations provided by the lighthouse tool

This commit is contained in:
Mickael Kerjean
2019-08-03 12:13:47 +02:00
parent f77fd53536
commit 71e3d6494a
6 changed files with 9 additions and 13 deletions

View File

@ -65,10 +65,6 @@ html {
margin: 0; margin: 0;
} }
#main {
height: 100%;
}
.center{ .center{
text-align: center; text-align: center;
} }

View File

@ -49,7 +49,7 @@ export class BreadCrumb extends React.Component {
const Path = Element? Element : PathElement; const Path = Element? Element : PathElement;
return ( return (
<div className="component_breadcrumb"> <div className="component_breadcrumb" role="navigation">
<BreadCrumbContainer className={this.props.className+' no-select'}> <BreadCrumbContainer className={this.props.className+' no-select'}>
<Logout /> <Logout />
<ReactCSSTransitionGroup transitionName="breadcrumb" transitionLeave={true} transitionEnter={true} transitionLeaveTimeout={150} transitionEnterTimeout={200} transitionAppear={false}> <ReactCSSTransitionGroup transitionName="breadcrumb" transitionLeave={true} transitionEnter={true} transitionLeaveTimeout={150} transitionEnterTimeout={200} transitionAppear={false}>
@ -105,7 +105,7 @@ const Saving = (props) => {
const Separator = (props) => { const Separator = (props) => {
return ( return (
<div className="component_separator"> <div className="component_separator">
<img width="16" height="16" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAA30lEQVQ4T63T7Q2CMBAG4OuVPdQNcAPdBCYwDdclCAQ3ACfRDXQDZQMHgNRcAoYApfWjv0jIPX3b3gn4wxJjI03TUAhRBkGwV0o9ffaYIEVRrJumuQHA3ReaILxzl+bCkNZ660ozi/QQIl4BoCKieAmyIlyU53lkjCld0CIyhIwxSmt9nEvkRLgoyzIuPggh4iRJqjHkhXTQAwBWUsqNUoq/38sL+TlJf7lf38ngdU5EFNme2adPFgGGrR2LiGcAqIko/LhjeXbatuVOraWUO58hnJ1iRKx8AetxXPHH/1+y62USursaSgAAAABJRU5ErkJggg=="/> <img alt="path_separator" width="16" height="16" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAA30lEQVQ4T63T7Q2CMBAG4OuVPdQNcAPdBCYwDdclCAQ3ACfRDXQDZQMHgNRcAoYApfWjv0jIPX3b3gn4wxJjI03TUAhRBkGwV0o9ffaYIEVRrJumuQHA3ReaILxzl+bCkNZ660ozi/QQIl4BoCKieAmyIlyU53lkjCld0CIyhIwxSmt9nEvkRLgoyzIuPggh4iRJqjHkhXTQAwBWUsqNUoq/38sL+TlJf7lf38ngdU5EFNme2adPFgGGrR2LiGcAqIko/LhjeXbatuVOraWUO58hnJ1iRKx8AetxXPHH/1+y62USursaSgAAAABJRU5ErkJggg=="/>
</div> </div>
); );
} }

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Filestash</title> <title>Filestash</title>
<meta name="author" content="Mickael Kerjean <mickael@kerjean.me>"> <meta name="author" content="Mickael Kerjean <mickael@kerjean.me>">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1" name="viewport">
<link rel="manifest" href="/assets/manifest.json"> <link rel="manifest" href="/assets/manifest.json">
<meta content="yes" name="apple-mobile-web-app-capable"> <meta content="yes" name="apple-mobile-web-app-capable">
<meta content="Filestash" name="apple-mobile-web-app-title"> <meta content="Filestash" name="apple-mobile-web-app-title">
@ -18,7 +18,7 @@
<meta property="og:description" content="Manage your data in your cloud" /> <meta property="og:description" content="Manage your data in your cloud" />
</head> </head>
<body> <body>
<div id="main" style="height: 100%"> <div role="main" style="height: 100%">
<style> <style>
html{ background: #f2f3f5; color: #375160; overflow: hidden; } html{ background: #f2f3f5; color: #375160; overflow: hidden; }
.background-color{ background: #f2f3f5; } .background-color{ background: #f2f3f5; }
@ -26,7 +26,7 @@
</style> </style>
<script> <script>
if(location.pathname == "/" || location.pathname == "/login"){ if(location.pathname == "/" || location.pathname == "/login"){
$style = document.querySelector("#main style"); $style = document.querySelector("div[role='main'] style");
$style.innerText = $style.innerText.replace(/f2f3f5/g, "9AD1ED") $style.innerText = $style.innerText.replace(/f2f3f5/g, "9AD1ED")
} }
window.initTime = new Date(); window.initTime = new Date();

View File

@ -13,7 +13,7 @@ window.addEventListener("DOMContentLoaded", () => {
const $loader = document.querySelector("#n-lder"); const $loader = document.querySelector("#n-lder");
function render(){ function render(){
ReactDOM.render(<Router/>, document.getElementById("main")); ReactDOM.render(<Router/>, document.querySelector("div[role='main']"));
return Promise.resolve(); return Promise.resolve();
}; };
function waitFor(n){ function waitFor(n){

View File

@ -101,7 +101,7 @@ export class Form extends React.Component {
return ( return (
<Card style={{marginTop: _marginTop()+"px"}} className="no-select component_page_connection_form"> <Card style={{marginTop: _marginTop()+"px"}} className="no-select component_page_connection_form">
<NgIf cond={ window.CONFIG["connections"].length > 1 }> <NgIf cond={ window.CONFIG["connections"].length > 1 }>
<div className={"buttons "+((window.innerWidth < 600) ? "scroll-x" : "")}> <div role="navigation" className={"buttons "+((window.innerWidth < 600) ? "scroll-x" : "")}>
{ {
this.state.backends_enabled.map((backend, i) => { this.state.backends_enabled.map((backend, i) => {
const key = Object.keys(backend)[0]; const key = Object.keys(backend)[0];

View File

@ -46,7 +46,7 @@ func IndexHeaders(fn func(App, http.ResponseWriter, *http.Request)) func(ctx App
header.Set("X-XSS-Protection", "1; mode=block") header.Set("X-XSS-Protection", "1; mode=block")
header.Set("X-Frame-Options", "DENY") header.Set("X-Frame-Options", "DENY")
header.Set("X-Powered-By", fmt.Sprintf("Filestash/%s <https://filestash.app>", APP_VERSION + "." + BUILD_NUMBER)) header.Set("X-Powered-By", fmt.Sprintf("Filestash/%s <https://filestash.app>", APP_VERSION + "." + BUILD_NUMBER))
header.Set("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; font-src 'self' data:; manifest-src 'self'; script-src 'self' 'sha256-JNAde5CZQqXtYRLUk8CGgyJXo6C7Zs1lXPPClLM1YM4=' 'sha256-YLOlqMUx4Lpbv7KARwKdtxDGqHGrAp77cqwdPa4A20w='; img-src 'self' data:; connect-src 'self'; object-src 'self'; media-src 'self'; worker-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'self'") header.Set("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; font-src 'self' data:; manifest-src 'self'; script-src 'self' 'sha256-JNAde5CZQqXtYRLUk8CGgyJXo6C7Zs1lXPPClLM1YM4=' 'sha256-9/gQeQaAmVkFStl6tfCbHXn8mr6PgtxlH+hEp685lzY='; img-src 'self' data:; connect-src 'self'; object-src 'self'; media-src 'self'; worker-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'self'")
fn(ctx, res, req) fn(ctx, res, req)
} }
} }