mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-07 06:25:21 +02:00
Renamed uploadFavicon to downLoadFavicon, removed log in locals.ts
This commit is contained in:
parent
2f8e362a52
commit
21829fc190
3 changed files with 6 additions and 8 deletions
|
@ -9,7 +9,7 @@ import * as dotenv from 'dotenv';
|
|||
import config from 'config';
|
||||
import os from 'os';
|
||||
import appConfig from 'config';
|
||||
import { uploadFavicon } from './utils/uploadFavicon';
|
||||
import { downloadFavicon } from './utils/downloadFavicon';
|
||||
|
||||
dotenv.config();
|
||||
const app = express();
|
||||
|
@ -25,7 +25,7 @@ app.set('view engine', 'twig');
|
|||
require('./utils/twig');
|
||||
|
||||
// Upload favicon by url, it's path on server is '/temp/favicon.{format}'
|
||||
uploadFavicon(faviconURL).then((res) => {
|
||||
downloadFavicon(faviconURL).then((res) => {
|
||||
app.locals.favicon = res;
|
||||
console.log('Favicon successfully uploaded');
|
||||
})
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { NextFunction, Request, Response } from 'express';
|
||||
|
||||
console.log('Initiated');
|
||||
|
||||
/**
|
||||
* Middleware for checking locals.isAuthorized property, which allows to edit/create pages
|
||||
*
|
||||
|
|
|
@ -26,12 +26,12 @@ function checkIsUrl(str: string): boolean {
|
|||
}
|
||||
|
||||
/**
|
||||
* Upload favicon by url
|
||||
* Upload favicon by url, or get it by path
|
||||
*
|
||||
* @param destination - url for uploading favicon
|
||||
* @returns { Promise<string> } - Promise with format of saved file
|
||||
* @param destination - url or path of favicon
|
||||
* @returns { Promise<FaviconData> } - Promise with data about favicon
|
||||
*/
|
||||
export async function uploadFavicon(destination: string): Promise<FaviconData> {
|
||||
export async function downloadFavicon(destination: string): Promise<FaviconData> {
|
||||
// Check of destination is empty
|
||||
if (!destination) {
|
||||
throw Error('Favicon destination is empty');
|
Loading…
Add table
Add a link
Reference in a new issue