diff --git a/src/api/web/index.js b/src/api/web/index.js index fac81799c..96f23572c 100644 --- a/src/api/web/index.js +++ b/src/api/web/index.js @@ -53,13 +53,7 @@ module.exports = function(config, auth, storage) { }); }); - router.get('/-/verdaccio/logo', function(req, res) { - const installPath = _.get(config, 'url_prefix', ''); - - res.send(_.get(config, 'web.logo') || spliceURL(installPath, '/-/static/logo.png')); - }); - - router.get('/', function(req, res) { + function renderHTML(req, res) { const base = combineBaseUrl(getWebProtocol(req.get(HEADERS.FORWARDED_PROTO), req.protocol), req.get('host'), config.url_prefix); const webPage = template @@ -70,6 +64,20 @@ module.exports = function(config, auth, storage) { res.setHeader('Content-Type', 'text/html'); res.send(webPage); + } + + router.get('/-/web/:pkg', function(req, res) { + renderHTML(req, res); + }); + + router.get('/-/verdaccio/logo', function(req, res) { + const installPath = _.get(config, 'url_prefix', ''); + + res.send(_.get(config, 'web.logo') || spliceURL(installPath, '/-/static/logo.png')); + }); + + router.get('/', function(req, res) { + renderHTML(req, res); }); return router; diff --git a/src/webui/app.js b/src/webui/app.js index 267121f81..490364cda 100644 --- a/src/webui/app.js +++ b/src/webui/app.js @@ -5,16 +5,16 @@ import storage from './utils/storage'; import logo from './utils/logo'; import { makeLogin, isTokenExpire } from './utils/login'; -import Footer from './components/Footer'; import Loading from './components/Loading'; import LoginModal from './components/Login'; import Header from './components/Header'; import { Container, Content } from './components/Layout'; -import Route from './router'; +import RouterApp from './router'; import API from './utils/api'; import './styles/typeface-roboto.scss'; import './styles/main.scss'; import 'normalize.css'; +import Footer from './components/Footer'; export const AppContext = React.createContext(); @@ -143,15 +143,14 @@ export default class App extends Component { } render() { - const { isLoading, isUserLoggedIn, packages } = this.state; + const { isLoading, isUserLoggedIn, packages, logoUrl, user, scope } = this.state; return ( {isLoading ? ( ) : ( - - {this.renderHeader()} + {this.renderContent()} @@ -178,7 +177,11 @@ export default class App extends Component { return ( - + + {this.renderHeader()} +