Skip to content
Permalink
Browse files

no depend on .env

Remove .env
Use BASE_URL instead of BUILD_GITHUB_PAGES
Use ASSETS_DIR instead of FANCY_INDEX_DIR
Not use VUE_APP_DOWNLOAD_BASE_URL any more. Use BASE_URL instead.
  • Loading branch information...
ganlvtech committed Oct 26, 2018
1 parent 31ef04e commit 6385a0613f5248350a4b4a0fe7286780a742ab18
Showing with 18 additions and 21 deletions.
  1. +0 −2 .env
  2. +1 −1 build/build_github_pages.sh
  3. +2 −3 build/build_release.sh
  4. +6 −6 public/index.html
  5. +1 −1 src/Down52PojieCn.js
  6. +3 −3 src/helpers.js
  7. +1 −1 src/views/Home.vue
  8. +4 −4 vue.config.js
2 .env

This file was deleted.

@@ -2,7 +2,7 @@
pushd $(dirname $0)
cd ..

export BUILD_GITHUB_PAGES=true
export BASE_URL=/down_52pojie_cn/

npm install
npm run build
@@ -3,15 +3,14 @@ pushd $(dirname $0)
cd ..

export USE_FANCY_INDEX=true

rm -rf dist/
export ASSETS_DIR=.fancyindex

npm install
npm run build

sed -i "s/new Down52PojieCn({/& routerMode: 'history', requestType: 'jsonp' /g" dist/index.html
sed -i "s/new Down52PojieCn({/& routerMode: 'history', requestType: 'jsonp' /g" dist/.fancyindex/footer.html

rm dist/index.html
cp php/ dist/ -R
cp LICENSE dist/
cp README.md dist/
@@ -22,7 +22,7 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="<%= VUE_APP_DOWNLOAD_BASE_URL %>/">爱盘首页</a>
<a class="nav-link" href="https://down.52pojie.cn/">爱盘首页</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://www.52pojie.cn/thread-811805-1-1.html">关于 &amp; 帮助</a>
@@ -32,13 +32,13 @@
常用链接
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" target="_blank" href="<%= VUE_APP_DOWNLOAD_BASE_URL %>/Tools/Debuggers/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E4%B8%93%E7%94%A8%E7%89%88Ollydbg.rar">吾爱专用OD</a>
<a class="dropdown-item" target="_blank" href="https://down.52pojie.cn/Tools/Debuggers/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E4%B8%93%E7%94%A8%E7%89%88Ollydbg.rar">吾爱专用OD</a>
<a class="dropdown-item" target="_blank" href="https://www.52pojie.cn/thread-661779-1-1.html">吾爱专用虚拟机</a>
<a class="dropdown-item" target="_blank" href="<%= VUE_APP_DOWNLOAD_BASE_URL %>/Tools/PEtools/PEiD%200.95.zip">PEiD</a>
<a class="dropdown-item" target="_blank" href="https://down.52pojie.cn/Tools/PEtools/PEiD%200.95.zip">PEiD</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<%= VUE_APP_DOWNLOAD_BASE_URL %>/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E8%AE%BA%E5%9D%9B%E5%AE%98%E6%96%B9%E5%85%A5%E9%97%A8%E6%95%99%E5%AD%A6%E5%9F%B9%E8%AE%AD%E7%AC%AC%E4%B8%80%E6%9C%9F">官方入门视频</a>
<a class="dropdown-item" href="https://down.52pojie.cn/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E8%AE%BA%E5%9D%9B%E5%AE%98%E6%96%B9%E5%85%A5%E9%97%A8%E6%95%99%E5%AD%A6%E5%9F%B9%E8%AE%AD%E7%AC%AC%E4%B8%80%E6%9C%9F">官方入门视频</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" target="_blank" href="<%= VUE_APP_DOWNLOAD_BASE_URL %>/Tools/Other/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E8%AE%BA%E5%9D%9B%E7%BD%91%E7%BB%9C%E8%AF%8A%E6%96%AD%E4%BF%AE%E5%A4%8D%E5%B7%A5%E5%85%B7.zip">论坛网络修复工具</a>
<a class="dropdown-item" target="_blank" href="https://down.52pojie.cn/Tools/Other/%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E8%AE%BA%E5%9D%9B%E7%BD%91%E7%BB%9C%E8%AF%8A%E6%96%AD%E4%BF%AE%E5%A4%8D%E5%B7%A5%E5%85%B7.zip">论坛网络修复工具</a>
</div>
</li>
</ul>
@@ -100,7 +100,7 @@
<div id="app"></div>
<div id="main">
<div class="container">
<h1 class="current-path"><%= VUE_APP_DOWNLOAD_BASE_URL %>/</h1>
<h1 class="current-path">https://down.52pojie.cn/</h1>
</div>
</div>
<div class="footer">
@@ -34,7 +34,7 @@ export default function Down52PojieCn(config = {}) {
this.routerMode = config.routerMode || 'hash';

/**
* 基础网址(末尾不加斜线)
* 显示在导航栏上的最前面的网址、文件下载的基础网址(末尾不加斜线)
*
* @type string
* @default 'https://down.52pojie.cn'
@@ -19,7 +19,7 @@ function readableSize(bytes) {
return Math.round((10 * bytes) / (1024 * 1024 * 1024)) / 10 + ' GB';
}

export function prepareFiles(file, parent = null) {
export function prepareFiles(file, downloadBaseUrl = '', parent = null) {
if (parent) {
file.parent = parent;
file.path = _.startsWith(file.name, '/') || _.endsWith(parent.path, '/')
@@ -36,14 +36,14 @@ export function prepareFiles(file, parent = null) {
file.size = 0;
file.time = 0;
file.children.forEach((child) => {
prepareFiles(child, file);
prepareFiles(child, downloadBaseUrl, file);
file.size += child.size;
if (child.time > file.time) {
file.time = child.time;
}
});
}
file.fullUrl = process.env.VUE_APP_DOWNLOAD_BASE_URL + file.path;
file.fullUrl = downloadBaseUrl + file.path;
if (!file.hasOwnProperty('description')) {
file.description = '';
}
@@ -30,7 +30,7 @@
},
computed: {
data() {
return prepareFiles(this.list);
return prepareFiles(this.list, this.baseUrl);
}
}
};
@@ -10,15 +10,15 @@ FancyIndexPlugin.prototype.apply = function (compiler) {
const splitted = html.split('/</h1>');
const header = splitted[0];
const footer = splitted[1];
compilation.assets[`${process.env.FANCY_INDEX_DIR}/header.html`] = {
compilation.assets[`${process.env.ASSETS_DIR}/header.html`] = {
source: function () {
return header;
},
size: function () {
return header.length;
}
};
compilation.assets[`${process.env.FANCY_INDEX_DIR}/footer.html`] = {
compilation.assets[`${process.env.ASSETS_DIR}/footer.html`] = {
source: function () {
return footer;
},
@@ -38,8 +38,8 @@ module.exports = {
css: {
extract: true
},
baseUrl: process.env.BUILD_GITHUB_PAGES ? '/down_52pojie_cn/' : undefined,
assetsDir: process.env.USE_FANCY_INDEX ? process.env.FANCY_INDEX_DIR : undefined,
baseUrl: process.env.BASE_URL,
assetsDir: process.env.ASSETS_DIR,
chainWebpack: config => {
if (process.env.USE_FANCY_INDEX) {
config.plugin('fancy-index-plugin').use(FancyIndexPlugin);

0 comments on commit 6385a06

Please sign in to comment.
You can’t perform that action at this time.