Compare commits
257 Commits
v4.3.0
...
fix/e2e-ph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d0b14515f | ||
|
|
e845846d30 | ||
|
|
a7ad4b4fe4 | ||
|
|
68d4d23a4b | ||
|
|
bb457924cd | ||
|
|
a0d78c57e3 | ||
|
|
7f16243270 | ||
|
|
36a75e86ac | ||
|
|
7c41200028 | ||
|
|
3da0c523e8 | ||
|
|
8c3bc81e08 | ||
|
|
92ca92bee6 | ||
|
|
64c82a2406 | ||
|
|
e44ef813a1 | ||
|
|
9f3b45a4c7 | ||
|
|
b1af0c7d72 | ||
|
|
421640221b | ||
|
|
f6c6e22b0d | ||
|
|
51653483b9 | ||
|
|
a9787b0add | ||
|
|
6cdbf92fb0 | ||
|
|
fdb40680d3 | ||
|
|
6746325bf2 | ||
|
|
05a8bff1e0 | ||
|
|
874ff5b3f6 | ||
|
|
2230cfa52b | ||
|
|
83c581364d | ||
|
|
1d39360c60 | ||
|
|
8c763599fe | ||
|
|
9632f6070c | ||
|
|
cc63659650 | ||
|
|
177f389814 | ||
|
|
406e9ea6ee | ||
|
|
bb461cd74a | ||
|
|
782509376c | ||
|
|
63dc58d088 | ||
|
|
77f5adb19f | ||
|
|
7abfb67451 | ||
|
|
c8dc638c29 | ||
|
|
48ac926289 | ||
|
|
0a4ae41b0c | ||
|
|
bb0139bee6 | ||
|
|
7bf07cb64c | ||
|
|
ab370e66a5 | ||
|
|
421a2760d5 | ||
|
|
42f0e079f0 | ||
|
|
9150346926 | ||
|
|
b65a04857c | ||
|
|
59315c3200 | ||
|
|
08e5a15424 | ||
|
|
b8c283f602 | ||
|
|
11f7ee34de | ||
|
|
5be0d60caf | ||
|
|
6504ae2f45 | ||
|
|
c3155204eb | ||
|
|
ebd35803c6 | ||
|
|
55bda80d33 | ||
|
|
3886e62e8e | ||
|
|
07edf77ba8 | ||
|
|
ddefeb630a | ||
|
|
f050701d64 | ||
|
|
5a50327f8f | ||
|
|
b4cd038c86 | ||
|
|
9b22f9a412 | ||
|
|
99aeeb5faa | ||
|
|
29b09965a3 | ||
|
|
312c31a426 | ||
|
|
c54610caf6 | ||
|
|
72014e1534 | ||
|
|
d407b88b67 | ||
|
|
d1d8ffef7a | ||
|
|
787e9fe615 | ||
|
|
e79c53156b | ||
|
|
7dcd225cea | ||
|
|
3482ee51da | ||
|
|
211df6965f | ||
|
|
448a700687 | ||
|
|
7d17dae1fd | ||
|
|
20a5c1b494 | ||
|
|
4852b1479b | ||
|
|
bef81a940e | ||
|
|
8441d18a7f | ||
|
|
09f4400552 | ||
|
|
4f422f5ef0 | ||
|
|
fdd3bbd5c1 | ||
|
|
bb3c8a1188 | ||
|
|
bad3db400b | ||
|
|
8ac8cd8487 | ||
|
|
a54cd75469 | ||
|
|
26d8c7ab62 | ||
|
|
6b802b6545 | ||
|
|
8d56923efc | ||
|
|
79b9d703dc | ||
|
|
a5d29a4e3c | ||
|
|
7a9b3f0b8f | ||
|
|
9de1ae8c11 | ||
|
|
218f9f0015 | ||
|
|
0c6ea7248a | ||
|
|
13dfca016e | ||
|
|
904b9497a0 | ||
|
|
69444a4d72 | ||
|
|
7d67d0d857 | ||
|
|
a95dda6c20 | ||
|
|
148046f105 | ||
|
|
6d01caee50 | ||
|
|
9f9790d4fd | ||
|
|
fdb5325e02 | ||
|
|
be4080c80d | ||
|
|
a057808624 | ||
|
|
355a69b4fc | ||
|
|
7597864337 | ||
|
|
724db1936b | ||
|
|
75061d843a | ||
|
|
502b21147d | ||
|
|
deb91728d4 | ||
|
|
790c29c205 | ||
|
|
b1bfd81a97 | ||
|
|
a056c9c6c9 | ||
|
|
c559efcceb | ||
|
|
8d5c987fe7 | ||
|
|
fa034d54b6 | ||
|
|
e39e8bd907 | ||
|
|
693b13e818 | ||
|
|
6cd22e0975 | ||
|
|
22c881bbaa | ||
|
|
3cfc51a4d7 | ||
|
|
3e08deb50e | ||
|
|
42cf6b2955 | ||
|
|
02c64977cb | ||
|
|
32b0a46574 | ||
|
|
94a76a72a4 | ||
|
|
bcb278dd0b | ||
|
|
8eab415430 | ||
|
|
aa3108fe98 | ||
|
|
56965b4ff4 | ||
|
|
6eaf04aa71 | ||
|
|
5fe0dd3d29 | ||
|
|
091c955363 | ||
|
|
f09d0d8279 | ||
|
|
713edcfb8d | ||
|
|
7e0f7f6608 | ||
|
|
e4c29bf57f | ||
|
|
b2d0d50507 | ||
|
|
8c480208df | ||
|
|
b010e13de2 | ||
|
|
c2bfba865a | ||
|
|
b02debfc59 | ||
|
|
978aa0dd68 | ||
|
|
14ecf66c70 | ||
|
|
0563fde951 | ||
|
|
8f37e85aa6 | ||
|
|
0c4e5bc420 | ||
|
|
8b6e7dcbdc | ||
|
|
48fe534e77 | ||
|
|
6da291e6e3 | ||
|
|
d49b444462 | ||
|
|
692bb8f964 | ||
|
|
c2abe2f34c | ||
|
|
133973c987 | ||
|
|
8a35eb5d3e | ||
|
|
b1fbeb52a5 | ||
|
|
674cbb9bf5 | ||
|
|
6f53b41baf | ||
|
|
381e1d6b43 | ||
|
|
779c7c77b7 | ||
|
|
096426b8e2 | ||
|
|
d8146f0495 | ||
|
|
be4f3d06e8 | ||
|
|
da784aea84 | ||
|
|
bb3b5b3dff | ||
|
|
ad3e38285f | ||
|
|
60dfefd37c | ||
|
|
8268fc796e | ||
|
|
98f83d9be1 | ||
|
|
c39a205cea | ||
|
|
1671fc3572 | ||
|
|
e550df3e8b | ||
|
|
930cd2b09b | ||
|
|
36672da026 | ||
|
|
5f1e5c8f4b | ||
|
|
b71442543d | ||
|
|
146920496e | ||
|
|
cfa5771b8e | ||
|
|
25e77448d1 | ||
|
|
4a0409953a | ||
|
|
fa2a5d3e35 | ||
|
|
7c1c8a43e8 | ||
|
|
0a8be8ac95 | ||
|
|
0732344e79 | ||
|
|
c8a7371e07 | ||
|
|
aa49cc6ac0 | ||
|
|
cc01769f8f | ||
|
|
8a613513aa | ||
|
|
c249f68972 | ||
|
|
5ecfb39a9e | ||
|
|
f8039102bf | ||
|
|
88fc5910e9 | ||
|
|
41e8042bc7 | ||
|
|
a45a592a39 | ||
|
|
53cc923f1e | ||
|
|
e653eeb5c6 | ||
|
|
6e7559577c | ||
|
|
7455f8279e | ||
|
|
149e7de7fc | ||
|
|
824dbb4e45 | ||
|
|
8fef5c595d | ||
|
|
017a7dccb8 | ||
|
|
079fe5e7b0 | ||
|
|
1e03307657 | ||
|
|
ccaba78e8d | ||
|
|
75fe682433 | ||
|
|
fb6320a244 | ||
|
|
3da330341f | ||
|
|
31c7b2dfb8 | ||
|
|
d2a8ca2cdd | ||
|
|
16fca7ec61 | ||
|
|
39d8d38ee9 | ||
|
|
99982f07f7 | ||
|
|
1246a853b5 | ||
|
|
6382453327 | ||
|
|
4ebee74f70 | ||
|
|
54750f4e06 | ||
|
|
1225362c90 | ||
|
|
fe5ad49008 | ||
|
|
586561ec5a | ||
|
|
cad2d58f44 | ||
|
|
4f86a56f59 | ||
|
|
c86ca0d8cf | ||
|
|
ec633cc0e1 | ||
|
|
fa2a2b4342 | ||
|
|
2b456c9934 | ||
|
|
7965d52f29 | ||
|
|
ad322c2e10 | ||
|
|
da5dac73ab | ||
|
|
b5e711bf87 | ||
|
|
535d2baf0b | ||
|
|
294dcb1994 | ||
|
|
c54a5e9f1a | ||
|
|
3571f2b502 | ||
|
|
6f8416365f | ||
|
|
778a381b5b | ||
|
|
770769ead5 | ||
|
|
8d49abb797 | ||
|
|
d0568c53dc | ||
|
|
276ef9d704 | ||
|
|
dd75f718aa | ||
|
|
0ece6ccb51 | ||
|
|
bbd7530f77 | ||
|
|
2cfd692171 | ||
|
|
77f794831f | ||
|
|
4ee8926d5f | ||
|
|
a850e405ed | ||
|
|
cac68f88df | ||
|
|
3734a66549 | ||
|
|
2331545369 | ||
|
|
0ff1f2c22b | ||
|
|
61f1d6ac8b |
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: "Security Report / 安全漏洞报告"
|
||||
url: "https://github.com/kekingcn/kkFileView/security/advisories/new"
|
||||
about: "For sensitive security issues, please use private security report. / 涉及敏感安全问题请使用私密安全报告。"
|
||||
76
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
name: "Feature Request / 功能建议"
|
||||
description: "Propose a new feature with clear use case and acceptance criteria. / 提交功能建议,请明确场景与验收标准。"
|
||||
title: "[FEATURE] "
|
||||
labels: ["type/feature", "priority/p2", "status/needs-info"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for your idea! / 感谢你的建议!
|
||||
|
||||
Please provide concrete business scenarios and the expected behavior.
|
||||
请尽量提供明确业务场景和期望行为,便于评估优先级与实现方案。
|
||||
|
||||
For urgent production issues, you can use our Knowledge Planet channel for faster processing:
|
||||
https://wx.zsxq.com/group/48844125114258
|
||||
如为线上紧急问题,可通过知识星球渠道加速处理:
|
||||
https://wx.zsxq.com/group/48844125114258
|
||||
|
||||
- type: textarea
|
||||
id: background
|
||||
attributes:
|
||||
label: "Background / 背景"
|
||||
description: "What problem are you trying to solve? / 你要解决什么问题?"
|
||||
placeholder: "Describe current pain points... / 描述当前痛点..."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: "Proposal / 建议方案"
|
||||
description: "What do you expect kkFileView to support? / 期望 kkFileView 支持什么?"
|
||||
placeholder: "Describe expected feature behavior... / 描述期望功能行为..."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: use_case
|
||||
attributes:
|
||||
label: "Use Case / 使用场景"
|
||||
description: "Provide 1-3 concrete scenarios. / 提供 1-3 个具体场景"
|
||||
placeholder: |
|
||||
Scenario 1:
|
||||
Scenario 2:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: "Alternatives / 备选方案"
|
||||
description: "What alternatives have you considered? / 是否考虑过替代方案?"
|
||||
placeholder: "Existing workaround or alternative... / 当前替代做法..."
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: "Acceptance Criteria / 验收标准"
|
||||
description: "How do we know this feature is done? / 如何判断该功能完成?"
|
||||
placeholder: |
|
||||
- [ ] Criterion 1
|
||||
- [ ] Criterion 2
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: "Checklist / 提交前检查"
|
||||
options:
|
||||
- label: "I have searched existing issues and did not find a duplicate feature request. / 我已搜索现有 issue,未发现重复功能建议"
|
||||
required: true
|
||||
- label: "I provided concrete use cases and expected behavior. / 我已提供具体使用场景和期望行为"
|
||||
required: true
|
||||
121
.github/ISSUE_TEMPLATE/issue-report.yml
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
name: "Issue Report / 问题反馈"
|
||||
description: "Please provide complete required information to help us reproduce and follow up. / 请完整填写必填信息,便于复现与跟进。"
|
||||
title: "[ISSUE] "
|
||||
labels: ["status/needs-info"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for your report! / 感谢反馈!
|
||||
|
||||
**Please fill in all required fields.**
|
||||
**请完整填写所有必填项。**
|
||||
|
||||
Incomplete issues may be closed and asked to resubmit.
|
||||
信息不完整的问题可能会被关闭并要求重新提交。
|
||||
|
||||
For urgent production issues, you can use our Knowledge Planet channel for faster processing:
|
||||
https://wx.zsxq.com/group/48844125114258
|
||||
如为线上紧急问题,可通过知识星球渠道加速处理:
|
||||
https://wx.zsxq.com/group/48844125114258
|
||||
|
||||
- type: dropdown
|
||||
id: issue_type
|
||||
attributes:
|
||||
label: "Issue Type / 问题类型"
|
||||
description: "Select the closest type. / 请选择最接近的问题类型"
|
||||
options:
|
||||
- "Bug / 缺陷"
|
||||
- "Performance / 性能问题"
|
||||
- "Security / 安全问题"
|
||||
- "Question / 使用咨询"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: kkfileview_version
|
||||
attributes:
|
||||
label: "kkFileView Version / kkFileView 版本"
|
||||
placeholder: "e.g. 4.4.0"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: deploy_mode
|
||||
attributes:
|
||||
label: "Deployment Mode / 部署方式"
|
||||
description: "jar / docker / k8s / source, etc. / jar / docker / k8s / 源码部署等"
|
||||
placeholder: "e.g. docker"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: "Environment / 环境信息"
|
||||
description: "OS, JDK, LibreOffice/OpenOffice, browser, reverse proxy, etc. / 操作系统、JDK、Office组件、浏览器、反向代理等"
|
||||
placeholder: |
|
||||
- OS:
|
||||
- JDK:
|
||||
- LibreOffice/OpenOffice:
|
||||
- Browser:
|
||||
- Proxy (Nginx/Ingress):
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: reproduce_steps
|
||||
attributes:
|
||||
label: "Steps to Reproduce / 复现步骤"
|
||||
description: "Provide clear, minimal, reproducible steps. / 提供清晰、最小可复现步骤"
|
||||
placeholder: |
|
||||
1) ...
|
||||
2) ...
|
||||
3) ...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected_result
|
||||
attributes:
|
||||
label: "Expected Result / 期望结果"
|
||||
placeholder: "What should happen? / 期望实际应该出现什么结果?"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual_result
|
||||
attributes:
|
||||
label: "Actual Result / 实际结果"
|
||||
placeholder: "What happened instead? / 实际发生了什么?"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: "Logs & Screenshots / 日志与截图"
|
||||
description: "Paste key logs/error stack and attach screenshots (mask sensitive data). / 粘贴关键日志或异常堆栈,并上传截图(请脱敏)"
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: sample_file
|
||||
attributes:
|
||||
label: "Sample File / 样例文件(可选)"
|
||||
description: "If possible, provide a minimal sample file or reproducible URL (desensitized). / 如可提供,请附最小样例文件或可复现 URL(脱敏)"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: "Checklist / 提交前检查"
|
||||
options:
|
||||
- label: "I have searched existing issues and did not find a duplicate. / 我已搜索现有 issue,未发现重复问题"
|
||||
required: true
|
||||
- label: "I can reproduce this issue on the stated version/environment. / 我可在上述版本与环境复现该问题"
|
||||
required: true
|
||||
- label: "I have masked sensitive information in logs/screenshots. / 我已对日志与截图中的敏感信息做脱敏处理"
|
||||
required: true
|
||||
78
.github/workflows/auto-close-old-issues.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
name: Auto Close Old Issues (1y)
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Daily at 02:20 UTC
|
||||
- cron: '20 2 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
close_old_issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Close issues older than 1 year
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
const now = new Date();
|
||||
const cutoff = new Date(now.getTime() - 365 * 24 * 60 * 60 * 1000);
|
||||
|
||||
const closeComment = `该 Issue 已超过 1 年未活跃,为便于维护当前问题队列,先做关闭处理。\n\n如该问题在最新版本仍存在,欢迎直接 **Reopen** 本 Issue(或新建 Issue 并关联本单),并补充:\n1. 版本与部署方式\n2. 最小复现步骤\n3. 关键日志/截图(请脱敏)\n\n我们会优先跟进。`;
|
||||
|
||||
let page = 1;
|
||||
let processed = 0;
|
||||
while (true) {
|
||||
const { data: issues } = await github.rest.issues.listForRepo({
|
||||
owner,
|
||||
repo,
|
||||
state: 'open',
|
||||
per_page: 100,
|
||||
page,
|
||||
sort: 'created',
|
||||
direction: 'asc'
|
||||
});
|
||||
|
||||
if (!issues.length) break;
|
||||
|
||||
for (const issue of issues) {
|
||||
// skip pull requests
|
||||
if (issue.pull_request) continue;
|
||||
|
||||
const createdAt = new Date(issue.created_at);
|
||||
if (createdAt > cutoff) {
|
||||
// list is sorted asc by created time; remaining items are newer
|
||||
core.info('Reached issues newer than cutoff, stop scanning.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await github.rest.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
body: closeComment,
|
||||
});
|
||||
|
||||
await github.rest.issues.update({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed',
|
||||
});
|
||||
|
||||
processed += 1;
|
||||
core.info(`Closed #${issue.number}`);
|
||||
} catch (e) {
|
||||
core.warning(`Failed to close #${issue.number}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
page += 1;
|
||||
}
|
||||
|
||||
core.info(`Done. Closed ${processed} old issues.`);
|
||||
34
.github/workflows/copilot-issue-auto-comment.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Copilot Issue Auto Comment
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
copilot_auto_comment:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Ask Copilot to triage issue automatically
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const issue = context.payload.issue;
|
||||
if (!issue) return;
|
||||
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
|
||||
const body = `@copilot 请自动分诊并直接给出可执行建议(无需人工先介入):\n\n- 先判断类型:Bug / Performance / Security / Question / Feature\n- 检查 Issue 信息是否完整(版本、部署方式、复现步骤、日志)\n- 若信息不完整:请直接按模板列出缺失项并引导补充\n- 若信息较完整:请给出下一步排查建议与最小复现建议\n- 若判断为已知问题或已修复:请给出对应版本/修复方向\n\nIssue #${issue.number}\n标题:${issue.title}\n链接:${issue.html_url}\n\n---\n\n补充说明 / Support Notice:\n- GitHub Issues 会持续跟进处理 / We will continue to follow up through GitHub Issues.\n- 如为线上紧急问题,可通过知识星球渠道加速处理 / For urgent production issues, you can use our Knowledge Planet channel for faster processing:\n https://wx.zsxq.com/group/48844125114258`;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
body,
|
||||
});
|
||||
|
||||
core.info(`Copilot prompt comment posted to #${issue.number}`);
|
||||
44
.github/workflows/maven.yml
vendored
@@ -11,14 +11,42 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v2
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
cache: maven
|
||||
java-version: '21'
|
||||
distribution: 'temurin' # 使用 Eclipse Temurin (AdoptOpenJDK 的继任者)
|
||||
cache: 'maven'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
run: mvn -B package -Dmaven.test.skip=true --file pom.xml
|
||||
|
||||
- name: Upload Linux distribution package
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: kkfileview-linux
|
||||
path: server/target/*.tar.gz
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload Windows distribution package
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: kkfileview-windows
|
||||
path: server/target/*.zip
|
||||
retention-days: 7
|
||||
|
||||
118
.github/workflows/nightly-e2e.yml
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
name: Nightly E2E Full
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 18 * * *' # 02:30 Asia/Shanghai
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
e2e-nightly:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 50
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: tests/e2e/package-lock.json
|
||||
|
||||
- name: Setup Python 3.11
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install LibreOffice + zip
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libreoffice zip
|
||||
|
||||
- name: Setup Python deps for office fixtures
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r tests/e2e/requirements.txt
|
||||
|
||||
- name: Build kkFileView
|
||||
run: mvn -q -pl server -DskipTests package
|
||||
|
||||
- name: Install E2E deps
|
||||
working-directory: tests/e2e
|
||||
run: |
|
||||
npm ci
|
||||
npx playwright install --with-deps chromium
|
||||
|
||||
- name: Start fixture server
|
||||
run: |
|
||||
cd tests/e2e/fixtures
|
||||
python3 -m http.server 18080 > /tmp/fixture-server.log 2>&1 &
|
||||
|
||||
- name: Start kkFileView
|
||||
run: |
|
||||
JAR_PATH=$(ls server/target/kkFileView-*.jar | head -n 1)
|
||||
nohup env KK_TRUST_HOST='*' KK_NOT_TRUST_HOST='10.*,172.16.*,192.168.*' java -jar "$JAR_PATH" > /tmp/kkfileview.log 2>&1 &
|
||||
|
||||
- name: Wait for services
|
||||
run: |
|
||||
fixture_ready=false
|
||||
for i in {1..60}; do
|
||||
if curl -fsS http://127.0.0.1:18080/sample.txt >/dev/null; then
|
||||
fixture_ready=true
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [ "$fixture_ready" != "true" ]; then
|
||||
echo "Error: fixture server did not become ready within 60 seconds." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kkfileview_ready=false
|
||||
for i in {1..120}; do
|
||||
if curl -fsS http://127.0.0.1:8012/ >/dev/null; then
|
||||
kkfileview_ready=true
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [ "$kkfileview_ready" != "true" ]; then
|
||||
echo "Error: kkFileView service did not become ready within 120 seconds." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Run nightly E2E suites
|
||||
working-directory: tests/e2e
|
||||
env:
|
||||
KK_BASE_URL: http://127.0.0.1:8012
|
||||
FIXTURE_BASE_URL: http://127.0.0.1:18080
|
||||
E2E_MAX_PREVIEW_MS: 20000
|
||||
run: npm run test:ci
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nightly-playwright-report
|
||||
path: tests/e2e/playwright-report
|
||||
|
||||
- name: Upload service logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nightly-e2e-service-logs
|
||||
path: |
|
||||
/tmp/kkfileview.log
|
||||
/tmp/fixture-server.log
|
||||
100
.github/workflows/pr-e2e-mvp.yml
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
name: PR E2E MVP
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
e2e-mvp:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: tests/e2e/package-lock.json
|
||||
|
||||
- name: Setup Python 3.11
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install LibreOffice + zip
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libreoffice zip
|
||||
|
||||
- name: Setup Python deps for office fixtures
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r tests/e2e/requirements.txt
|
||||
|
||||
- name: Build kkFileView
|
||||
run: mvn -q -pl server -DskipTests package
|
||||
|
||||
- name: Install E2E deps
|
||||
working-directory: tests/e2e
|
||||
run: |
|
||||
npm install
|
||||
npx playwright install --with-deps chromium
|
||||
|
||||
- name: Start fixture server
|
||||
run: |
|
||||
cd tests/e2e/fixtures
|
||||
python3 -m http.server 18080 > /tmp/fixture-server.log 2>&1 &
|
||||
|
||||
- name: Start kkFileView
|
||||
run: |
|
||||
JAR_PATH=$(ls server/target/kkFileView-*.jar | head -n 1)
|
||||
nohup env KK_TRUST_HOST='*' KK_NOT_TRUST_HOST='10.*,172.16.*,192.168.*' java -jar "$JAR_PATH" > /tmp/kkfileview.log 2>&1 &
|
||||
|
||||
- name: Wait for services
|
||||
run: |
|
||||
for i in {1..60}; do
|
||||
curl -fsS http://127.0.0.1:18080/sample.txt >/dev/null && break
|
||||
sleep 1
|
||||
done
|
||||
for i in {1..120}; do
|
||||
curl -fsS http://127.0.0.1:8012/ >/dev/null && break
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Run E2E
|
||||
working-directory: tests/e2e
|
||||
env:
|
||||
KK_BASE_URL: http://127.0.0.1:8012
|
||||
FIXTURE_BASE_URL: http://127.0.0.1:18080
|
||||
run: npm test
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: tests/e2e/playwright-report
|
||||
|
||||
- name: Upload service logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: e2e-service-logs
|
||||
path: |
|
||||
/tmp/kkfileview.log
|
||||
/tmp/fixture-server.log
|
||||
@@ -1,5 +1,4 @@
|
||||
FROM keking/kkfileview-jdk:latest
|
||||
MAINTAINER chenjh "842761733@qq.com"
|
||||
FROM keking/kkfileview-base:4.4.0
|
||||
ADD server/target/kkFileView-*.tar.gz /opt/
|
||||
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.3.0/bin
|
||||
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.3.0/config/application.properties","-jar","/opt/kkFileView-4.3.0/bin/kkFileView-4.3.0.jar"]
|
||||
ENV KKFILEVIEW_BIN_FOLDER=/opt/kkFileView-4.4.0/bin
|
||||
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.4.0/config/application.properties","-jar","/opt/kkFileView-4.4.0/bin/kkFileView-4.4.0.jar"]
|
||||
|
||||
215
README.cn.md
@@ -13,7 +13,7 @@
|
||||
11. 支持 epub 图书文档
|
||||
12. 支持 obj, 3ds, stl, ply, gltf, glb, off, 3dm, fbx, dae, wrl, 3mf, ifc, brep, step, iges, fcstd, bim 等 3D 模型文件
|
||||
13. 支持 dwg, dxf, dwf, iges , igs, dwt, dng, ifc, dwfx, stl, cf2, plt 等 CAD 模型文件
|
||||
14. 支持 txt, xml(渲染), md(渲染), java, php, py, js, css 等所有纯文本
|
||||
14. 支持 txt, xml(渲染), xbrl(渲染), md(渲染), java, php, py, js, css 等所有纯文本
|
||||
15. 支持 zip, rar, jar, tar, gzip, 7z 等压缩包
|
||||
16. 支持 jpg, jpeg, png, gif, bmp, ico, jfif, webp 等图片预览(翻转,缩放,镜像)
|
||||
17. 支持 tif, tiff 图信息模型文件
|
||||
@@ -42,9 +42,7 @@
|
||||
地址:[https://file.kkview.cn](https://file.kkview.cn)
|
||||
|
||||
### 项目文档(Project documentation)
|
||||
1. 详细wiki文档:https://gitee.com/kekingcn/file-online-preview/wikis/pages
|
||||
1. 中文文档:https://gitee.com/kekingcn/file-online-preview/blob/master/README.md
|
||||
1. English document:https://gitee.com/kekingcn/file-online-preview/blob/master/README.en.md
|
||||
1. 详细使用文档:https://kkview.cn/zh-cn/docs/home.html
|
||||
|
||||
### 联系我们,加入组织
|
||||
> 我们会用心回答解决大家在项目使用中的问题,也请大家在提问前至少 Google 或 baidu 过,珍爱生命远离无效的交流沟通
|
||||
@@ -53,61 +51,82 @@
|
||||
|
||||
### 文档预览效果
|
||||
#### 1. 文本预览
|
||||
支持所有类型的文本文档预览, 由于文本文档类型过多,无法全部枚举,默认开启的类型如下 txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd
|
||||
支持所有类型的文本文档预览, 由于文本文档类型过多,无法全部枚举,默认开启的类型如下 txt,html,htm,asp,jsp,xml,xbrl,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd
|
||||
文本预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 2. 图片预览
|
||||
支持jpg,jpeg,png,gif等图片预览(翻转,缩放,镜像),预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 3. word文档预览
|
||||
支持doc,docx文档预览,word预览有两种模式:一种是每页word转为图片预览,另一种是整个word文档转成pdf,再预览pdf。两种模式的适用场景如下
|
||||
* 图片预览:word文件大,前台加载整个pdf过慢
|
||||
* pdf预览:内网访问,加载pdf快
|
||||
图片预览模式预览效果如下
|
||||

|
||||

|
||||
pdf预览模式预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 4. ppt文档预览
|
||||
支持ppt,pptx文档预览,和word文档一样,有两种预览模式
|
||||
图片预览模式预览效果如下
|
||||

|
||||

|
||||
pdf预览模式预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 5. pdf文档预览
|
||||
支持pdf文档预览,和word文档一样,有两种预览模式
|
||||
图片预览模式预览效果如下
|
||||

|
||||

|
||||
pdf预览模式预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 6. excel文档预览
|
||||
支持xls,xlsx文档预览,预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 7. 压缩文件预览
|
||||
支持zip,rar,jar,tar,gzip等压缩包,预览效果如下
|
||||

|
||||

|
||||
可点击压缩包中的文件名,直接预览文件,预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 8. 多媒体文件预览
|
||||
理论上支持所有的视频、音频文件,由于无法枚举所有文件格式,默认开启的类型如下
|
||||
mp3,wav,mp4,flv
|
||||
视频预览效果如下
|
||||

|
||||

|
||||
音频预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 9. CAD文档预览
|
||||
支持CAD dwg文档预览,和word文档一样,有两种预览模式
|
||||
图片预览模式预览效果如下
|
||||

|
||||

|
||||
pdf预览模式预览效果如下
|
||||

|
||||

|
||||
|
||||
#### 10. Excel文件纯前端渲染效果
|
||||
|
||||

|
||||
|
||||
#### 11. 流程图bpmn文件预览效果
|
||||
|
||||

|
||||
|
||||
#### 12. 3D模型文件预览效果:
|
||||
|
||||

|
||||
|
||||
#### 13. dcm医疗数位影像文件预览效果:
|
||||
|
||||

|
||||
|
||||
#### 14. drawio流程图预览效果:
|
||||
|
||||

|
||||
|
||||
考虑说明篇幅原因,就不贴其他格式文件的预览效果了,感兴趣的可以参考下面的实例搭建下
|
||||
|
||||
### 快速开始
|
||||
@@ -116,6 +135,7 @@ pdf预览模式预览效果如下
|
||||
- freemarker
|
||||
- redisson
|
||||
- jodconverter
|
||||
|
||||
> 依赖外部环境
|
||||
- redis (可选,默认不用)
|
||||
- OpenOffice 或者 LibreOffice( Windows 下已内置,Linux 脚本启动模式会自动安装,Mac OS 下需要手动安装)
|
||||
@@ -129,7 +149,131 @@ pdf预览模式预览效果如下
|
||||
|
||||
### 历史更新记录
|
||||
|
||||
> 2022年12月14日,v4.1.0 版本发布 :
|
||||
#### > 2025年01月16日,v4.4.0 版本发布 :
|
||||
|
||||
### 新增功能
|
||||
1. xlsx 新增支持打印功能
|
||||
2. 配置文件新增启用 GZIP 压缩
|
||||
3. CAD 格式新增支持转换成 SVG 和 TIF 格式,新增超时结束、线程管理
|
||||
4. 新增删除文件使用验证码校验
|
||||
5. 新增 xbrl 格式预览支持
|
||||
6. PDF 预览新增控制签名、绘图、插图控制、搜索定位页码、定义显示内容等功能
|
||||
7. 新增 CSV 格式前端解析支持
|
||||
8. 新增 ARM64 下的 Docker 镜像支持
|
||||
9. 新增 Office 预览支持转换超时属性设置功能
|
||||
10. 新增预览文件 host 黑名单机制
|
||||
|
||||
### 优化
|
||||
1. 优化 OFD 移动端预览 页面不自适应
|
||||
2. 更新 xlsx 前端解析组件,加速解析速度
|
||||
3. 升级 CAD 组件
|
||||
4. office 功能调整,支持批注、转换页码限制、生成水印等功能
|
||||
5. 升级 markdown 组件
|
||||
6. 升级 dcm 解析组件
|
||||
7. 升级 PDF.JS 解析组件
|
||||
8. 更换视频播放插件为 ckplayer
|
||||
9. tif 解析更加智能化,支持被修改的图片格式
|
||||
10. 针对大小文本文件检测字符编码的正确率,处理并发隐患
|
||||
11. 重构下载文件的代码,新增通用的文件服务器认证访问的设计
|
||||
12. 更新 bootstrap 组件,并精简掉不需要的文件
|
||||
13. 更新 epub 版本,优化 epub 显示效果
|
||||
14. 解决定时清除缓存时,对于多媒体类型文件,只删除了磁盘缓存文件
|
||||
15. 自动检测已安装 Office 组件,增加 LibreOffice 7.5 & 7.6 版本默认路径
|
||||
16. 修改 drawio 默认为预览模式
|
||||
17. 新增 PDF 线程管理、超时管理、内存缓存管理,更新 PDF 解析组件版本
|
||||
18. 优化 Dockerfile,支持真正的跨平台构建镜像
|
||||
|
||||
### 修复
|
||||
1. 修复 forceUpdatedCache 属性设置,但本地缓存文件不更新的问题
|
||||
2. 修复 PDF 解密加密文件转换成功后后台报错的问题
|
||||
3. 修复 BPMN 不支持跨域的问题
|
||||
4. 修复压缩包二级反代特殊符号错误问题
|
||||
5. 修复视频跨域配置导致视频无法预览的问题
|
||||
6. 修复 TXT 文本类分页二次加载问题
|
||||
7. 修复 Drawio 缺少 Base64 组件的问题
|
||||
8. 修复 Markdown 被转义问题
|
||||
9. 修复 EPUB 跨域报错问题
|
||||
10. 修复 URL 特殊符号问题
|
||||
11. 修复压缩包穿越漏洞
|
||||
12. 修复压缩获取路径错误、图片合集路径错误、水印问题等 BUG
|
||||
13. 修复前端解析 XLSX 包含 EMF 格式文件错误问题
|
||||
|
||||
#### > 2023年07月05日,v4.3.0 版本发布 :
|
||||
|
||||
#### 新增功能:
|
||||
1. 新增dcm等医疗数位影像预
|
||||
2. 新增drawio绘图预览
|
||||
3. 新增开启缓存的情况下重新生成的命令 &forceUpdatedCache=true
|
||||
4. 新增dwg CAD文件预览
|
||||
5. 新增PDF文件支持密码功能
|
||||
6. 新增PDF文件生成图片的dpi自定义配置
|
||||
7. 新增删除转换后OFFICE、CAD、TIFF、压缩包源文件配置 默认开启 节约磁盘空间
|
||||
8. 新增前端解析xlsx方法
|
||||
9. 新增pages,eps, iges , igs, dwt, dng, ifc, dwfx, stl, cf2, plt等格式支持
|
||||
|
||||
#### 优化:
|
||||
1. 调整生成的PDF文件 文件名称添加文件后缀 防止生成同名文件
|
||||
2. 调整SQL文件预览方式
|
||||
3. 优化OFD预览兼容性
|
||||
4. 美化TXT文本 分页框的显示
|
||||
5. 升级Linux、Docker版内置office为LibreOffice-7.5.3版本
|
||||
6. 升级Windows版内置office为LibreOffice-7.5.3 Portable版本
|
||||
7. 其他功能优化
|
||||
|
||||
#### 修复:
|
||||
1. 修复反代情况下压缩包获取路径错误
|
||||
2. 修复预览图片的url中如果包含&会导致.click报错
|
||||
3. 修复OFD预览部分已知问题
|
||||
4. 修复预览压缩包时,如果点击的是文件目录(树节点),页面会报错
|
||||
5. 其他已知问题修复
|
||||
|
||||
#### > 2023年04月18日,v4.2.1 版本发布 :
|
||||
|
||||
#### 更新日志:
|
||||
|
||||
1. 修复 dwg 文件预览报空指针的 bug
|
||||
|
||||
#### > 2023年04月13日,v4.2.0 版本发布 :
|
||||
|
||||
#### 新增功能:
|
||||
1. 新增 SVG 格式文件预览支持
|
||||
2. 新增加密的 Office 文件预览支持
|
||||
3. 新增加密的 zip、rar 等压缩包文件预览支持
|
||||
4. 新增 xmind 软件模型文件预览支持
|
||||
5. 新增 bpmn 工作流模型文件预览支持
|
||||
6. 新增 eml 邮件文件预览支持
|
||||
7. 新增 epub 电子书文件预览支持
|
||||
8. 新增 dotm,ett,xlt,xltm,wpt,dot,xlam,xla,dotx 等格式的办公文档预览支持
|
||||
9. 新增 obj, 3ds, stl, ply, gltf, glb, off, 3dm, fbx, dae, wrl, 3mf, ifc, brep, step, iges, fcstd, bim 等 3D 模型文件预览支持
|
||||
10. 新增可配置限制高风险文件上传的功能,比如 exe 文件
|
||||
11. 新增可配置站点的备案信息
|
||||
12. 新增演示站点删除文件需要密码的功能
|
||||
|
||||
#### 优化:
|
||||
1. 文本文档预览加入缓存
|
||||
2. 美化 404、500 报错页
|
||||
3. 优化发票等 ofd 文件预览的印证渲染兼容性
|
||||
4. 移除 office-plugin 模块, 使用新版 jodconverter组件
|
||||
5. 优化 Excel 文件的预览效果
|
||||
6. 优化 CAD 文件的预览效果
|
||||
7. 更新 xstream 、junrar、pdfbox 等依赖的版本
|
||||
8. 更新 TIF 文件转换 PDF 的插件,添加转换缓存
|
||||
9. 优化演示页 UI 部署
|
||||
10. 压缩包文件预览支持目录
|
||||
|
||||
#### 修复:
|
||||
1. 修复部分接口 XSS 问题
|
||||
2. 修复控制台打印的演示地址不跟着 content-path 配置走的问题
|
||||
3. 修复 ofd 文件预览跨域问题
|
||||
4. 修复内部自签证书 https 协议 url 文件无法下载的问题
|
||||
5. 修复特殊符号的文件无法删除的问题
|
||||
6. 修复 PDF 转图片,内存无法回收导致的 OOM
|
||||
7. 修复 xlsx7.4 以上版本文件预览乱码的问题
|
||||
8. 修复 TrustHostFilter 未拦截跨域接口的问题,这是一个安全问题,有使用到 TrustHost 功能的务必升级
|
||||
9. 修复压缩包文件预览在 Linux 系统下文件名乱码的问题
|
||||
10. 修复 ofd 文件预览页码只能显示10页的问题
|
||||
|
||||
#### > 2022年12月14日,v4.1.0 版本发布 :
|
||||
|
||||
1. 全新首页视觉 @wsd7747
|
||||
2. tif图片预览兼容多页tif的pdf转换、jpg转换,以及jpg在线多页预览功能 @zhangzhen1979
|
||||
@@ -142,7 +286,7 @@ pdf预览模式预览效果如下
|
||||
|
||||
感谢 @yl-yue @wsd7747 @zhangzhen1979 @tomhusky @shenghuadun @kischn.sun 的代码贡献
|
||||
|
||||
> 2021年7月6日,v4.0.0 版本发布 :
|
||||
#### > 2021年7月6日,v4.0.0 版本发布 :
|
||||
|
||||
1. 底层集成OpenOffice替换为LibreOffice,Office文件兼容性增强,预览效果提升
|
||||
2. 修复压缩文件目录穿越漏洞
|
||||
@@ -153,7 +297,7 @@ pdf预览模式预览效果如下
|
||||
7. 优化Windows环境下,查找Office组件逻辑(内置的LibreOffice优先)
|
||||
8. 优化启动Office进程改同步执行
|
||||
|
||||
> 2021年6月17日,v3.6.0 版本发布 :
|
||||
#### > 2021年6月17日,v3.6.0 版本发布 :
|
||||
|
||||
ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献,感谢 @gaoxingzaq、@zhangxiaoxiao9527 的代码贡献
|
||||
1. 新增 ofd 类型文件预览支持,ofd 是国产的类似 pdf 格式的文件
|
||||
@@ -161,7 +305,7 @@ ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献
|
||||
3. 美化了 ppt、pptx 类型文件预览效果,比之前版本好看太多
|
||||
4. 更新了 pdfbox、xstream、common-io 等依赖的版本
|
||||
|
||||
> 2021年1月28日 :
|
||||
#### > 2021年1月28日 :
|
||||
|
||||
2020农历年最后一个版本发布,主要包含了部分 UI 改进,和解决了 QQ 群友、 Issue 里反馈的 Bug 修复,最最重要的是发个新版,过个好年
|
||||
|
||||
@@ -184,7 +328,7 @@ ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献
|
||||
17. escaping of dangerous characters to prevent reflected xss
|
||||
18. 修复重复编码导致文档转图片预览失败的问题&编码规范
|
||||
|
||||
> 2020年12月27日 :
|
||||
#### > 2020年12月27日 :
|
||||
|
||||
2020年年终大版本更新,架构全面设计,代码全面重构,代码质量全面提升,二次开发更便捷,欢迎拉源码品鉴,提issue、pr共同建设
|
||||
|
||||
@@ -204,7 +348,7 @@ ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献
|
||||
14. 修复压缩包里文件再次预览失败的bug
|
||||
15. 修复图片预览的bug
|
||||
|
||||
> 2020年05月20日 :
|
||||
#### > 2020年05月20日 :
|
||||
1. 新增支持全局水印,并支持通过参数动态改变水印内容
|
||||
2. 新增支持CAD文件预览
|
||||
3. 新增base.url配置,支持使用nginx反向代理和使用context-path
|
||||
@@ -222,35 +366,35 @@ ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献
|
||||
15. 官网建设:[https://kkview.cn](https://kkview.cn/)
|
||||
16. 官方Docker镜像仓库建设:[https://hub.docker.com/r/keking/kkfileview](https://hub.docker.com/r/keking/kkfileview)
|
||||
|
||||
> 2019年06月18日 :
|
||||
#### > 2019年06月18日 :
|
||||
1. 支持自动清理缓存及预览文件
|
||||
2. 支持http/https下载流url文件预览
|
||||
3. 支持FTP url文件预览
|
||||
4. 加入Docker构建
|
||||
|
||||
> 2019年04月08日 :
|
||||
#### > 2019年04月08日 :
|
||||
1. 缓存及队列实现抽象,提供JDK和REDIS两种实现(REDIS成为可选依赖)
|
||||
2. 打包方式提供zip和tar.gz包,并提供一键启动脚本
|
||||
|
||||
> 2018年01月19日 :
|
||||
#### > 2018年01月19日 :
|
||||
|
||||
1. 大文件入队提前处理
|
||||
1. 新增addTask文件转换入队接口
|
||||
1. 采用redis队列,支持kkFIleView接口和异构系统入队两种方式
|
||||
|
||||
> 2018年01月17日 :
|
||||
#### > 2018年01月17日 :
|
||||
|
||||
1. 优化项目结构,抽象文件预览接口,更方便的加入更多的文件类型预览支持,方便二次开发
|
||||
1. 新增英文文档说明(@幻幻Fate,@汝辉)贡献
|
||||
1. 新增图片预览文件支持类型
|
||||
1. 修复压缩包内轮播图片总是从第一张开始的问题
|
||||
|
||||
> 2018年01月12日 :
|
||||
#### > 2018年01月12日 :
|
||||
|
||||
1. 新增多图片同时预览
|
||||
1. 支持压缩包内图片轮番预览
|
||||
|
||||
> 2018年01月02日 :
|
||||
#### > 2018年01月02日 :
|
||||
|
||||
1. 修复txt等文本编码问题导致预览乱码
|
||||
1. 修复项目模块依赖引入不到的问题
|
||||
@@ -265,14 +409,15 @@ xmind 引用于 [ xmind-embed-viewer](https://github.com/xmindltd/xmind-embed-v
|
||||
epub 引用于 [ epub.js](https://github.com/futurepress/epub.js) 开源协议 BSD许可证
|
||||
压缩包 引用于 [sevenzipjbinding](https://github.com/borisbrodski/sevenzipjbinding )开源协议LGPL
|
||||
3D 引用于 [Online3DViewer](https://github.com/kovacsv/Online3DViewer )开源协议MIT
|
||||
drawio 引用于 [drawio](https://github.com/jgraph/drawio )开源协议 Apache-2.0
|
||||
bpmn流程图 引用于 [bpmn-js](https://github.com/bpmn-io/bpmn-js ) 自定义协议 保留水印 具体自行查看
|
||||
dcm医疗数位影像 引用于 [dcmjs](https://github.com/dcmjs-org/dcmjs )开源协议MIT
|
||||
|
||||
### 使用登记
|
||||
如果这个项目解决了你的实际问题,可在 https://gitee.com/kekingcn/file-online-preview/issues/IGSBV
|
||||
登记下,如果节省了你的三方预览服务费用,也愿意支持下的话,可点击下方【捐助】请作者喝杯咖啡,也是非常感谢
|
||||
|
||||
### Stars 趋势图
|
||||
#### Gitee
|
||||
[](https://whnb.wang/kekingcn/file-online-preview?e=86400)
|
||||
### Stars
|
||||
|
||||
#### GitHub
|
||||
|
||||
|
||||
174
SECURITY_CONFIG.md
Normal file
@@ -0,0 +1,174 @@
|
||||
# kkFileView 安全配置指南
|
||||
|
||||
## ⚠️ 重要安全更新
|
||||
|
||||
从 4.4.0 之后版本开始,kkFileView 增强了安全性,默认拒绝所有未配置的外部文件预览请求,以防止 SSRF(服务器端请求伪造)攻击。
|
||||
|
||||
## 🔒 安全配置说明
|
||||
|
||||
### 1. 信任主机白名单配置(推荐)
|
||||
|
||||
在 `application.properties` 中配置允许预览的域名:
|
||||
|
||||
```properties
|
||||
# 方式1:通过配置文件
|
||||
trust.host = kkview.cn,yourdomain.com,cdn.example.com
|
||||
|
||||
# 方式2:通过环境变量
|
||||
KK_TRUST_HOST=kkview.cn,yourdomain.com,cdn.example.com
|
||||
```
|
||||
|
||||
**示例场景**:
|
||||
- 只允许预览来自 `oss.aliyuncs.com` 和 `cdn.example.com` 的文件
|
||||
```properties
|
||||
trust.host = oss.aliyuncs.com,cdn.example.com
|
||||
```
|
||||
|
||||
### 2. 允许所有主机(不推荐,仅测试环境)
|
||||
|
||||
```properties
|
||||
trust.host = *
|
||||
```
|
||||
|
||||
⚠️ **警告**:此配置会允许访问任意外部地址,存在安全风险,仅应在测试环境使用!
|
||||
|
||||
### 3. 黑名单配置(高级)
|
||||
|
||||
禁止特定域名或内网地址:
|
||||
|
||||
```properties
|
||||
# 禁止访问内网地址(强烈推荐)
|
||||
not.trust.host = localhost,127.0.0.1,192.168.*,10.*,172.16.*,169.254.*
|
||||
|
||||
# 禁止特定恶意域名
|
||||
not.trust.host = malicious-site.com,spam-domain.net
|
||||
```
|
||||
|
||||
**优先级**:黑名单 > 白名单
|
||||
|
||||
### 4. Docker 环境配置
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
-e KK_TRUST_HOST=yourdomain.com,cdn.example.com \
|
||||
-e KK_NOT_TRUST_HOST=localhost,127.0.0.1 \
|
||||
-p 8012:8012 \
|
||||
keking/kkfileview:4.4.0
|
||||
```
|
||||
|
||||
## 🛡️ 安全最佳实践
|
||||
|
||||
### ✅ 推荐配置
|
||||
|
||||
```properties
|
||||
# 1. 明确配置信任主机白名单
|
||||
trust.host = your-cdn.com,your-storage.com
|
||||
|
||||
# 2. 配置黑名单防止内网访问
|
||||
not.trust.host = localhost,127.0.0.1,192.168.*,10.*,172.16.*
|
||||
|
||||
# 3. 禁用文件上传(生产环境)
|
||||
file.upload.disable = true
|
||||
|
||||
# 4. 配置基础URL(使用反向代理时)
|
||||
base.url = https://preview.yourdomain.com
|
||||
```
|
||||
|
||||
### ❌ 不推荐配置
|
||||
|
||||
```properties
|
||||
# 危险:允许所有主机访问
|
||||
trust.host = *
|
||||
|
||||
# 危险:启用文件上传(生产环境)
|
||||
file.upload.disable = false
|
||||
```
|
||||
|
||||
## 🔍 配置验证
|
||||
|
||||
### 测试白名单是否生效
|
||||
|
||||
1. 配置白名单:
|
||||
```properties
|
||||
trust.host = kkview.cn
|
||||
```
|
||||
|
||||
2. 尝试预览白名单内的文件:
|
||||
```
|
||||
http://localhost:8012/onlinePreview?url=https://kkview.cn/test.pdf
|
||||
✅ 应该可以正常预览
|
||||
```
|
||||
|
||||
3. 尝试预览白名单外的文件:
|
||||
```
|
||||
http://localhost:8012/onlinePreview?url=https://other-domain.com/test.pdf
|
||||
❌ 应该被拒绝,显示"不信任的文件源"
|
||||
```
|
||||
|
||||
### 测试黑名单是否生效
|
||||
|
||||
1. 配置黑名单:
|
||||
```properties
|
||||
not.trust.host = localhost,127.0.0.1
|
||||
```
|
||||
|
||||
2. 尝试访问本地文件:
|
||||
```
|
||||
http://localhost:8012/getCorsFile?urlPath=http://127.0.0.1:8080/admin
|
||||
❌ 应该被拒绝
|
||||
```
|
||||
|
||||
## 📋 常见问题
|
||||
|
||||
### Q1: 升级后无法预览文件了?
|
||||
|
||||
**原因**:新版本默认拒绝未配置的主机。
|
||||
|
||||
**解决**:在配置文件中添加信任主机列表:
|
||||
```properties
|
||||
trust.host = your-file-server.com
|
||||
```
|
||||
|
||||
### Q2: 如何临时恢复旧版本行为?
|
||||
|
||||
**不推荐**,但如果确实需要:
|
||||
```properties
|
||||
trust.host = *
|
||||
```
|
||||
|
||||
### Q3: 配置了白名单但还是无法访问?
|
||||
|
||||
检查以下几点:
|
||||
1. 域名是否完全匹配(区分大小写)
|
||||
2. 是否配置了黑名单,黑名单优先级更高
|
||||
3. 查看日志中的 WARNING 信息
|
||||
4. 确认环境变量是否正确设置
|
||||
|
||||
### Q4: 如何允许子域名?
|
||||
|
||||
已支持通配符域名匹配,可使用 `*.example.com`:
|
||||
```properties
|
||||
trust.host = *.example.com
|
||||
```
|
||||
|
||||
说明:
|
||||
- `*.example.com` 会匹配 `cdn.example.com`、`api.internal.example.com`,但不匹配根域 `example.com`
|
||||
- 对于 IP 风格通配(如 `192.168.*`、`10.*`),仅匹配字面量 IPv4 地址,不匹配域名
|
||||
|
||||
## 🚨 安全事件响应
|
||||
|
||||
如果发现可疑的预览请求:
|
||||
|
||||
1. 检查日志文件,搜索 "拒绝访问主机" 关键字
|
||||
2. 确认 `trust.host` 配置是否合理
|
||||
3. 检查是否有异常的网络请求
|
||||
4. 如发现攻击行为,及时更新黑名单配置
|
||||
|
||||
## 📞 获取帮助
|
||||
|
||||
- GitHub Issues: https://github.com/kekingcn/kkFileView/issues
|
||||
- Gitee Issues: https://gitee.com/kekingcn/file-online-preview/issues
|
||||
|
||||
---
|
||||
|
||||
**安全提示**:定期检查和更新信任主机列表,遵循最小权限原则。
|
||||
BIN
doc/img/preview/preview-3ds.png
Normal file
|
After Width: | Height: | Size: 150 KiB |
BIN
doc/img/preview/preview-audio.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
doc/img/preview/preview-bpmn.png
Normal file
|
After Width: | Height: | Size: 135 KiB |
BIN
doc/img/preview/preview-cad-image.png
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
doc/img/preview/preview-cad-pdf.png
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
doc/img/preview/preview-dcm.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
doc/img/preview/preview-doc-image.png
Normal file
|
After Width: | Height: | Size: 159 KiB |
BIN
doc/img/preview/preview-doc-pdf.png
Normal file
|
After Width: | Height: | Size: 219 KiB |
BIN
doc/img/preview/preview-drawio.png
Normal file
|
After Width: | Height: | Size: 320 KiB |
BIN
doc/img/preview/preview-image.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
doc/img/preview/preview-pdf-image.png
Normal file
|
After Width: | Height: | Size: 187 KiB |
BIN
doc/img/preview/preview-pdf-pdf.png
Normal file
|
After Width: | Height: | Size: 254 KiB |
BIN
doc/img/preview/preview-ppt-image.png
Normal file
|
After Width: | Height: | Size: 392 KiB |
BIN
doc/img/preview/preview-ppt-pdf.png
Normal file
|
After Width: | Height: | Size: 211 KiB |
BIN
doc/img/preview/preview-text.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
doc/img/preview/preview-video.png
Normal file
|
After Width: | Height: | Size: 469 KiB |
BIN
doc/img/preview/preview-xls.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
doc/img/preview/preview-xlsx-web.png
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
doc/img/preview/preview-xmind.png
Normal file
|
After Width: | Height: | Size: 252 KiB |
BIN
doc/img/preview/preview-zip-inner.png
Normal file
|
After Width: | Height: | Size: 236 KiB |
BIN
doc/img/preview/preview-zip.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
28
docker/kkfileview-base/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list.d/ubuntu.sources &&\
|
||||
sed -i 's@//security.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list.d/ubuntu.sources &&\
|
||||
sed -i 's@//ports.ubuntu.com@//mirrors.aliyun.com@g' /etc/apt/sources.list.d/ubuntu.sources &&\
|
||||
apt-get update &&\
|
||||
export DEBIAN_FRONTEND=noninteractive &&\
|
||||
apt-get install -y --no-install-recommends openjdk-21-jre tzdata locales xfonts-utils fontconfig libreoffice-nogui &&\
|
||||
echo 'Asia/Shanghai' > /etc/timezone &&\
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&\
|
||||
localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 &&\
|
||||
locale-gen zh_CN.UTF-8 &&\
|
||||
apt-get install -y --no-install-recommends ttf-mscorefonts-installer &&\
|
||||
apt-get install -y --no-install-recommends ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy &&\
|
||||
apt-get autoremove -y &&\
|
||||
apt-get clean &&\
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 内置一些常用的中文字体,避免普遍性乱码
|
||||
ADD fonts/* /usr/share/fonts/chinese/
|
||||
|
||||
RUN cd /usr/share/fonts/chinese &&\
|
||||
# 安装字体
|
||||
mkfontscale &&\
|
||||
mkfontdir &&\
|
||||
fc-cache -fv
|
||||
|
||||
ENV LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8
|
||||
50
docker/kkfileview-base/README.cn.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# 构建说明
|
||||
|
||||
由于 kkfileview 的基础运行环境很少变动且制作耗时较久,而 kkfileview 本身代码开发会频繁改动,因此把制作其 Docker 镜像的步骤拆分为两次:
|
||||
|
||||
首先制作 kkfileview 的基础镜像(kkfileview-base)。
|
||||
|
||||
然后使用 kkfileview-base 作为基础镜像进行构建,加快 kkfileview docker 镜像构建与发布。
|
||||
|
||||
执行如下命令即可构建基础镜像:
|
||||
> 这里镜像 tag 以 4.4.0 为例,本项目所维护的 Dockerfile 文件考虑了跨平台兼容性。 如果你需要用到 arm64 架构镜像, 则在arm64 架构机器上同样执行下面的构建命令即可
|
||||
|
||||
```shell
|
||||
docker build --tag keking/kkfileview-base:4.4.0 .
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 跨平台构建
|
||||
|
||||
`docker buildx` 支持在一台机器上构建出多种平台架构的镜像。推荐使用该能力进行跨平台的镜像构建。
|
||||
例如,执行 `docker buildx build` 命令时加上 `--platform=linux/arm64` 参数即可构建出 arm64 架构镜像。这极大方便了那些没有arm64 架构机器却想构建 arm64 架构镜像的用户。
|
||||
|
||||
> 当前本项目仅支持构建 linux/amd64 和 linux/arm64 两种平台架构的镜像
|
||||
> buildx 的 builder driver 可以使用默认的 `docker` 类型, 若使用 `docker-container` 类型可以支持并行构建多种架构, 本文不再赘述, 有兴趣可以自行了解。参考 [Docker Buildx | Docker Documentation](https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images)
|
||||
|
||||
**前提要求**
|
||||
|
||||
以当前机器为 amd64 (x86_64)架构为例。需要开启 docker 的 buildx 特性,以及开启 Linux 的 QEMU 用户模式:
|
||||
|
||||
> 使用 WSL2 的 Windows 用户如果安装了最新的 DockerDesktop, 则这些前提要求已满足, 无需额外下述设置。
|
||||
|
||||
1. 安装 docker buildx 客户端插件:
|
||||
> docker 版本要求 >=19.03
|
||||
|
||||
若已安装, 则跳过。详情参考 https://github.com/docker/buildx
|
||||
|
||||
2. 开启 QEMU 的用户模式功能, 并安装其它平台的模拟器:
|
||||
> Linux 内核要求 >=4.8
|
||||
|
||||
使用 `tonistiigi/binfmt` 镜像可快速开启并安装模拟器,执行下面命令:
|
||||
|
||||
```shell
|
||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
||||
```
|
||||
|
||||
现在就可以愉快地开始构建了,构建命令示例:
|
||||
|
||||
```shell
|
||||
docker buildx build --platform=linux/amd64,linux/arm64 -t keking/kkfileview-base:4.4.0 --push .
|
||||
```
|
||||
53
docker/kkfileview-base/README.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Build Instructions
|
||||
|
||||
Since the base runtime environment for kkfileview rarely changes and takes a long time to build, while the kkfileview code itself is frequently updated, the process of building its Docker image is split into two steps:
|
||||
|
||||
First, create the base image for kkfileview (kkfileview-base).
|
||||
|
||||
Then, use kkfileview-base as the base image to build and speed up the kkfileview Docker image build and release process.
|
||||
|
||||
To build the base image, run the following command:
|
||||
|
||||
> In this example, the image tag is 4.4.0. The Dockerfile maintained in this project considers cross-platform compatibility. If you need an arm64 architecture image, run the same build command on an arm64 architecture machine.
|
||||
|
||||
```shell
|
||||
docker build --tag keking/kkfileview-base:4.4.0 .
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Cross-Platform Build
|
||||
|
||||
`docker buildx` supports building images for multiple platform architectures on a single machine. It is recommended to use this capability for cross-platform image builds.
|
||||
For example, adding the `--platform=linux/arm64` parameter when executing the `docker buildx build` command will allow you to build an arm64 architecture image. This is particularly convenient for users who want to build arm64 images but don't have an arm64 machine.
|
||||
|
||||
> Currently, this project only supports building images for the linux/amd64 and linux/arm64 architectures.
|
||||
> The buildx builder driver can use the default `docker` type, but if you use the `docker-container` type, you can build multiple architectures in parallel. This README will not cover that in detail, you can learn more on your own. Refer to [Docker Buildx | Docker Documentation](https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images)
|
||||
|
||||
**Prerequisites**
|
||||
|
||||
Assuming the current machine is amd64 (x86_64) architecture, you'll need to enable the docker buildx feature and enable Linux QEMU user mode:
|
||||
|
||||
> Windows users with WSL2 who have installed a recent version of Docker Desktop will already meet these prerequisites, so no additional setup is required.
|
||||
|
||||
1. Install the docker buildx client plugin:
|
||||
|
||||
> Docker version >=19.03 is required.
|
||||
|
||||
If it's already installed, you can skip this step. For more details, refer to https://github.com/docker/buildx.
|
||||
|
||||
2. Enable QEMU user mode and install emulators for other platforms:
|
||||
|
||||
> Linux kernel version >=4.8 is required.
|
||||
|
||||
You can quickly enable and install emulators using the tonistiigi/binfmt image by running the following command:
|
||||
|
||||
```shell
|
||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
||||
```
|
||||
|
||||
Now you can enjoy the building. Here’s an example build command:
|
||||
|
||||
```shell
|
||||
docker buildx build --platform=linux/amd64,linux/arm64 -t keking/kkfileview-base:4.4.0 --push .
|
||||
```
|
||||
@@ -1,38 +0,0 @@
|
||||
FROM ubuntu:20.04
|
||||
MAINTAINER chenjh "842761733@qq.com"
|
||||
# 内置一些常用的中文字体,避免普遍性乱码
|
||||
COPY fonts/* /usr/share/fonts/chinese/
|
||||
RUN apt-get clean && apt-get update &&\
|
||||
sed -i 's/http:\/\/archive.ubuntu.com/https:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list &&\
|
||||
sed -i 's/# deb/deb/g' /etc/apt/sources.list &&\
|
||||
apt-get install -y --reinstall ca-certificates &&\
|
||||
apt-get clean && apt-get update &&\
|
||||
apt-get install -y locales language-pack-zh-hans &&\
|
||||
localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 && locale-gen zh_CN.UTF-8 &&\
|
||||
export DEBIAN_FRONTEND=noninteractive &&\
|
||||
apt-get install -y tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&\
|
||||
apt-get install -y fontconfig ttf-mscorefonts-installer ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy &&\
|
||||
apt-get install -y wget &&\
|
||||
cd /tmp &&\
|
||||
wget https://kkview.cn/resource/server-jre-8u251-linux-x64.tar.gz &&\
|
||||
tar -zxf /tmp/server-jre-8u251-linux-x64.tar.gz && mv /tmp/jdk1.8.0_251 /usr/local/ &&\
|
||||
|
||||
# 安装 libreoffice
|
||||
apt-get install -y libxrender1 libxinerama1 libxt6 libxext-dev libfreetype6-dev libcairo2 libcups2 libx11-xcb1 libnss3 &&\
|
||||
wget https://downloadarchive.documentfoundation.org/libreoffice/old/7.5.3.2/deb/x86_64/LibreOffice_7.5.3.2_Linux_x86-64_deb.tar.gz -cO libreoffice_deb.tar.gz &&\
|
||||
tar -zxf /tmp/libreoffice_deb.tar.gz && cd /tmp/LibreOffice_7.5.3.2_Linux_x86-64_deb/DEBS &&\
|
||||
dpkg -i *.deb &&\
|
||||
|
||||
# 清理临时文件
|
||||
rm -rf /tmp/* && rm -rf /var/lib/apt/lists/* &&\
|
||||
cd /usr/share/fonts/chinese &&\
|
||||
mkfontscale &&\
|
||||
mkfontdir &&\
|
||||
fc-cache -fv
|
||||
|
||||
ENV JAVA_HOME /usr/local/jdk1.8.0_251
|
||||
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
||||
ENV PATH $PATH:$JAVA_HOME/bin
|
||||
ENV LANG zh_CN.UTF-8
|
||||
ENV LC_ALL zh_CN.UTF-8
|
||||
CMD ["/bin/bash"]
|
||||
@@ -1,2 +0,0 @@
|
||||
# 执行如下命令构建基础镜像,加快kkfileview docker镜像构建与发布
|
||||
docker build --tag keking/kkfileview-jdk:4.3.0 .
|
||||
23
pom.xml
@@ -6,23 +6,23 @@
|
||||
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>kkFileView-parent</artifactId>
|
||||
<version>4.3.0</version>
|
||||
<version>4.4.0</version>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>21</java.version>
|
||||
<jodconverter.version>4.4.6</jodconverter.version>
|
||||
<spring.boot.version>2.4.2</spring.boot.version>
|
||||
<spring.boot.version>3.5.6</spring.boot.version>
|
||||
<poi.version>5.2.2</poi.version>
|
||||
<xdocreport.version>1.0.6</xdocreport.version>
|
||||
<xstream.version>1.4.20</xstream.version>
|
||||
<junrar.version>7.5.4</junrar.version>
|
||||
<redisson.version>3.2.0</redisson.version>
|
||||
<junrar.version>7.5.5</junrar.version>
|
||||
<redisson.version>3.22.0</redisson.version>
|
||||
<sevenzipjbinding.version>16.02-2.01</sevenzipjbinding.version>
|
||||
<jchardet.version>1.0</jchardet.version>
|
||||
<antlr.version>2.7.7</antlr.version>
|
||||
<concurrentlinkedhashmap.version>1.4.2</concurrentlinkedhashmap.version>
|
||||
<rocksdb.version>5.17.2</rocksdb.version>
|
||||
<pdfbox.version>2.0.27</pdfbox.version>
|
||||
<pdfbox.version>3.0.2</pdfbox.version>
|
||||
<jai-imageio.version>1.4.0</jai-imageio.version>
|
||||
<jbig2-imageio.version>3.0.4</jbig2-imageio.version>
|
||||
<galimatias.version>0.2.1</galimatias.version>
|
||||
@@ -32,15 +32,18 @@
|
||||
<ffmpeg.version>4.2.1-1.5.2</ffmpeg.version>
|
||||
<itextpdf.version>5.5.13.3</itextpdf.version>
|
||||
<httpclient.version>3.1</httpclient.version>
|
||||
<aspose-cad.version>23.1</aspose-cad.version>
|
||||
<aspose-cad.version>23.9</aspose-cad.version>
|
||||
<bcprov-jdk15on.version>1.70</bcprov-jdk15on.version>
|
||||
<juniversalchardet.version>1.0.3</juniversalchardet.version>
|
||||
<httpcomponents.version>4.5.14</httpcomponents.version>
|
||||
|
||||
<commons-cli.version>1.2</commons-cli.version>
|
||||
<commons-net.version>3.6</commons-net.version>
|
||||
<commons-lang3.version>3.7</commons-lang3.version>
|
||||
<commons-cli.version>1.5.0</commons-cli.version>
|
||||
<commons-net.version>3.9.0</commons-net.version>
|
||||
<commons-lang3.version>3.13.0</commons-lang3.version>
|
||||
|
||||
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.release>${java.version}</maven.compiler.release>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>kkFileView-parent</artifactId>
|
||||
<groupId>cn.keking</groupId>
|
||||
<version>4.3.0</version>
|
||||
<version>4.4.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>kkFileView</artifactId>
|
||||
@@ -44,21 +44,16 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!-- web end -->
|
||||
|
||||
<!-- poi start -->
|
||||
@@ -99,6 +94,10 @@
|
||||
<version>${xdocreport.version}</version>
|
||||
</dependency>
|
||||
<!-- poi start -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 对 rar5 的支持 和其他众多压缩支持 可参考 package net.sf.sevenzipjbinding.ArchiveFormat; -->
|
||||
<dependency>
|
||||
@@ -122,6 +121,14 @@
|
||||
<artifactId>redisson</artifactId>
|
||||
<version>${redisson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 编码检测-JUniversalCharDet-->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.juniversalchardet</groupId>
|
||||
<artifactId>juniversalchardet</artifactId>
|
||||
<version>${juniversalchardet.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 解压(rar)-->
|
||||
<dependency>
|
||||
<groupId>com.github.junrar</groupId>
|
||||
@@ -169,6 +176,12 @@
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>${pdfbox.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
@@ -314,6 +327,14 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<parameters>true</parameters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||
<id>make-assembly</id>
|
||||
<id>assembly-linux</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||
<id>make-assembly</id>
|
||||
<id>assembly-windows</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
|
||||
@@ -8,7 +8,7 @@ install_redhat() {
|
||||
yum install -y libSM.x86_64 libXrender.x86_64 libXext.x86_64
|
||||
yum groupinstall -y "X Window System"
|
||||
yum localinstall -y *.rpm
|
||||
echo 'install finshed...'
|
||||
echo 'install finished...'
|
||||
else
|
||||
echo 'download package error...'
|
||||
fi
|
||||
@@ -20,7 +20,7 @@ install_ubuntu() {
|
||||
if [ $? -eq 0 ];then
|
||||
apt-get install -y libxinerama1 libcairo2 libcups2 libx11-xcb1
|
||||
dpkg -i *.deb
|
||||
echo 'install finshed...'
|
||||
echo 'install finished...'
|
||||
else
|
||||
echo 'download package error...'
|
||||
fi
|
||||
|
||||
@@ -7,4 +7,4 @@ echo Please check log file in ../log/kkFileView.log for more information
|
||||
echo You can get help in our official home site: https://kkview.cn
|
||||
echo If you need further help, please join our kk opensource community: https://t.zsxq.com/09ZHSXbsQ
|
||||
echo If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers
|
||||
java -Dspring.config.location=..\config\application.properties -jar kkFileView-4.3.0.jar -> ..\log\kkFileView.log
|
||||
java -Dspring.config.location=..\config\application.properties -jar kkFileView-4.4.0.jar -> ..\log\kkFileView.log
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# Description: v1.1:修改进程启动机制为pid形式。
|
||||
#############################
|
||||
#
|
||||
DIR_HOME=("/opt/openoffice.org3" "/opt/libreoffice" "/opt/libreoffice6.1" "/opt/libreoffice7.0" "/opt/libreoffice7.1" "/opt/libreoffice7.2" "/opt/libreoffice7.3" "/opt/libreoffice7.4" "/opt/openoffice4" "/usr/lib/openoffice" "/usr/lib/libreoffice")
|
||||
DIR_HOME=("/opt/openoffice.org3" "/opt/libreoffice" "/opt/libreoffice6.1" "/opt/libreoffice7.0" "/opt/libreoffice7.1" "/opt/libreoffice7.2" "/opt/libreoffice7.3" "/opt/libreoffice7.4" "/opt/libreoffice7.5" "/opt/libreoffice7.6" "/opt/libreoffice24.2" "/opt/libreoffice24.8" "/opt/libreoffice25.2" "/opt/openoffice4" "/usr/lib/openoffice" "/usr/lib/libreoffice")
|
||||
FLAG=
|
||||
OFFICE_HOME=
|
||||
KKFILEVIEW_BIN_FOLDER=$(cd "$(dirname "$0")" || exit 1 ;pwd)
|
||||
@@ -29,7 +29,7 @@ if [ -s "${PID_FILE}" ]; then
|
||||
else
|
||||
cd "$KKFILEVIEW_BIN_FOLDER" || exit 1
|
||||
echo "Using KKFILEVIEW_BIN_FOLDER $KKFILEVIEW_BIN_FOLDER"
|
||||
grep 'office\.home' ../config/application.properties | grep '!^#'
|
||||
grep 'office\.home' ../config/application.properties | grep -v '^#' | grep -v 'default'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Using customized office.home"
|
||||
else
|
||||
@@ -51,12 +51,12 @@ else
|
||||
|
||||
## 启动kkFileView
|
||||
echo "Starting kkFileView..."
|
||||
nohup java -Dfile.encoding=UTF-8 -Dspring.config.location=../config/application.properties -jar kkFileView-4.3.0.jar > ../log/kkFileView.log 2>&1 &
|
||||
nohup java -Dfile.encoding=UTF-8 -Dspring.config.location=../config/application.properties -jar kkFileView-4.4.0.jar > ../log/kkFileView.log 2>&1 &
|
||||
echo "Please execute ./showlog.sh to check log for more information"
|
||||
echo "You can get help in our official home site: https://kkview.cn"
|
||||
echo "If you need further help, please join our kk opensource community: https://t.zsxq.com/09ZHSXbsQ"
|
||||
echo "If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers"
|
||||
PROCESS=$(ps -ef | grep kkFileView | awk 'NR==1{print $2}')
|
||||
PROCESS=$(ps -ef | grep -v grep | grep java | grep kkFileView | awk 'NR==1{print $2}')
|
||||
# 启动成功后将进程号写入pid文件
|
||||
echo "$PROCESS" > "$PID_FILE"
|
||||
fi
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
server.port = ${KK_SERVER_PORT:8012}
|
||||
server.servlet.context-path= ${KK_CONTEXT_PATH:/}
|
||||
server.servlet.encoding.charset = utf-8
|
||||
#文件上传限制前端
|
||||
#启用GZIP压缩功能
|
||||
server.compression.enabled = true
|
||||
#允许压缩的响应缓冲区最小字节数,默认2048
|
||||
server.compression.min-response-size = 2048
|
||||
#压缩格式
|
||||
server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain,font/woff,application/font-woff,font/eot,image/svg+xml,image/x-icon
|
||||
# 文件上传限制前端
|
||||
spring.servlet.multipart.max-file-size=500MB
|
||||
#文件上传限制
|
||||
spring.servlet.multipart.max-request-size=500MB
|
||||
@@ -16,29 +22,57 @@ spring.freemarker.expose-request-attributes = true
|
||||
spring.freemarker.expose-session-attributes = true
|
||||
spring.freemarker.request-context-attribute = request
|
||||
spring.freemarker.suffix = .ftl
|
||||
# Spring Boot Actuator 健康检查配置
|
||||
# 开启健康检查端点
|
||||
management.endpoints.web.exposure.include=health,info,metrics
|
||||
# 显示详细的健康检查信息(生产环境建议设置为when-authorized)
|
||||
management.endpoint.health.show-details=always
|
||||
# 启用健康检查组件
|
||||
management.health.defaults.enabled=true
|
||||
|
||||
# office-plugin
|
||||
## office转换服务的进程数,默认开启两个进程
|
||||
|
||||
# office设置
|
||||
#openoffice或LibreOffice home路径
|
||||
#office.home = C:\\Program Files (x86)\\OpenOffice 4
|
||||
office.home = ${KK_OFFICE_HOME:default}
|
||||
## office转换服务的端口,默认开启两个进程
|
||||
office.plugin.server.ports = 2001,2002
|
||||
## office 转换服务 task 超时时间,默认五分钟
|
||||
office.plugin.task.timeout = 5m
|
||||
#此属性设置office进程在重新启动之前可以执行的最大任务数。0表示无限数量的任务(永远不会重新启动)
|
||||
office.plugin.task.maxtasksperprocess = 200
|
||||
#此属性设置处理任务所允许的最长时间。如果任务的处理时间长于此超时,则此任务将中止,并处理下一个任务。
|
||||
office.plugin.task.taskexecutiontimeout = 5m
|
||||
#生成限制 默认不限制 使用方法 (1-5)
|
||||
office.pagerange = ${KK_OFFICE_PAGERANGE:false}
|
||||
#生成水印 默认不启用 使用方法 (kkFileView)
|
||||
office.watermark = ${KK_OFFICE_WATERMARK:false}
|
||||
#OFFICE JPEG图片压缩
|
||||
office.quality = ${KK_OFFICE_QUALITY:80}
|
||||
#图像分辨率限制
|
||||
office.maximageresolution = ${KK_OFFICE_MAXIMAGERESOLUTION:150}
|
||||
#导出书签
|
||||
office.exportbookmarks = ${KK_OFFICE_EXPORTBOOKMARKS:true}
|
||||
#批注作为PDF的注释
|
||||
office.exportnotes = ${KK_OFFICE_EXPORTNOTES:true}
|
||||
#加密文档 生成的PDF文档 添加密码(密码为加密文档的密码)
|
||||
office.documentopenpasswords = ${KK_OFFICE_DOCUMENTOPENPASSWORD:true}
|
||||
#xlsx格式前端解析
|
||||
office.type.web = ${KK_OFFICE_TYPE_WEB:web}
|
||||
|
||||
|
||||
# 其他核心设置
|
||||
#预览生成资源路径(默认为打包根路径下的file目录下)
|
||||
#file.dir = D:\\kkFileview\\
|
||||
file.dir = ${KK_FILE_DIR:default}
|
||||
|
||||
#允许预览的本地文件夹 默认不允许任何本地文件被预览
|
||||
#WINDOWS参考 local.preview.dir = \D:\\kkFileview\\1\\1.txt (注意前面必须添加反斜杠)
|
||||
#LINUX参考 local.preview.dir = /opt/1.txt (注意前面必须是正斜杠)
|
||||
#使用方法 windows file://d:/1/1.txt linux file:/opt/1/1.txt
|
||||
#file 协议参考:https://datatracker.ietf.org/doc/html/rfc8089
|
||||
local.preview.dir = ${KK_LOCAL_PREVIEW_DIR:default}
|
||||
|
||||
|
||||
#openoffice home路径
|
||||
#office.home = C:\\Program Files (x86)\\OpenOffice 4
|
||||
office.home = ${KK_OFFICE_HOME:default}
|
||||
|
||||
#是否启用缓存
|
||||
cache.enabled = ${KK_CACHE_ENABLED:true}
|
||||
#缓存实现类型,不配默认为内嵌RocksDB(type = default)实现,可配置为redis(type = redis)实现(需要配置spring.redisson.address等参数)和 JDK 内置对象实现(type = jdk),
|
||||
cache.type = ${KK_CACHE_TYPE:jdk}
|
||||
#redis连接,只有当cache.type = redis时才有用
|
||||
@@ -48,33 +82,64 @@ spring.redisson.password = ${KK_SPRING_REDISSON_PASSWORD:}
|
||||
cache.clean.enabled = ${KK_CACHE_CLEAN_ENABLED:true}
|
||||
#缓存自动清理时间,cache.clean.enabled = true时才有用,cron表达式,基于Quartz cron
|
||||
cache.clean.cron = ${KK_CACHE_CLEAN_CRON:0 0 3 * * ?}
|
||||
|
||||
#######################################可在运行时动态配置#######################################
|
||||
#提供预览服务的地址,默认从请求url读,如果使用nginx等反向代理,需要手动设置
|
||||
#base.url = https://file.keking.cn
|
||||
base.url = ${KK_BASE_URL:default}
|
||||
|
||||
#信任站点,多个用','隔开,设置了之后,会限制只能预览来自信任站点列表的文件,默认不限制
|
||||
#trust.host = kkview.cn
|
||||
# ========== 安全配置(重要)==========
|
||||
# 信任站点白名单配置,多个用','隔开
|
||||
# ⚠️ 安全提示:为防止SSRF攻击,强烈建议配置信任主机白名单
|
||||
# ⚠️ 如果不配置,系统将默认拒绝所有外部文件预览请求
|
||||
#
|
||||
# 配置示例:
|
||||
# trust.host = kkview.cn,yourdomain.com,cdn.example.com
|
||||
#
|
||||
# 如果需要允许所有域名(不推荐,仅用于测试环境),请设置为:
|
||||
# trust.host = *
|
||||
#
|
||||
# 当前配置:
|
||||
trust.host = ${KK_TRUST_HOST:default}
|
||||
|
||||
#是否启用缓存
|
||||
cache.enabled = ${KK_CACHE_ENABLED:true}
|
||||
|
||||
# 不信任站点黑名单配置,多个用','隔开
|
||||
# 黑名单优先级高于白名单,设置后将禁止预览来自这些站点的文件
|
||||
# 建议配置:禁止访问内网地址和本地地址
|
||||
# not.trust.host = localhost,127.0.0.1,0.0.0.0,192.168.*,10.*,172.16.*
|
||||
not.trust.host= ${KK_NOT_TRUST_HOST:default}
|
||||
#文本类型,默认如下,可自定义添加
|
||||
simText = ${KK_SIMTEXT:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}
|
||||
|
||||
|
||||
#FTP模块设置
|
||||
#预览源为FTP时 FTP用户名,可在ftp url后面加参数ftp.username=ftpuser指定,不指定默认用配置的
|
||||
ftp.username = ${KK_FTP_USERNAME:ftpuser}
|
||||
#预览源为FTP时 FTP密码,可在ftp url后面加参数ftp.password=123456指定,不指定默认用配置的
|
||||
ftp.password = ${KK_FTP_PASSWORD:123456}
|
||||
#预览源为FTP时, FTP连接默认ControlEncoding(根据FTP服务器操作系统选择,Linux一般为UTF-8,Windows一般为GBK),可在ftp url后面加参数ftp.control.encoding=UTF-8指定,不指定默认用配置的
|
||||
ftp.control.encoding = ${KK_FTP_CONTROL_ENCODING:UTF-8}
|
||||
|
||||
#视频设置
|
||||
#多媒体类型,默认如下,可自定义添加
|
||||
media = ${KK_MEDIA:mp3,wav,mp4,flv}
|
||||
media = ${KK_MEDIA:mp3,wav,mp4,flv,mpd,m3u8,ts,mpeg,m4a}
|
||||
#是否开启多媒体类型转视频格式转换,目前可转换视频格式有:avi,mov,wmv,3gp,rm
|
||||
#请谨慎开启此功能,建议异步调用添加到处理队列,并且增加任务队列处理线程,防止视频转换占用完线程资源,转换比较耗费时间,并且控制了只能串行处理转换任务
|
||||
media.convert.disable = ${KK_MEDIA_CONVERT_DISABLE:false}
|
||||
#支持转换的视频类型
|
||||
convertMedias = ${KK_CONVERTMEDIAS:avi,mov,wmv,mkv,3gp,rm}
|
||||
#office类型文档(word ppt)样式,默认为图片(image),可配置为pdf(预览时也有按钮切换)
|
||||
office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:image}
|
||||
#是否关闭office预览切换开关,默认为false,可配置为true关闭
|
||||
office.preview.switch.disabled = ${KK_OFFICE_PREVIEW_SWITCH_DISABLED:false}
|
||||
|
||||
|
||||
|
||||
#PDF预览模块设置
|
||||
#配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
|
||||
pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
|
||||
#PDF转换超时设置 (低于50页) 温馨提示这里数字仅供参考
|
||||
pdf.timeout =${KK_pdf_TIMEOUT:90}
|
||||
#PDF转换超时设置 (高于50小于200页)
|
||||
pdf.timeout80 =${KK_PDF_TIMEOUT80:180}
|
||||
#PDF转换超时设置 (大于200页)
|
||||
pdf.timeout200 =${KK_PDF_TIMEOUT200:300}
|
||||
#PDF转换线程设置
|
||||
pdf.thread =${KK_PDF_THREAD:5}
|
||||
#是否禁止演示模式
|
||||
pdf.presentationMode.disable = ${KK_PDF_PRESENTATION_MODE_DISABLE:true}
|
||||
#是否禁止打开文件
|
||||
@@ -85,15 +150,13 @@ pdf.print.disable = ${KK_PDF_PRINT_DISABLE:true}
|
||||
pdf.download.disable = ${KK_PDF_DOWNLOAD_DISABLE:true}
|
||||
#是否禁止bookmark
|
||||
pdf.bookmark.disable = ${KK_PDF_BOOKMARK_DISABLE:true}
|
||||
#是否禁用首页文件上传
|
||||
file.upload.disable = ${KK_FILE_UPLOAD_ENABLED:false}
|
||||
#是否禁止签名
|
||||
pdf.disable.editing = ${KK_PDF_DISABLE_EDITING:false}
|
||||
#office类型文档(word ppt)样式,默认为图片(image),可配置为pdf(预览时也有按钮切换)
|
||||
office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:image}
|
||||
#是否关闭office预览切换开关,默认为false,可配置为true关闭
|
||||
office.preview.switch.disabled = ${KK_OFFICE_PREVIEW_SWITCH_DISABLED:false}
|
||||
|
||||
#预览源为FTP时 FTP用户名,可在ftp url后面加参数ftp.username=ftpuser指定,不指定默认用配置的
|
||||
ftp.username = ${KK_FTP_USERNAME:ftpuser}
|
||||
#预览源为FTP时 FTP密码,可在ftp url后面加参数ftp.password=123456指定,不指定默认用配置的
|
||||
ftp.password = ${KK_FTP_PASSWORD:123456}
|
||||
#预览源为FTP时, FTP连接默认ControlEncoding(根据FTP服务器操作系统选择,Linux一般为UTF-8,Windows一般为GBK),可在ftp url后面加参数ftp.control.encoding=UTF-8指定,不指定默认用配置的
|
||||
ftp.control.encoding = ${KK_FTP_CONTROL_ENCODING:UTF-8}
|
||||
|
||||
#水印内容
|
||||
#例:watermark.txt = ${WATERMARK_TXT:凯京科技内部文件,严禁外泄}
|
||||
@@ -118,17 +181,38 @@ watermark.height = ${WATERMARK_HEIGHT:80}
|
||||
#水印倾斜度数,要求设置在大于等于0,小于90
|
||||
watermark.angle = ${WATERMARK_ANGLE:10}
|
||||
|
||||
#Tif类型图片浏览模式:tif(利用前端js插件浏览);jpg(转换为jpg后前端显示);pdf(转换为pdf后显示,便于打印)
|
||||
tif.preview.type = ${KK_TIF_PREVIEW_TYPE:tif}
|
||||
#首页功能设置
|
||||
#是否禁用首页文件上传
|
||||
file.upload.disable = ${KK_FILE_UPLOAD_DISABLE:true}
|
||||
# 备案信息,默认为空
|
||||
beian = ${KK_BEIAN:default}
|
||||
#禁止上传类型
|
||||
prohibit = ${KK_PROHIBIT:exe,dll,dat}
|
||||
#启用验证码删除文件 默认关闭
|
||||
delete.captcha= ${KK_DELETE_CAPTCHA:false}
|
||||
#删除密码
|
||||
delete.password = ${KK_DELETE_PASSWORD:123456}
|
||||
#删除 转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间
|
||||
delete.source.file = ${KK_DELETE_SOURCE_FILE:true}
|
||||
#配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
|
||||
pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
|
||||
#xlsx格式前端解析
|
||||
office.type.web = ${KK_OFFICE_TYPE_WEB:web}
|
||||
#首页初始化加载第一页
|
||||
home.pagenumber = ${DEFAULT_HOME_PAGENUMBER:1}
|
||||
#首页是否分页
|
||||
home.pagination = ${DEFAULT_HOME_PAGINATION:true}
|
||||
#首页初始化单页记录数
|
||||
home.pagesize = ${DEFAULT_HOME_PAGSIZE:15}
|
||||
#首页显示查询框
|
||||
home.search = ${DEFAULT_HOME_SEARCH:true}
|
||||
|
||||
#Tif类型设置
|
||||
#Tif类型图片浏览模式:tif(利用前端js插件浏览);jpg(转换为jpg后前端显示);pdf(转换为pdf后显示,便于打印)
|
||||
tif.preview.type = ${KK_TIF_PREVIEW_TYPE:tif}
|
||||
|
||||
#Cad类型设置
|
||||
#Cad类型图片浏览模式:tif(利用前端js插件浏览);svg(转换为svg显示);pdf(转换为pdf后显示,便于打印)
|
||||
cad.preview.type = ${KK_CAD_PREVIEW_TYPE:svg}
|
||||
#Cad转换超时设置
|
||||
cad.timeout =${KK_CAD_TIMEOUT:90}
|
||||
#Cad转换线程设置
|
||||
cad.thread =${KK_CAD_THREAD:5}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
@@ -46,11 +46,13 @@ public class ConfigRefreshComponent {
|
||||
String configFilePath = ConfigUtils.getCustomizedConfigPath();
|
||||
String baseUrl;
|
||||
String trustHost;
|
||||
String notTrustHost;
|
||||
String pdfPresentationModeDisable;
|
||||
String pdfOpenFileDisable;
|
||||
String pdfPrintDisable;
|
||||
String pdfDownloadDisable;
|
||||
String pdfBookmarkDisable;
|
||||
String pdfDisableEditing;
|
||||
boolean fileUploadDisable;
|
||||
String tifPreviewType;
|
||||
String prohibit;
|
||||
@@ -60,7 +62,26 @@ public class ConfigRefreshComponent {
|
||||
String password;
|
||||
int pdf2JpgDpi;
|
||||
String officeTypeWeb;
|
||||
String cadPreviewType;
|
||||
boolean deleteSourceFile;
|
||||
boolean deleteCaptcha;
|
||||
String officPageRange;
|
||||
String officWatermark;
|
||||
String officQuality;
|
||||
String officMaxImageResolution;
|
||||
boolean officExportBookmarks;
|
||||
boolean officeExportNotes;
|
||||
boolean officeDocumentOpenPasswords;
|
||||
String cadTimeout;
|
||||
int cadThread;
|
||||
String homePageNumber;
|
||||
String homePagination;
|
||||
String homePageSize;
|
||||
String homeSearch;
|
||||
int pdfTimeout;
|
||||
int pdfTimeout80;
|
||||
int pdfTimeout200;
|
||||
int pdfThread;
|
||||
while (true) {
|
||||
FileReader fileReader = new FileReader(configFilePath);
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
@@ -76,15 +97,18 @@ public class ConfigRefreshComponent {
|
||||
ftpControlEncoding = properties.getProperty("ftp.control.encoding", ConfigConstants.DEFAULT_FTP_CONTROL_ENCODING);
|
||||
textArray = text.split(",");
|
||||
mediaArray = media.split(",");
|
||||
baseUrl = properties.getProperty("base.url", ConfigConstants.DEFAULT_BASE_URL);
|
||||
trustHost = properties.getProperty("trust.host", ConfigConstants.DEFAULT_TRUST_HOST);
|
||||
baseUrl = properties.getProperty("base.url", ConfigConstants.DEFAULT_VALUE);
|
||||
trustHost = properties.getProperty("trust.host", ConfigConstants.DEFAULT_VALUE);
|
||||
notTrustHost = properties.getProperty("not.trust.host", ConfigConstants.DEFAULT_VALUE);
|
||||
pdfPresentationModeDisable = properties.getProperty("pdf.presentationMode.disable", ConfigConstants.DEFAULT_PDF_PRESENTATION_MODE_DISABLE);
|
||||
pdfOpenFileDisable = properties.getProperty("pdf.openFile.disable", ConfigConstants.DEFAULT_PDF_OPEN_FILE_DISABLE);
|
||||
pdfPrintDisable = properties.getProperty("pdf.print.disable", ConfigConstants.DEFAULT_PDF_PRINT_DISABLE);
|
||||
pdfDownloadDisable = properties.getProperty("pdf.download.disable", ConfigConstants.DEFAULT_PDF_DOWNLOAD_DISABLE);
|
||||
pdfBookmarkDisable = properties.getProperty("pdf.bookmark.disable", ConfigConstants.DEFAULT_PDF_BOOKMARK_DISABLE);
|
||||
pdfDisableEditing = properties.getProperty("pdf.disable.editing", ConfigConstants.DEFAULT_PDF_DISABLE_EDITING);
|
||||
fileUploadDisable = Boolean.parseBoolean(properties.getProperty("file.upload.disable", ConfigConstants.DEFAULT_FILE_UPLOAD_DISABLE));
|
||||
tifPreviewType = properties.getProperty("tif.preview.type", ConfigConstants.DEFAULT_TIF_PREVIEW_TYPE);
|
||||
cadPreviewType = properties.getProperty("cad.preview.type", ConfigConstants.DEFAULT_CAD_PREVIEW_TYPE);
|
||||
size = properties.getProperty("spring.servlet.multipart.max-file-size", ConfigConstants.DEFAULT_SIZE);
|
||||
beian = properties.getProperty("beian", ConfigConstants.DEFAULT_BEIAN);
|
||||
prohibit = properties.getProperty("prohibit", ConfigConstants.DEFAULT_PROHIBIT);
|
||||
@@ -92,6 +116,24 @@ public class ConfigRefreshComponent {
|
||||
pdf2JpgDpi = Integer.parseInt(properties.getProperty("pdf2jpg.dpi", ConfigConstants.DEFAULT_PDF2_JPG_DPI));
|
||||
officeTypeWeb = properties.getProperty("office.type.web", ConfigConstants.DEFAULT_OFFICE_TYPE_WEB);
|
||||
deleteSourceFile = Boolean.parseBoolean(properties.getProperty("delete.source.file", ConfigConstants.DEFAULT_DELETE_SOURCE_FILE));
|
||||
deleteCaptcha = Boolean.parseBoolean(properties.getProperty("delete.captcha", ConfigConstants.DEFAULT_DELETE_CAPTCHA));
|
||||
officPageRange = properties.getProperty("office.pagerange", ConfigConstants.DEFAULT_OFFICE_PAQERANQE);
|
||||
officWatermark = properties.getProperty("office.watermark", ConfigConstants.DEFAULT_OFFICE_WATERMARK);
|
||||
officQuality = properties.getProperty("office.quality", ConfigConstants.DEFAULT_OFFICE_QUALITY);
|
||||
officMaxImageResolution = properties.getProperty("office.maximageresolution", ConfigConstants.DEFAULT_OFFICE_MAXIMAQERESOLUTION);
|
||||
officExportBookmarks = Boolean.parseBoolean(properties.getProperty("office.exportbookmarks", ConfigConstants.DEFAULT_OFFICE_EXPORTBOOKMARKS));
|
||||
officeExportNotes = Boolean.parseBoolean(properties.getProperty("office.exportnotes", ConfigConstants.DEFAULT_OFFICE_EXPORTNOTES));
|
||||
officeDocumentOpenPasswords = Boolean.parseBoolean(properties.getProperty("office.documentopenpasswords", ConfigConstants.DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS));
|
||||
cadTimeout = properties.getProperty("cad.timeout", ConfigConstants.DEFAULT_CAD_TIMEOUT);
|
||||
homePageNumber = properties.getProperty("home.pagenumber", ConfigConstants.DEFAULT_HOME_PAGENUMBER);
|
||||
homePagination = properties.getProperty("home.pagination", ConfigConstants.DEFAULT_HOME_PAGINATION);
|
||||
homePageSize = properties.getProperty("home.pagesize", ConfigConstants.DEFAULT_HOME_PAGSIZE);
|
||||
homeSearch = properties.getProperty("home.search", ConfigConstants.DEFAULT_HOME_SEARCH);
|
||||
cadThread = Integer.parseInt(properties.getProperty("cad.thread", ConfigConstants.DEFAULT_CAD_THREAD));
|
||||
pdfTimeout = Integer.parseInt(properties.getProperty("pdf.timeout", ConfigConstants.DEFAULT_PDF_TIMEOUT));
|
||||
pdfTimeout80 = Integer.parseInt(properties.getProperty("pdf.timeout80", ConfigConstants.DEFAULT_PDF_TIMEOUT80));
|
||||
pdfTimeout200 = Integer.parseInt(properties.getProperty("pdf.timeout200", ConfigConstants.DEFAULT_PDF_TIMEOUT200));
|
||||
pdfThread = Integer.parseInt(properties.getProperty("pdf.thread", ConfigConstants.DEFAULT_PDF_THREAD));
|
||||
prohibitArray = prohibit.split(",");
|
||||
|
||||
ConfigConstants.setCacheEnabledValueValue(cacheEnabled);
|
||||
@@ -103,21 +145,42 @@ public class ConfigRefreshComponent {
|
||||
ConfigConstants.setFtpControlEncodingValue(ftpControlEncoding);
|
||||
ConfigConstants.setBaseUrlValue(baseUrl);
|
||||
ConfigConstants.setTrustHostValue(trustHost);
|
||||
ConfigConstants.setNotTrustHostValue(notTrustHost);
|
||||
ConfigConstants.setOfficePreviewSwitchDisabledValue(officePreviewSwitchDisabled);
|
||||
ConfigConstants.setPdfPresentationModeDisableValue(pdfPresentationModeDisable);
|
||||
ConfigConstants.setPdfOpenFileDisableValue(pdfOpenFileDisable);
|
||||
ConfigConstants.setPdfPrintDisableValue(pdfPrintDisable);
|
||||
ConfigConstants.setPdfDownloadDisableValue(pdfDownloadDisable);
|
||||
ConfigConstants.setPdfBookmarkDisableValue(pdfBookmarkDisable);
|
||||
ConfigConstants.setPdfDisableEditingValue(pdfDisableEditing);
|
||||
ConfigConstants.setFileUploadDisableValue(fileUploadDisable);
|
||||
ConfigConstants.setTifPreviewTypeValue(tifPreviewType);
|
||||
ConfigConstants.setCadPreviewTypeValue(cadPreviewType);
|
||||
ConfigConstants.setBeianValue(beian);
|
||||
ConfigConstants.setSizeValue(size);
|
||||
ConfigConstants.setProhibitValue(prohibitArray);
|
||||
ConfigConstants.setPasswordValue(password);
|
||||
ConfigConstants.setPdf2JpgDpiValue(pdf2JpgDpi);
|
||||
ConfigConstants.setOfficeTypeWebValue(officeTypeWeb);
|
||||
ConfigConstants.setOfficePageRangeValue(officPageRange);
|
||||
ConfigConstants.setOfficeWatermarkValue(officWatermark);
|
||||
ConfigConstants.setOfficeQualityValue(officQuality);
|
||||
ConfigConstants.setOfficeMaxImageResolutionValue(officMaxImageResolution);
|
||||
ConfigConstants.setOfficeExportBookmarksValue(officExportBookmarks);
|
||||
ConfigConstants.setOfficeExportNotesValue(officeExportNotes);
|
||||
ConfigConstants.setOfficeDocumentOpenPasswordsValue(officeDocumentOpenPasswords);
|
||||
ConfigConstants.setDeleteSourceFileValue(deleteSourceFile);
|
||||
ConfigConstants.setDeleteCaptchaValue(deleteCaptcha);
|
||||
ConfigConstants.setCadTimeoutValue(cadTimeout);
|
||||
ConfigConstants.setCadThreadValue(cadThread);
|
||||
ConfigConstants.setHomePageNumberValue(homePageNumber);
|
||||
ConfigConstants.setHomePaginationValue(homePagination);
|
||||
ConfigConstants.setHomePageSizeValue(homePageSize);
|
||||
ConfigConstants.setHomeSearchValue(homeSearch);
|
||||
ConfigConstants.setPdfTimeoutValue(pdfTimeout);
|
||||
ConfigConstants.setPdfTimeout80Value(pdfTimeout80);
|
||||
ConfigConstants.setPdfTimeout200Value(pdfTimeout200);
|
||||
ConfigConstants.setPdfThreadValue(pdfThread);
|
||||
setWatermarkConfig(properties);
|
||||
bufferedReader.close();
|
||||
fileReader.close();
|
||||
|
||||
@@ -50,26 +50,21 @@ public class RedissonConfig {
|
||||
.setConnectionMinimumIdleSize(connectionMinimumIdleSize)
|
||||
.setConnectionPoolSize(connectionPoolSize)
|
||||
.setDatabase(database)
|
||||
.setDnsMonitoring(dnsMonitoring)
|
||||
.setDnsMonitoringInterval(dnsMonitoringInterval)
|
||||
.setSubscriptionConnectionMinimumIdleSize(subscriptionConnectionMinimumIdleSize)
|
||||
.setSubscriptionConnectionPoolSize(subscriptionConnectionPoolSize)
|
||||
.setSubscriptionsPerConnection(subscriptionsPerConnection)
|
||||
.setClientName(clientName)
|
||||
.setFailedAttempts(failedAttempts)
|
||||
.setRetryAttempts(retryAttempts)
|
||||
.setRetryInterval(retryInterval)
|
||||
.setReconnectionTimeout(reconnectionTimeout)
|
||||
.setTimeout(timeout)
|
||||
.setConnectTimeout(connectTimeout)
|
||||
.setIdleConnectionTimeout(idleConnectionTimeout)
|
||||
.setPingTimeout(pingTimeout)
|
||||
.setPassword(StringUtils.trimToNull(password));
|
||||
Codec codec=(Codec) ClassUtils.forName(getCodec(), ClassUtils.getDefaultClassLoader()).newInstance();
|
||||
config.setCodec(codec);
|
||||
config.setThreads(thread);
|
||||
config.setEventLoopGroup(new NioEventLoopGroup());
|
||||
config.setUseLinuxNativeEpoll(false);
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,13 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<ChinesePathFilter> getChinesePathFilter() {
|
||||
ChinesePathFilter filter = new ChinesePathFilter();
|
||||
FilterRegistrationBean<ChinesePathFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(filter);
|
||||
registrationBean.setOrder(10);
|
||||
return registrationBean;
|
||||
}
|
||||
|
||||
@@ -67,14 +69,20 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
@Bean
|
||||
public FilterRegistrationBean<BaseUrlFilter> getBaseUrlFilter() {
|
||||
Set<String> filterUri = new HashSet<>();
|
||||
filterUri.add("/index");
|
||||
filterUri.add("/");
|
||||
filterUri.add("/onlinePreview");
|
||||
filterUri.add("/picturesPreview");
|
||||
BaseUrlFilter filter = new BaseUrlFilter();
|
||||
FilterRegistrationBean<BaseUrlFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(filter);
|
||||
registrationBean.setUrlPatterns(filterUri);
|
||||
registrationBean.setOrder(20);
|
||||
return registrationBean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<UrlCheckFilter> getUrlCheckFilter() {
|
||||
UrlCheckFilter filter = new UrlCheckFilter();
|
||||
FilterRegistrationBean<UrlCheckFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(filter);
|
||||
registrationBean.setOrder(30);
|
||||
return registrationBean;
|
||||
}
|
||||
|
||||
|
||||