chore: 自定义onlyOfficeURL

This commit is contained in:
jmal 2024-05-21 17:28:35 +08:00
parent e71f085479
commit f3f9f69de7
6 changed files with 13 additions and 10 deletions

View File

@ -1,8 +1,4 @@
#!/bin/bash
set -e
# 使用envsubst命令替换nginx.conf.template文件中的环境变量
envsubst '$API_BASE_URL $API_DRAWIO_URL $API_OFFICE_URL' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
# 启动Nginx
envsubst < /var/www/public/config.js > /var/www/public/config.js
exec "$@"

4
public/config.js Normal file
View File

@ -0,0 +1,4 @@
window._env_ = {
API_URL: "",
API_OFFICE_URL: "",
};

View File

@ -35,7 +35,7 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.path %>/resource/font-awesome/free-6.4.2/css/all.min.css">
<script src="/config.js"></script>
</head>
<body>
<noscript>

View File

@ -322,7 +322,7 @@ export default {
top: 2.5rem;
left: 0;
width: 100%;
height: 100%;
height: calc(100% - 2.5rem);
>>>.dark-button {
background: #3e3e3e;

View File

@ -241,7 +241,8 @@ export default {
lang: "zh",
user: {
id: this.$store.state.user.userId,
name: this.$store.state.user.name
name: this.$store.state.user.name,
image: `${window.location.origin}${process.env.VUE_APP_BASE_API}/public/s/view/thumbnail?id=${this.$store.state.user.avatar}`
},
customization: {
autosave: false,

View File

@ -13,11 +13,13 @@ export default {
},
// office api url
officeApiUrl: function() {
return `${window.location.origin}/office/web-apps/apps/api/documents/api.js`
const url = window._env_.API_OFFICE_URL || process.env.API_OFFICE_URL || `${window.location.origin}/office`
return `${url}/web-apps/apps/api/documents/api.js`
},
// office回调url
officeCallBackUrl: function(token, username, fileId) {
return `http://jmalcloud:8088/office/track?jmal-token=${token}&name=${username}&fileId=${fileId}`
const url = window._env_.API_URL || process.env.API_URL || 'http://jmalcloud:8088'
return `${url}/office/track?jmal-token=${token}&name=${username}&fileId=${fileId}`
},
// 预览文件的url
previewUrl: function(username, file, token, shareToken) {