mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-27 22:59:51 -05:00
fix: 🐛 incorrect resource and registry url while install on sub directory
This commit is contained in:
parent
aa7fb6532f
commit
67e97a13b3
3 changed files with 13 additions and 5 deletions
|
@ -33,7 +33,9 @@ module.exports = function(config, auth, storage) {
|
|||
});
|
||||
|
||||
router.get('/-/verdaccio/logo', function(req, res) {
|
||||
res.send(_.get(config, 'web.logo') || '/-/static/logo.png');
|
||||
const installPath = _.get(config, 'url_prefix', '');
|
||||
|
||||
res.send(_.get(config, 'web.logo') || `${installPath}/-/static/logo.png`);
|
||||
});
|
||||
|
||||
router.get('/', function(req, res) {
|
||||
|
|
|
@ -138,6 +138,9 @@ export default class Header extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
// Don't add slash if it's not a sub directory
|
||||
const registryURL = `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
||||
|
||||
return (
|
||||
<header className={ classes.header }>
|
||||
<div className={ classes.headerWrap }>
|
||||
|
@ -145,9 +148,9 @@ export default class Header extends React.Component {
|
|||
<img src={ this.state.logo } className={ classes.logo } />
|
||||
</Link>
|
||||
<figure>
|
||||
npm set registry { location.origin }
|
||||
npm set registry { registryURL }
|
||||
<br/>
|
||||
npm adduser --registry { location.origin }
|
||||
npm adduser --registry { registryURL }
|
||||
</figure>
|
||||
{this.renderUserActionButton()}
|
||||
</div>
|
||||
|
|
|
@ -9,6 +9,9 @@ import classes from './help.scss';
|
|||
registerLanguage('javascript', js);
|
||||
|
||||
const Help = () => {
|
||||
// Don't add slash if it's not a sub directory
|
||||
const registryURL = `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
||||
|
||||
return (
|
||||
<div className={classes.help}>
|
||||
<li className={classes.noPkg}>
|
||||
|
@ -24,11 +27,11 @@ const Help = () => {
|
|||
1. Login
|
||||
</strong>
|
||||
<SyntaxHighlighter language='javascript' style={sunburst}>
|
||||
{`npm adduser --registry ${location.origin}`}
|
||||
{`npm adduser --registry ${registryURL}`}
|
||||
</SyntaxHighlighter>
|
||||
<strong>2. Publish</strong>
|
||||
<SyntaxHighlighter language='javascript' style={sunburst}>
|
||||
{`npm publish --registry ${location.origin}`}
|
||||
{`npm publish --registry ${registryURL}`}
|
||||
</SyntaxHighlighter>
|
||||
<strong>3. Refresh this page!</strong>
|
||||
</p>
|
||||
|
|
Loading…
Add table
Reference in a new issue