mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-04-15 03:02:51 -05:00
fix: logo and favicon configuration (#2180)
This commit is contained in:
parent
e56fd19968
commit
782dd1ca93
5 changed files with 8 additions and 6 deletions
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
|
@ -22,7 +22,6 @@ jobs:
|
|||
run: yarn lint
|
||||
- name: Publish
|
||||
run: sh scripts/publish.sh
|
||||
if: ${{ github.ref == 'refs/heads/5.x' }}
|
||||
env:
|
||||
REGISTRY_AUTH_TOKEN: ${{ secrets.REGISTRY_AUTH_TOKEN }}
|
||||
REGISTRY_URL: registry.npmjs.org
|
||||
|
|
|
@ -19,6 +19,8 @@ web:
|
|||
# sort_packages: asc
|
||||
# convert your UI to the dark side
|
||||
# darkMode: true
|
||||
# logo: http://somedomain/somelogo.png
|
||||
# favicon: http://somedomain/favicon.ico | /path/favicon.ico
|
||||
|
||||
# translate your registry, api i18n not available yet
|
||||
# i18n:
|
||||
|
|
|
@ -24,6 +24,8 @@ web:
|
|||
# by default packages are ordercer ascendant (asc|desc)
|
||||
# sort_packages: asc
|
||||
# darkMode: true
|
||||
# logo: http://somedomain/somelogo.png
|
||||
# favicon: http://somedomain/favicon.ico | /path/favicon.ico
|
||||
|
||||
# translate your registry, api i18n not available yet
|
||||
# i18n:
|
||||
|
|
|
@ -28,7 +28,7 @@ export function serveFavicon(config: Config) {
|
|||
return function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {
|
||||
try {
|
||||
// @ts-ignore
|
||||
const logoConf: string = config?.web?.logo as string;
|
||||
const logoConf: string = config?.web?.favicon as string;
|
||||
if (logoConf === '') {
|
||||
debug('favicon disabled');
|
||||
res.status(404);
|
||||
|
@ -42,6 +42,7 @@ export function serveFavicon(config: Config) {
|
|||
) {
|
||||
debug('redirect to %o', logoConf);
|
||||
res.redirect(logoConf);
|
||||
return;
|
||||
} else {
|
||||
const faviconPath = path.normalize(logoConf);
|
||||
debug('serving favicon from %o', faviconPath);
|
||||
|
@ -52,11 +53,10 @@ export function serveFavicon(config: Config) {
|
|||
} else {
|
||||
res.setHeader('Content-Type', 'image/x-icon');
|
||||
fs.createReadStream(faviconPath).pipe(res);
|
||||
return;
|
||||
debug('rendered custom ico');
|
||||
}
|
||||
});
|
||||
}
|
||||
return next();
|
||||
} else {
|
||||
res.setHeader('Content-Type', 'image/x-icon');
|
||||
fs.createReadStream(path.join(__dirname, './web/html/favicon.ico')).pipe(res);
|
||||
|
|
|
@ -36,7 +36,6 @@ export default function renderHTML(config, manifest, manifestFiles, req, res) {
|
|||
const darkMode = config?.web?.darkMode ?? false;
|
||||
const title = config?.web?.title ?? WEB_TITLE;
|
||||
const scope = config?.web?.scope ?? '';
|
||||
// FIXME: logo URI is incomplete
|
||||
let logoURI = config?.web?.logo ?? '';
|
||||
const version = pkgJSON.version;
|
||||
const primaryColor = validatePrimaryColor(config?.web?.primary_color) ?? '#4b5e40';
|
||||
|
@ -56,7 +55,7 @@ export default function renderHTML(config, manifest, manifestFiles, req, res) {
|
|||
base,
|
||||
primaryColor,
|
||||
version,
|
||||
logoURI,
|
||||
logo: logoURI,
|
||||
title,
|
||||
scope,
|
||||
language,
|
||||
|
|
Loading…
Add table
Reference in a new issue