docs:文档更新
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
fanxb 2023-12-01 14:58:42 +08:00
parent 523698a967
commit b0b608de5a
5 changed files with 132 additions and 85 deletions

View File

@ -1,12 +1,20 @@
本程序基于 docker 来进行部署,使用 docker-compose 管理服务。 本程序基于 docker 来进行部署,使用 docker-compose 管理服务。
部署过程如下: **注意,仅在 x86 环境下测试,arm 下不保证可用性(目前测试可用)**
**注意,仅在 x86 环境下测试,arm下不保证可用性目前测试可用** ## 首次部署
1. 安装新版的 docker,docker-compose,zip(注意:以下操作均在项目根目录下执行) 0. 克隆代码`git clone https://github.com/FleyX/bookmark.git`
2. 修改.env 文件中的参数,改为你的实际配置 1. 进入文件夹`cd bookmark`
3. 修改`浏览器插件/bookmarkBrowserPlugin/static/js/config.js`中的 bookmarkHost改为你的实际部署路径 2. 安装新版的 docker,docker-compose,zip `apt install docker docker-compose zip`
4. 修改`浏览器插件/bookmarkBrowserPlugin/tab/index.html`中的`<meta http-equiv="Refresh" content="0;url=https://bm.fleyx.com" />`,将 url 改为你的实际部署地址 3. 修改.env 文件中的参数,改为你的实际配置
5. 执行`build.sh`编译前后端代码 4. 修改`浏览器插件/bookmarkBrowserPlugin/static/js/config.js`中的 bookmarkHost改为你的实际部署路径
6. root 权限运行 `docker-compose up -d` 启动服务。 5. 修改`浏览器插件/bookmarkBrowserPlugin/tab/index.html`中的`<meta http-equiv="Refresh" content="0;url=https://bm.fleyx.com" />`,将 url 改为你的实际部署地址
6. 执行`build.sh`编译前后端代码 `bash build.sh`
7. root 权限运行 `docker-compose up -d` 启动服务。
## 更新系统
0. 代码库更新`cd bookmark;git pull`
1. 执行`build.sh`编译前后端代码 `bash build.sh`
2. root 权限运行 `docker-compose restart` 启动服务

View File

@ -6,12 +6,21 @@
<script> <script>
export default { export default {
name: "App" name: "App",
mounted() {
window.qieziStatisticKey = "b74c4b571b644782a837433209827874";
let script = document.createElement("script");
script.type = "text/javascript";
script.defer = true;
script.src = "https://qiezi.fleyx.com/qiezijs/1.0/qiezi_statistic.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
@import "./global.less"; @import "./global.less";
html, html,
body { body {
margin: 0; margin: 0;
@ -20,6 +29,7 @@ body {
background-color: @bgColor; background-color: @bgColor;
height: initial; height: initial;
} }
#app { #app {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;

View File

@ -12,54 +12,54 @@ import router from "../router/index";
* @param {*} redirect 接口返回未认证是否跳转到登陆 * @param {*} redirect 接口返回未认证是否跳转到登陆
* @returns 数据 * @returns 数据
*/ */
async function request (url, method, params, body, isForm, redirect) { async function request(url, method, params, body, isForm, redirect) {
let options = { let options = {
url, url,
baseURL: "/bookmark/api", baseURL: "/bookmark/api",
method, method,
params, params,
headers: { headers: {
"jwt-token": window.jwtToken "jwt-token": window.jwtToken
} }
}; };
//如果是表单类型的请求,添加请求头 //如果是表单类型的请求,添加请求头
if (isForm) { if (isForm) {
options.headers["Content-Type"] = "multipart/form-data"; options.headers["Content-Type"] = "multipart/form-data";
} }
if (body) { if (body) {
options.data = body; options.data = body;
} }
let res; let res;
try { try {
res = await http.default.request(options); res = await http.default.request(options);
} catch (err) { } catch (err) {
window.vueInstance.$message.error("网络连接异常"); window.vueInstance.$message.error("网络连接异常");
console.error(err); console.error(err);
throw err; throw err;
} }
const { code, data, message } = res.data; const { code, data, message } = res.data;
if (code === 1) { if (code === 1) {
return data; return data;
} else if (code === -1 && redirect) { } else if (code === -1 && redirect) {
//未登陆根据redirect参数判断是否需要跳转到登陆页 //未登陆根据redirect参数判断是否需要跳转到登陆页
window.vueInstance.$message.error("您尚未登陆,请先登陆"); window.vueInstance.$message.error("您尚未登陆,请先登陆");
//跳转到登录页面需要清理缓存 //跳转到登录页面需要清理缓存
await this.$store.dispatch("treeData/clear"); await this.$store.dispatch("treeData/clear");
await this.$store.dispatch("globalConfig/clear"); await this.$store.dispatch("globalConfig/clear");
router.replace(`/public/login?redirect=${encodeURIComponent(router.currentRoute.fullPath)}`); router.replace(`/public/login?redirect=${encodeURIComponent(router.currentRoute.fullPath)}`);
throw new Error(message); throw new Error(message);
} else if (code === 0) { } else if (code === 0) {
//通用异常使用error提示 //通用异常使用error提示
window.vueInstance.$notification.error({ window.vueInstance.$notification.error({
message: "异常", message: "异常",
description: message description: message
}); });
throw new Error(message); throw new Error(message);
} else if (code === -2) { } else if (code === -2) {
//表单异常使用message提示 //表单异常使用message提示
window.vueInstance.$message.error(message); window.vueInstance.$message.error(message);
throw new Error(message); throw new Error(message);
} }
} }
/** /**
@ -68,8 +68,8 @@ async function request (url, method, params, body, isForm, redirect) {
* @param {*} params url参数 * @param {*} params url参数
* @param {*} redirect 未登陆是否跳转到登陆页 * @param {*} redirect 未登陆是否跳转到登陆页
*/ */
async function get (url, params = null, redirect = true) { async function get(url, params = null, redirect = true) {
return request(url, "get", params, null, false, redirect); return request(url, "get", params, null, false, redirect);
} }
/** /**
@ -80,8 +80,8 @@ async function get (url, params = null, redirect = true) {
* @param {*} isForm 是否表单数据 * @param {*} isForm 是否表单数据
* @param {*} redirect 是否重定向 * @param {*} redirect 是否重定向
*/ */
async function post (url, params, body, isForm = false, redirect = true) { async function post(url, params, body, isForm = false, redirect = true) {
return request(url, "post", params, body, isForm, redirect); return request(url, "post", params, body, isForm, redirect);
} }
/** /**
@ -92,8 +92,8 @@ async function post (url, params, body, isForm = false, redirect = true) {
* @param {*} isForm 是否表单数据 * @param {*} isForm 是否表单数据
* @param {*} redirect 是否重定向 * @param {*} redirect 是否重定向
*/ */
async function put (url, params, body, isForm = false, redirect = true) { async function put(url, params, body, isForm = false, redirect = true) {
return request(url, "put", params, body, isForm, redirect); return request(url, "put", params, body, isForm, redirect);
} }
/** /**
@ -102,13 +102,14 @@ async function put (url, params, body, isForm = false, redirect = true) {
* @param {*} params url参数 * @param {*} params url参数
* @param {*} redirect 是否重定向 * @param {*} redirect 是否重定向
*/ */
async function deletes (url, params = null, redirect = true) { async function deletes(url, params = null, redirect = true) {
return request(url, "delete", params, null, redirect); return request(url, "delete", params, null, redirect);
} }
export default { export default {
get, get,
post, post,
put, put,
delete: deletes delete: deletes,
http
}; };

View File

@ -5,18 +5,23 @@
源码地址 源码地址
<a href="https://github.com/FleyX/bookmark" target="_blank">github.com/FleyX/bookmark</a> <a href="https://github.com/FleyX/bookmark" target="_blank">github.com/FleyX/bookmark</a>
</div> </div>
<div>
当前版本{{ appVersion }}&emsp;&emsp;<a v-if="showNewVersion"
href="https://github.com/FleyX/bookmark/blob/master/DEPLOY.md">最新版本{{ latestVersion
}}</a>
</div>
<div> <div>
使用教程 使用教程
<a href="https://blog.fleyx.com/blog/detail/20220329" target="_blank">点击跳转</a> <a href="https://blog.fleyx.com/blog/detail/20220329" target="_blank">点击跳转</a>
</div> </div>
<div> <div>
浏览器插件 浏览器插件
<a href="/static/bookmarkBrowserPlugin.zip" download="浏览器插件.zip" target="_blank">最新版本{{ serverConfig.map.pluginVersion }}(注意更新)</a> <a href="/static/bookmarkBrowserPlugin.zip" download="浏览器插件.zip"
target="_blank">最新版本{{ serverConfig.map.pluginVersion }}(注意更新)</a>
,使用详情请参考使用教程 ,使用详情请参考使用教程
</div> </div>
<div>交流反馈qq群150056494,邮箱fleyx20@outlook.com</div> <div>交流反馈qq群150056494,邮箱fleyx20@outlook.com</div>
<div> <div>
统计
<a href="https://qiezi.fleyx.com" style="" target="_blank"> <a href="https://qiezi.fleyx.com" style="" target="_blank">
<div id="qieziStatisticHtmlHostPv" style="display: none"> <div id="qieziStatisticHtmlHostPv" style="display: none">
总访问次数: 总访问次数:
@ -36,27 +41,46 @@
<script> <script>
import { mapState } from "vuex"; import { mapState } from "vuex";
import { GLOBAL_CONFIG, SERVER_CONFIG } from "@/store/modules/globalConfig"; import { GLOBAL_CONFIG, SERVER_CONFIG } from "@/store/modules/globalConfig";
import httpUtil from "@/util/HttpUtil";
export default { export default {
name: "about", name: "about",
data() { data() {
return { version: "" }; return {
appVersion: "1.4", //
latestVersion: null,
showNewVersion: false
};
}, },
computed: { ...mapState(GLOBAL_CONFIG, [SERVER_CONFIG]) }, computed: { ...mapState(GLOBAL_CONFIG, [SERVER_CONFIG]) },
mounted() { async mounted() {
window.qieziStatisticKey = "b74c4b571b644782a837433209827874";
let script = document.createElement("script");
script.type = "text/javascript";
script.defer = true;
script.src = "https://qiezi.fleyx.com/qiezijs/1.0/qiezi_statistic.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
let serverConfig = this.$store.state[GLOBAL_CONFIG + "/" + SERVER_CONFIG];
console.log(serverConfig); //
if (serverConfig.map.pluginVersion) { let res = await httpUtil.http.default.get("https://s3.fleyx.com/picbed/bookmark/config.json");
this.version = serverConfig.map.pluginVersion; console.log(res);
} this.latestVersion = res.data.latestAppVersion;
this.showNewVersion = this.checkVersion(this.appVersion, this.latestVersion);
}, },
}; methods: {
checkVersion: function(version, latestVersion) {
let versions = version.split(".");
let latestVersions = latestVersion.split(".");
for (let i = 0; i < versions.length; i++) {
if (i >= latestVersions.length) {
return false;
}
let versionNum = parseInt(versions[i]);
let latestVersionNum = parseInt(latestVersions[i]);
if (versionNum !== latestVersionNum) {
return versionNum < latestVersionNum;
}
}
return true;
}
}
}
;
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped></style>

View File

@ -14,6 +14,7 @@ services:
- ./data/mysql/my.cnf:/etc/mysql/my.cnf - ./data/mysql/my.cnf:/etc/mysql/my.cnf
- /etc/localtime:/etc/localtime - /etc/localtime:/etc/localtime
- ./data/timezone:/etc/timezone - ./data/timezone:/etc/timezone
restart: unless-stopped
environment: environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD} - MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=bookmark - MYSQL_DATABASE=bookmark
@ -25,6 +26,7 @@ services:
- /etc/localtime:/etc/localtime - /etc/localtime:/etc/localtime
- ./data/timezone:/etc/timezone - ./data/timezone:/etc/timezone
- ./data/redis:/data - ./data/redis:/data
restart: unless-stopped
networks: networks:
- bookmark - bookmark
@ -38,6 +40,7 @@ services:
- ./bookmark_front/dist:/opt/dist - ./bookmark_front/dist:/opt/dist
- ./data/nginx/nginx.conf:/etc/nginx/nginx.conf - ./data/nginx/nginx.conf:/etc/nginx/nginx.conf
- ${BOOKMARK_FILE_SAVE_PATH}/files/public:/opt/files/public - ${BOOKMARK_FILE_SAVE_PATH}/files/public:/opt/files/public
restart: unless-stopped
ports: ports:
- 8080:8080 - 8080:8080
@ -60,6 +63,7 @@ services:
- ./bookMarkService/web/target/bookmark-web-1.0-SNAPSHOT.jar:/opt/app/service.jar - ./bookMarkService/web/target/bookmark-web-1.0-SNAPSHOT.jar:/opt/app/service.jar
- ${BOOKMARK_FILE_SAVE_PATH}:/opt/files - ${BOOKMARK_FILE_SAVE_PATH}:/opt/files
working_dir: /opt/app working_dir: /opt/app
restart: unless-stopped
command: command:
- /bin/bash - /bin/bash
- -c - -c