Pārlūkot izejas kodu

添加 ASSETS_SERVER 设置

visuddhinanda 4 gadi atpakaļ
vecāks
revīzija
0a38d9f0f3
5 mainītis faili ar 45 papildinājumiem un 5 dzēšanām
  1. 1 0
      .env.example
  2. 25 2
      README.md
  3. 4 1
      change-logs.md
  4. 12 0
      public/app/config.sample.js
  5. 3 2
      public/app/nissaya/nissaya.js

+ 1 - 0
.env.example

@@ -55,3 +55,4 @@ PUSHER_APP_CLUSTER=mt1
 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
 MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
 
+ASSETS_SERVER="https://assets-hk.wikipali.org"

+ 25 - 2
README.md

@@ -97,7 +97,9 @@ npm install
 
 复制 `<项目目录>/.env.example` 的一个副本。改文件名为 `.env`
 
-修改`.env`,为你的db配置
+修改`.env`
+
+**db配置**
 ```
 DB_CONNECTION=pgsql
 DB_HOST=127.0.0.1
@@ -107,6 +109,9 @@ DB_USERNAME=postgres
 DB_PASSWORD=你的数据库密码
 ```
 
+**ASSETS_SERVER**
+
+
 #### public/app/config.php
 
 复制 `<项目目录>/public/app/config.example.php` 改文件名为`config.php`
@@ -126,6 +131,7 @@ define("Database",[
 ]);
 ```
 
+
 **Redis 设置**
 ```
 define("Redis",[
@@ -145,7 +151,24 @@ define("Redis",[
 
 #### public/app/config.js
 
-复制 `<项目目录>/public/app/config.example.js` 改文件名为 `config.js`
+复制 `<项目目录>/public/app/config.example.js` 改文件名为`config.js`
+
+修改`config.js`
+
+**ASSETS_SERVER**
+```
+/*
+  |---------------
+  |网站资源文件,非用户的图片,音频,视频
+  |---------------
+  |对应/public/tmp/ 目录 开发线可以设置为 http://127.0.0.1:8000/tmp
+  |所有文件存储在 https://drive.google.com/drive/folders/1-4dn4juD-0-lsKndDui2W9nT9wcS_Y33?usp=sharing
+  |开发线可自行下载放到/public/tmp/
+  |或直接引用离您最近的assets server
+  |------------------------
+*/
+var ASSETS_SERVER = "https://assets-hk.wikipali.org";
+```
 
 
 

+ 4 - 1
change-logs.md

@@ -11,4 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - add .env-global/.env
 - .env -> /.env in .gitignore
 - rename public/app/table.php to table.config.php
-- rename public/app/dir.php to dir.config.php
+- rename public/app/dir.php to dir.config.php
+- add ASSETS_SERVER to .env.sample
+- add ASSETS_SERVER to /public/app/config.sample.js
+

+ 12 - 0
public/app/config.sample.js

@@ -1,2 +1,14 @@
 var WWW_DOMAIN_NAME="sg.wikipali.org";
 var RPC_DOMAIN_NAME="rpc.wikipali.org";
+
+/*
+  |---------------
+  |网站资源文件,非用户的图片,音频,视频
+  |---------------
+  |对应/public/tmp/ 目录 开发线可以设置为 http://127.0.0.1:8000/tmp
+  |所有文件存储在 https://drive.google.com/drive/folders/1-4dn4juD-0-lsKndDui2W9nT9wcS_Y33?usp=sharing
+  |开发线可自行下载放到/public/tmp/
+  |或直接引用离您最近的assets server
+  |------------------------
+*/
+var ASSETS_SERVER = "https://assets-hk.wikipali.org";

+ 3 - 2
public/app/nissaya/nissaya.js

@@ -34,10 +34,11 @@ function render_on_page(params) {
 
 	html += "<div class='img_box' dir='" + params.dir + "' book='" + params.book + "' page='" + params.page + "'>";
 	html += "<div>" + filename + "</div>";
+	let filePath = ASSETS_SERVER + "/nissaya/";
 	if (params.show) {
-		html += "<img class='book_page' src='../../tmp/nissaya/" + filename + "' />";
+		html += "<img class='book_page' src='" + filePath + filename + "' />";
 	} else {
-		html += "<img class='book_page' data-src='../../tmp/nissaya/" + filename + "' />";
+		html += "<img class='book_page' data-src='" + filePath + filename + "' />";
 	}
 	html += "</div>";
 	return html;