Explicitly use HTTPS for Vendors (#187)

This commit is contained in:
小柚子 2021-01-24 20:55:38 +08:00 committed by GitHub
parent 034c37a24f
commit 641c310554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -25,9 +25,9 @@ module.exports = hexo => {
const { name, version, file, alias, unavailable } = value;
const links = {
local : url_for.call(hexo, `lib/${name}/${file}`),
jsdelivr: `//cdn.jsdelivr.net/npm/${name}@${version}/${file}`,
unpkg : `//unpkg.com/${name}@${version}/${file}`,
cdnjs : `//cdnjs.cloudflare.com/ajax/libs/${alias || name}/${version}/${file.replace(/^(dist|lib|)\/(browser\/|)/, '')}`
jsdelivr: `https://cdn.jsdelivr.net/npm/${name}@${version}/${file}`,
unpkg : `https://unpkg.com/${name}@${version}/${file}`,
cdnjs : `https://cdnjs.cloudflare.com/ajax/libs/${alias || name}/${version}/${file.replace(/^(dist|lib|)\/(browser\/|)/, '')}`
};
let { plugins = 'jsdelivr' } = vendors;
if (plugins === 'cdnjs' && unavailable && unavailable.includes('cdnjs')) plugins = 'jsdelivr';

View File

@ -20,9 +20,9 @@ hexo.extend.helper.register('next_js', function(file, pjax = false) {
const { internal } = this.theme.vendors;
const links = {
local : this.url_for(`${this.theme.js}/${file}`),
jsdelivr: `//cdn.jsdelivr.net/npm/hexo-theme-next@${next_version}/source/js/${file}`,
unpkg : `//unpkg.com/hexo-theme-next@${next_version}/source/js/${file}`,
cdnjs : `//cdnjs.cloudflare.com/ajax/libs/hexo-theme-next/${next_version}/${file}`
jsdelivr: `https://cdn.jsdelivr.net/npm/hexo-theme-next@${next_version}/source/js/${file}`,
unpkg : `https://unpkg.com/hexo-theme-next@${next_version}/source/js/${file}`,
cdnjs : `https://cdnjs.cloudflare.com/ajax/libs/hexo-theme-next/${next_version}/${file}`
};
const src = links[internal] || links.local;
return `<script ${pjax ? 'data-pjax ' : ''}src="${src}"></script>`;

View File

@ -7,7 +7,7 @@ module.exports = function() {
if (!config || !config.enable) return '';
const fontStyles = ':300,300italic,400,400italic,700,700italic';
const fontHost = config.host || '//fonts.googleapis.com';
const fontHost = config.host || 'https://fonts.googleapis.com';
// Get a font list from config
let fontFamilies = [];

View File

@ -5,7 +5,7 @@ const Hexo = require('hexo');
const hexo = new Hexo();
const fontStyles = ':300,300italic,400,400italic,700,700italic';
const fontHost = '//fonts.googleapis.com';
const fontHost = 'https://fonts.googleapis.com';
describe('font', () => {
const nextFont = require('../../scripts/helpers/font').bind(hexo);