mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-06-21 12:11:12 +00:00
Replace deprecated url.parse() with WHATWG URL API (#955)
This commit is contained in:
parent
b90614fba4
commit
8aa84d79f9
@ -2,15 +2,19 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const { parse } = require('url');
|
||||
|
||||
/**
|
||||
* Export theme config
|
||||
*/
|
||||
hexo.extend.helper.register('next_config', function() {
|
||||
const { config, theme, url_for, __ } = this;
|
||||
let hostname;
|
||||
try {
|
||||
hostname = new URL(config.url).hostname || config.url;
|
||||
} catch {
|
||||
hostname = config.url;
|
||||
}
|
||||
const exportConfig = {
|
||||
hostname : parse(config.url).hostname || config.url,
|
||||
hostname,
|
||||
root : config.root,
|
||||
images : url_for(theme.images),
|
||||
scheme : theme.scheme,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user