From bcce066a722be016e239cb4ecc7790dd00b2bc42 Mon Sep 17 00:00:00 2001 From: Aicirou <2643053021@qq.com> Date: Sun, 31 May 2020 02:03:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go2index/index.js | 41 ++++++++++++++++++++++++++--------------- package.json | 4 ++-- vue.config.js | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/go2index/index.js b/go2index/index.js index 3fa51b4..3e0cf04 100644 --- a/go2index/index.js +++ b/go2index/index.js @@ -1,7 +1,7 @@ // =======Options START======= var authConfig = { siteName: "GoIndex-theme-acrou", // 网站名称 - version: "1.1.0", // 程序版本 + version: "1.1.1", // 程序版本 theme: "acrou", // 强烈推荐使用自己的 client_id 和 client_secret client_id: "202264815644.apps.googleusercontent.com", @@ -65,6 +65,9 @@ var authConfig = { }; var themeOptions = { + cdn: "https://cdn.jsdelivr.net/gh/Aicirou/goindex-theme-acrou", + // 主题版本号 + version: "2.0.5", //可选默认系统语言:en/zh-chs/zh-cht languages: "en", render: { @@ -82,7 +85,18 @@ var themeOptions = { * 是否渲染文件/文件夹描述 * Render file/folder description or not */ - desc: false + desc: false, + }, + /** + * 播放器选项 + * Player options + */ + player: { + /** + * 播放器api(不指定则使用浏览器默认播放器) + * Player api(Use browser default player if not specified) + */ + api: "https://api.jsonpop.cn/demo/blplyaer/?url=", }, }; // =======Options END======= @@ -94,7 +108,7 @@ const FUNCS = { /** * 转换成针对谷歌搜索词法相对安全的搜索关键词 */ - formatSearchKeyword: function(keyword) { + formatSearchKeyword: function (keyword) { let nothing = ""; let space = " "; if (!keyword) return nothing; @@ -132,7 +146,7 @@ function html(current_drive_order = 0, model = {}) { ${authConfig.siteName} + `; @@ -184,7 +200,7 @@ async function handleRequest(request) { // 并根据 drive order 获取对应的 gd instance let gd; let url = new URL(request.url); - let path = url.pathname; + let path = decodeURI(url.pathname); /** * 重定向至起始页 @@ -291,12 +307,7 @@ async function handleRequest(request) { }) ); } else { - if ( - path - .split("/") - .pop() - .toLowerCase() == ".password" - ) { + if (path.split("/").pop().toLowerCase() == ".password") { return basic_auth_res || new Response("", { status: 404 }); } let file = await gd.file(path); @@ -917,9 +928,9 @@ class googleDrive { } sleep(ms) { - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { let i = 0; - setTimeout(function() { + setTimeout(function () { console.log("sleep" + ms); i++; if (i >= 2) reject(new Error("i>=2")); @@ -929,7 +940,7 @@ class googleDrive { } } -String.prototype.trim = function(char) { +String.prototype.trim = function (char) { if (char) { return this.replace( new RegExp("^\\" + char + "+|\\" + char + "+$", "g"), diff --git a/package.json b/package.json index 87731f8..24112ed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "go2index-theme-acrou", - "version": "2.0.5bate", - "g2index": "1.1.0", + "version": "2.0.5", + "g2index": "1.1.1", "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", diff --git a/vue.config.js b/vue.config.js index 1de5025..b070e47 100644 --- a/vue.config.js +++ b/vue.config.js @@ -14,7 +14,7 @@ process.env.VUE_APP_G2INDEX_VERSION = require("./package.json").g2index; process.env.VUE_APP_CDN_PATH = process.env.VUE_APP_CDN_PATH.replace( "@master", - "@" + process.env.VUE_APP_VERSION + "@v" + process.env.VUE_APP_VERSION ) || "/"; // 基础路径 注意发布之前要先修改这里