mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
Explicitly use HTTPS for Vendors (#187)
This commit is contained in:
parent
034c37a24f
commit
641c310554
@ -25,9 +25,9 @@ module.exports = hexo => {
|
|||||||
const { name, version, file, alias, unavailable } = value;
|
const { name, version, file, alias, unavailable } = value;
|
||||||
const links = {
|
const links = {
|
||||||
local : url_for.call(hexo, `lib/${name}/${file}`),
|
local : url_for.call(hexo, `lib/${name}/${file}`),
|
||||||
jsdelivr: `//cdn.jsdelivr.net/npm/${name}@${version}/${file}`,
|
jsdelivr: `https://cdn.jsdelivr.net/npm/${name}@${version}/${file}`,
|
||||||
unpkg : `//unpkg.com/${name}@${version}/${file}`,
|
unpkg : `https://unpkg.com/${name}@${version}/${file}`,
|
||||||
cdnjs : `//cdnjs.cloudflare.com/ajax/libs/${alias || name}/${version}/${file.replace(/^(dist|lib|)\/(browser\/|)/, '')}`
|
cdnjs : `https://cdnjs.cloudflare.com/ajax/libs/${alias || name}/${version}/${file.replace(/^(dist|lib|)\/(browser\/|)/, '')}`
|
||||||
};
|
};
|
||||||
let { plugins = 'jsdelivr' } = vendors;
|
let { plugins = 'jsdelivr' } = vendors;
|
||||||
if (plugins === 'cdnjs' && unavailable && unavailable.includes('cdnjs')) plugins = 'jsdelivr';
|
if (plugins === 'cdnjs' && unavailable && unavailable.includes('cdnjs')) plugins = 'jsdelivr';
|
||||||
|
|||||||
@ -20,9 +20,9 @@ hexo.extend.helper.register('next_js', function(file, pjax = false) {
|
|||||||
const { internal } = this.theme.vendors;
|
const { internal } = this.theme.vendors;
|
||||||
const links = {
|
const links = {
|
||||||
local : this.url_for(`${this.theme.js}/${file}`),
|
local : this.url_for(`${this.theme.js}/${file}`),
|
||||||
jsdelivr: `//cdn.jsdelivr.net/npm/hexo-theme-next@${next_version}/source/js/${file}`,
|
jsdelivr: `https://cdn.jsdelivr.net/npm/hexo-theme-next@${next_version}/source/js/${file}`,
|
||||||
unpkg : `//unpkg.com/hexo-theme-next@${next_version}/source/js/${file}`,
|
unpkg : `https://unpkg.com/hexo-theme-next@${next_version}/source/js/${file}`,
|
||||||
cdnjs : `//cdnjs.cloudflare.com/ajax/libs/hexo-theme-next/${next_version}/${file}`
|
cdnjs : `https://cdnjs.cloudflare.com/ajax/libs/hexo-theme-next/${next_version}/${file}`
|
||||||
};
|
};
|
||||||
const src = links[internal] || links.local;
|
const src = links[internal] || links.local;
|
||||||
return `<script ${pjax ? 'data-pjax ' : ''}src="${src}"></script>`;
|
return `<script ${pjax ? 'data-pjax ' : ''}src="${src}"></script>`;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ module.exports = function() {
|
|||||||
if (!config || !config.enable) return '';
|
if (!config || !config.enable) return '';
|
||||||
|
|
||||||
const fontStyles = ':300,300italic,400,400italic,700,700italic';
|
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
|
// Get a font list from config
|
||||||
let fontFamilies = [];
|
let fontFamilies = [];
|
||||||
|
|||||||
@ -5,7 +5,7 @@ const Hexo = require('hexo');
|
|||||||
const hexo = new Hexo();
|
const hexo = new Hexo();
|
||||||
|
|
||||||
const fontStyles = ':300,300italic,400,400italic,700,700italic';
|
const fontStyles = ':300,300italic,400,400italic,700,700italic';
|
||||||
const fontHost = '//fonts.googleapis.com';
|
const fontHost = 'https://fonts.googleapis.com';
|
||||||
|
|
||||||
describe('font', () => {
|
describe('font', () => {
|
||||||
const nextFont = require('../../scripts/helpers/font').bind(hexo);
|
const nextFont = require('../../scripts/helpers/font').bind(hexo);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user