Merge pull request #111 from jamebal/chore

perf: 自定义OnlyOfficeURl
This commit is contained in:
jmal 2024-05-22 16:57:38 +08:00 committed by GitHub
commit 57d1c50b9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 27 additions and 12 deletions

View File

@ -1,4 +1,4 @@
name: Build and Push Multi-Platform Docker Image
name: Build Docker Image
on:
workflow_dispatch:

View File

@ -1,4 +1,4 @@
name: Build and Push Multi-Platform Docker Image
name: Build Nightly Docker Image
on:
push:

View File

@ -6,6 +6,8 @@ COPY nginx.conf /etc/nginx/nginx.conf.template
COPY dist /var/www/public
COPY config.js.template /var/www/public/config.js.template
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

4
config.js.template Normal file
View File

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

View File

@ -1,8 +1,7 @@
#!/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
echo "API_URL: $API_URL"
echo "API_OFFICE_URL: $API_OFFICE_URL"
envsubst '${API_URL} ${API_OFFICE_URL}' < /var/www/public/config.js.template > /var/www/public/config.js
cat /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

@ -2690,6 +2690,9 @@ export default {
this.path = basePath + path
this.path = this.path.replace(/\\/g, '/')
this.path = this.path.replace(/\/\//g, '/')
if (this.path === '/') {
this.path = ''
}
this.$store.dispatch('updateMessage', {event: 'storageTypeChange', data: storageType})
},

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) {