Skip to content

Commit

Permalink
Bundle UI assets (#643)
Browse files Browse the repository at this point in the history
* vendor: add github.com/rakyll/statik

The updates to seemingly unrelated package checksums in go.mod are
likely caused by vendoring with a Go version newer than 1.11.3
(see http://golang.org/issue/29278).

Signed-off-by: Peter Schultz <peter.schultz@classmarkets.com>

* ui: Bundle assets

Use statik to bundle UI assets, so the UI works without an Internet
connection and with Browser privacy plugins.

Closes #502.

Signed-off-by: Peter Schultz <peter.schultz@classmarkets.com>
  • Loading branch information
pschultz authored and Aaron Hurt committed May 6, 2019
1 parent 2982f38 commit 86dde1c
Show file tree
Hide file tree
Showing 41 changed files with 1,015 additions and 84 deletions.
24 changes: 24 additions & 0 deletions NOTICES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,30 @@ License: MIT (https://github.com/sergi/go-diff/LICENSE)
Copyright (c) 2012-2016 The go-diff Authors. All rights reserved.


github.com/rakyll/statik
https://github.com/rakyll/statik
License: Apache-2.0 (https://github.com/rakyll/statik/LICENSE)
Copyright (c) 2014 Google Inc. All Rights Reserved.


MaterializeCSS
https://materializecss.com/
License: MIT (https://github.com/dogfalo/materialize/LICENSE)
Copyright (c) 2018 Materialize


jQuery
https://jquery.com/
License: MIT (https://github.com/jquery/jquery/LICENSE)
Copyright (c) JS Foundation and other contributors, https://js.foundation/


Material Design icons
http://google.github.io/material-design-icons/
License: Apache-2.0 (https://github.com/google/material-design-icons/LICENSE)
Copyright 2015 Google, Inc. All Rights Reserved.


golang.org/x/net
https://golang.org/x/net
License: BSD 3-clause (https://golang.org/x/net/LICENSE)
Expand Down
14 changes: 13 additions & 1 deletion admin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (

"github.com/fabiolb/fabio/admin/api"
"github.com/fabiolb/fabio/admin/ui"
_ "github.com/fabiolb/fabio/admin/ui/statik"
"github.com/fabiolb/fabio/config"
"github.com/fabiolb/fabio/proxy"
"github.com/rakyll/statik/fs"
)

// Server provides the HTTP server for the admin UI and API.
Expand Down Expand Up @@ -64,8 +66,18 @@ func (s *Server) handler() http.Handler {
mux.Handle("/api/routes", &api.RoutesHandler{})
mux.Handle("/api/version", &api.VersionHandler{Version: s.Version})
mux.Handle("/routes", &ui.RoutesHandler{Color: s.Color, Title: s.Title, Version: s.Version})
mux.HandleFunc("/logo.svg", ui.HandleLogo)
mux.HandleFunc("/health", handleHealth)

statikFS, err := fs.New()
if err != nil {
// This error is always a result of invalid, generated zip data. That
// should never happen and would let TestAdminServerAccess fail before
// fabio is released.
panic(err)
}
mux.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(statikFS)))
mux.HandleFunc("/favicon.ico", http.NotFound)

mux.Handle("/", http.RedirectHandler("/routes", http.StatusSeeOther))
return mux
}
Expand Down
6 changes: 4 additions & 2 deletions admin/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func TestAdminServerAccess(t *testing.T) {
{"/manual", 403},
{"/routes", 200},
{"/health", 200},
{"/logo.svg", 200},
{"/assets/logo.svg", 200},
{"/assets/logo.bw.svg", 200},
{"/", 303},
}

Expand All @@ -68,7 +69,8 @@ func TestAdminServerAccess(t *testing.T) {
{"/manual", 200},
{"/routes", 200},
{"/health", 200},
{"/logo.svg", 200},
{"/assets/logo.svg", 200},
{"/assets/logo.bw.svg", 200},
{"/", 303},
}

Expand Down

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/ui/assets/cdnjs.cloudflare.com/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]--><!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]--><!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]--><!--[if gt IE 8]><!--><html class="no-js" lang="en"><!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>cdnjs.com - The best FOSS CDN for web related libraries to speed up your websites!</title> <meta property="og:title" content="cdnjs.com - The best FOSS CDN for web related libraries to speed up your websites!" /> <meta property="og:site_name" content="CDNJS.com" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://cdnjs.com/" /> <meta property="og:image" content="/img/logotext.png" /> <meta property="og:description" content="cdnjs.com - The best FOSS CDN for web related libraries to speed up your websites!" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <meta name="description" content="cdnjs.com - The best FOSS CDN for web related libraries to speed up your websites!" /> <meta name="keywords" content="CDN,CDNJS,js,css,library,web,front-end,free,open-source,png,plugin,ng,jQuery,angular" /> <script src="/cdn-cgi/apps/head/1S0-wLY5JYDWfGgqcOFYCNLruhI.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/themes/orange/pace-theme-minimal.min.css" integrity="sha256-kb8pRNu1sIwQEWAO/Mqt1S5PZ5xiLd4nBMoSsqdxKPs=" crossorigin="anonymous" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js" integrity="sha256-EPrkNjGEmCWyazb3A/Epj+W7Qm2pB9vnfXw+X6LImPM=" crossorigin="anonymous" async></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/united/bootstrap.min.css" integrity="sha256-IYGI0ovdtvTnw19p8rG6jZjmlX+5x+4rw9uAhk+5OC4=" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" /> <link rel="stylesheet" href="/css/theme.css" /> <link rel="stylesheet" href="/css/main.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/app-loading/0.0.51/app-loading.min.css" integrity="sha256-CYVY39mQQ+3yRKbAaPcIrOcRUUVw+L3BFBM1s/lRb0s=" crossorigin="anonymous" /> <link rel="dns-prefetch" href="//cdn.carbonads.com" /> <link rel="dns-prefetch" href="//static.getclicky.com" /> <link rel="dns-prefetch" href="//www.google-analytics.com" /> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="cdnjs" /> <link rel="shortcut icon" href="https://cdnjs.com/favicon.ico" /> <link rel="icon" href="https://cdnjs.com/favicon.ico" /> <link rel="canonical" href="https://cdnjs.com" /> </head> <body data-instant-allow-query-string data-instant-allow-external-links> <span id="forkongithub"><a href="https://github.com/cdnjs/cdnjs" target="_blank">CDNJS on GitHub</a></span> <div class="container home"> <div class="row"> <div class="col-md-12"> <div class="menu btn-group"> <a class="btn btn-link logo" href="/">cdnjs</a> <a class="btn btn-link btn-space" href="https://www.cloudflare.com/network-map" target="_blank">Network</a> <a class="btn btn-link btn-space" href="http://stats.pingdom.com/4jg86a2wqei0" target="_blank">Uptime</a> <div class="btn-group btn-space"> <a id="gitStatsGroupDrop" class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#"> git stats <span class="caret"></span> </a> <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="gitStatsGroupDrop"> <li class="dropdown-header">main repo</li> <li><a href="/git_stats/cdnjs/general.html" title="~201901" target="_blank">git_stats</a></li> <li><a href="/gitstats/cdnjs/" title="~201901" target="_blank">gitstats</a></li> <li class="dropdown-header">new-website</li> <li><a href="/git_stats/new-website/general.html" title="~201804" target="_blank">git_stats</a></li> <li><a href="/gitstats/new-website/" title="~201804" target="_blank">gitstats</a></li> <li class="dropdown-header">auto-updater</li> <li><a href="/git_stats/autoupdate/general.html" title="~201612" target="_blank">git_stats</a></li> <li><a href="/gitstats/autoupdate/" title="~201612" target="_blank">gitstats</a></li> <li class="dropdown-header">importer</li> <li><a href="/git_stats/cdnjs-importer/general.html" title="~201602" target="_blank">git_stats</a></li> <li><a href="/gitstats/cdnjs-importer/" title="~201602" target="_blank">gitstats</a></li> <li class="dropdown-header">buildScript</li> <li><a href="/git_stats/buildScript/general.html" title="~201612" target="_blank">git_stats</a></li> <li><a href="/gitstats/buildScript/" title="~201612" target="_blank">gitstats</a></li> <li class="dropdown-header">atom-extension</li> <li><a href="/git_stats/atom-extension/general.html" title="~201602" target="_blank">git_stats</a></li> <li><a href="/gitstats/atom-extension/" title="~201602" target="_blank">gitstats</a></li> <li class="dropdown-header">tutorials</li> <li><a href="/git_stats/tutorials/general.html" title="~201602" target="_blank">git_stats</a></li> <li><a href="/gitstats/tutorials/" title="~201602" target="_blank">gitstats</a></li> </ul> </div> <div class="btn-group btn-space"> <a id="supportGroupDrop" class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#"> Support us! <span class="caret"></span> </a> <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="supportGroupDrop"> <li><a href="https://www.bountysource.com/teams/cdnjs" target="_blank">via Bountysource</a></li> <li><a href="https://liberapay.com/cdnjs/" target="_blank">via Liberapay</a></li> <li><a href="https://tip4commit.com/github/cdnjs/cdnjs" target="_blank">via tip4commit</a></li> <li><a href="https://twitter.com/cdnjs" target="_blank">Contact us!</a></li> </ul> </div> <a class="btn btn-link btn-space" href="/libraries">Browse Libraries</a> <a class="btn btn-link btn-space" href="/api">API</a> <a class="btn btn-link btn-space" href="/about">About</a> <a class="btn btn-link btn-space" href="https://discord.gg/38ZpCFP" target="_blank">Community Discord</a> </div> </div> </div> </div> <div class="page"> <div class="container"> <div class="row"> <div class="col-md-12"> <input id="search-box" placeholder="Search from 3434 libraries with 97182 different versions ..." type="text" class="form-control col-md-7 search" aria-controls="example"> <div class="text-right text-muted">Realtime search by <a href="https://www.algolia.com/?utm_source=cdnjs&amp;utm_medium=link&amp;utm_campaign=cdnjs_search" target="_blank"><img src="/img/algolia.svg" style="height: 20px; width:75;" /></a></div> </div> </div> <div class="row"> <div class="col-md-12"> <div> <div class="packages-table-container" style="display: none;"> <div id="default_demo"></div> <p style="display: none;">Found <span id="nb-hits-field" class="major-color">0</span> libraries in <span id="processingTimeMS">0</span>ms.</p> <table style="margin-top: 10px; margin-bottom: 80px;" cellpadding="0" cellspacing="0" border="0" class="table table-striped" id="example"> <thead> <tr> <th>Library</th> <th>Link</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div> </div></div> <script src="//m.servedby-buysellads.com/monetization.js"></script><script>(function(){ _bsa.init('default', 'CVAI653I', 'placement:demo', { target: '#default_demo', align: 'horizontal', disable_css: 'true' });})();</script><script type="application/ld+json">{ "@context":"https://schema.org", "@type": "WebSite", "url": "https://cdnjs.com/", "potentialAction": { "@type": "SearchAction", "target": "https://cdnjs.com/#q={search_term_string}", "query-input": "required name=search_term_string" }}</script> </div> <footer class="footer"> <div class="container"> <p class="text-muted"> Donate CDNJS $5 on <a href="https://www.bountysource.com/teams/cdnjs" target="_blank">Bountysource</a> or become a contributor on <a href="https://github.com/cdnjs/cdnjs" target="_blank"><i class="fa fa-github"></i> GitHub</a> to make the project better and better! <span class="pull-right"> <a href="https://twitter.com/cdnjs" target="_blank"><i class="fa fa-twitter-square"></i> Twitter</a> &nbsp; <a href="https://discord.gg/38ZpCFP" target="_blank"><i class="fa fa-comments"></i> Discord</a> </span> </p> </div> </footer> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js" integrity="sha256-8E6QUcFg1KTnpEU8TFGhpTGHw5fJqB9vCms3OhAYLqw=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.min.js" integrity="sha256-LcmhwhERhehbcSu6ONVL54dAzJrhoSigqDk+N3Z9ga4=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.1/js/bootstrap-dropdown.min.js" integrity="sha256-rijzCU94p74J5qWPo8AYTAV0nSq9QgjOGe8GOPEy7tM=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.1/js/bootstrap-tooltip.min.js" integrity="sha256-9AeT3HOnzBOXSYb0q6qrJzpDO/RB6RXZKyRCrA5dSkY=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha256-Daf8GuI2eLKHJlOWLRR/zRy9Clqcj4TUSumbxYH9kGI=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/algoliasearch/3.24.4/algoliasearchLite.min.js" integrity="sha256-wbEgHd2yM8nVpWCe+opFpIPgmQhxytEHM+r+OW8PW/Q=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/app-loading/0.0.51/app-loading.min.js" integrity="sha256-YSI87JLSmNNNEzQ0YAIi3MWCVwrWJNSWe7u27Rs6c6c=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/scrollprogress/2.1.2/scrollProgress.min.js" integrity="sha256-G9QkudSF5N+LvucdLGGiCZqtbgLkJ8p8bOyhN68atbM=" crossorigin="anonymous"></script> <script src="/js/main.js" defer></script> <script src="//static.getclicky.com/js" defer></script> <script defer>try{clicky.init(66376315);}catch(err){}</script> <noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/66376315ns.gif" /></p></noscript> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-44291190-1', 'auto'); ga('require', 'linkid', 'linkid.js'); ga('require', 'displayfeatures'); ga('send', 'pageview');if($('.post').length > 0) { $('.menu').parent().removeClass('col-md-12').addClass('col-md-10 col-md-offset-1');}; $('.post > p, .post > h1, .post > h2, .post > ul, .post > h3, .post > blockquote').wrap('<div class="container"><div class="row"><div class="col-md-10 col-md-offset-1">');$('.post > pre > code').wrapInner('<div class="container"><div class="row"><div class="col-md-10 col-md-offset-1">');$('.post code').addClass('hljs');$('.post').show(); </script><script src="https://cdnjs.cloudflare.com/ajax/libs/scrollup/2.4.1/jquery.scrollUp.min.js" integrity="sha256-t2YrqZoTLq/Qt8zIw0BMiuRC2X5+a3O7PODU8RwoyYw=" crossorigin="anonymous"></script> <script defer>hljs.initHighlightingOnLoad();</script><div itemscope itemtype="https://schema.org/WebSite" style="display:none"> <meta itemprop="url" content="https://cdnjs.com/" /> <form itemprop="potentialAction" itemscope itemtype="https://schema.org/SearchAction"> <meta itemprop="target" content="https://cdnjs.com/#q={search_term_string}" /> <input itemprop="query-input" type="text" name="q" required /> <input type="submit" /> </form></div><script src="https://cdnjs.cloudflare.com/ajax/libs/instant.page/1.2.1/instantpage.js" integrity="sha256-nwXN1TPiudCodASfUbvtgw4r8CLidLH2+j+kcM9rb9M=" crossorigin="anonymous"></script></body></html>
2 changes: 2 additions & 0 deletions admin/ui/assets/code.jquery.com/jquery-3.3.1.min.js

Large diffs are not rendered by default.

Binary file added admin/ui/assets/fonts/MaterialIcons-Regular.eot
Binary file not shown.
Binary file added admin/ui/assets/fonts/MaterialIcons-Regular.ttf
Binary file not shown.
Binary file added admin/ui/assets/fonts/MaterialIcons-Regular.woff
Binary file not shown.
Binary file added admin/ui/assets/fonts/MaterialIcons-Regular.woff2
Binary file not shown.
36 changes: 36 additions & 0 deletions admin/ui/assets/fonts/material-icons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(MaterialIcons-Regular.woff2) format('woff2'),
url(MaterialIcons-Regular.woff) format('woff'),
url(MaterialIcons-Regular.ttf) format('truetype');
}

.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;

/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;

/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;

/* Support for IE. */
font-feature-settings: 'liga';
}
52 changes: 52 additions & 0 deletions admin/ui/assets/logo.bw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 86dde1c

Please sign in to comment.