@@ -25,12 +25,12 @@ const thisPkgInfo = require('./package');
2525const coreJsDepVer = thisPkgInfo . dependencies [ 'live2d-widget' ] ;
2626
2727const blogRoot = hexo . config . root || '/' ;
28- const onSiteRootPath = 'live2dw/' ;
29- const onSiteJsPath = `${ onSiteRootPath } lib/` ;
30- const onSiteModelPath = `${ onSiteRootPath } assets/` ;
3128
3229const defaultConfig = {
3330 'enable' : true ,
31+ 'pluginRootPath' : 'live2dw/' ,
32+ 'pluginJsPath' : 'lib/' ,
33+ 'pluginModelPath' : 'assets/' ,
3434 'scriptFrom' : 'local' ,
3535} ;
3636
@@ -52,10 +52,10 @@ function getScriptURL (scriptFrom) {
5252 * Is local(1)
5353 * Use local
5454 */
55- const scriptGenerators = buildGeneratorsFromManifest ( manifest , path . dirname ( mainfestPath ) , onSiteJsPath ) ;
55+ const scriptGenerators = buildGeneratorsFromManifest ( manifest , path . dirname ( mainfestPath ) , ` ${ config . pluginRootPath } ${ config . pluginJsPath } ` ) ;
5656 const useHash = getFileMD5 ( path . resolve ( path . dirname ( mainfestPath ) , coreScriptName ) ) ;
5757 generators . push ( ...scriptGenerators ) ;
58- return `${ blogRoot } ${ url . resolve ( onSiteJsPath , coreScriptName ) } ?${ useHash } ` ;
58+ return `${ blogRoot } ${ url . resolve ( ` ${ config . pluginRootPath } ${ config . pluginJsPath } ` , coreScriptName ) } ?${ useHash } ` ;
5959
6060 }
6161 case 'jsdelivr' :
@@ -100,7 +100,7 @@ if (config.enable) {
100100 const {
101101 modelGenerators,
102102 'modelJsonUrl' : pkgModelJsonUrl ,
103- } = loadModelFrom ( tryPath , onSiteModelPath ) ;
103+ } = loadModelFrom ( tryPath , ` ${ config . pluginRootPath } ${ config . pluginModelPath } ` ) ;
104104 modelJsonUrl = `${ blogRoot } ${ pkgModelJsonUrl } ` ;
105105 generators . push ( ...modelGenerators ) ;
106106 print . log ( `Loaded model from live2d_models folder(2), '${ url . parse ( modelJsonUrl ) . pathname } ' from '${ tryPath } '` ) ;
@@ -117,7 +117,7 @@ if (config.enable) {
117117 const {
118118 modelGenerators,
119119 'modelJsonUrl' : pkgModelJsonUrl ,
120- } = loadModelFrom ( tryPath , onSiteModelPath ) ;
120+ } = loadModelFrom ( tryPath , ` ${ config . pluginRootPath } ${ config . pluginModelPath } ` ) ;
121121 modelJsonUrl = `${ blogRoot } ${ pkgModelJsonUrl } ` ;
122122 generators . push ( ...modelGenerators ) ;
123123 print . log ( `Loaded model from hexo base releated path(3), '${ url . parse ( modelJsonUrl ) . pathname } ' from '${ tryPath } '` ) ;
@@ -144,7 +144,7 @@ if (config.enable) {
144144 const {
145145 modelGenerators,
146146 'modelJsonUrl' : pkgModelJsonUrl ,
147- } = loadModelFrom ( assetsDir , onSiteModelPath ) ;
147+ } = loadModelFrom ( assetsDir , ` ${ config . pluginRootPath } ${ config . pluginModelPath } ` ) ;
148148 modelJsonUrl = `${ blogRoot } ${ pkgModelJsonUrl } ` ;
149149 generators . push ( ...modelGenerators ) ;
150150 print . log ( `Loaded model from npm-module(1), ${ packageJsonObj . name } @${ packageJsonObj . version } from '${ assetsDir } '` ) ;
0 commit comments