当前位置: 首页> 教育> 大学 > 北京科技公司名单_python游戏编程入门_网站关键词收录查询_网络销售平台有哪些

北京科技公司名单_python游戏编程入门_网站关键词收录查询_网络销售平台有哪些

时间:2025/7/12 14:52:22来源:https://blog.csdn.net/this_is_id/article/details/144255766 浏览次数:0次
北京科技公司名单_python游戏编程入门_网站关键词收录查询_网络销售平台有哪些

onlyoffice部署

version: "3"
services:onlyoffice:image: onlyoffice/documentserver:7.5.1container_name: onlyofficerestart: alwaysenvironment:- JWT_ENABLED=false#- USE_UNAUTHORIZED_STORAGE=true#- ONLYOFFICE_HTTPS_HSTS_ENABLED=falseports:- "8080:80"# - "8443:443"volumes:- ./data/onlyoffice/log:/var/log/onlyoffice- ./data/onlyoffice/data:/var/www/onlyoffice/Data- ./data/onlyoffice/lib:/var/lib/onlyoffice- ./data/onlyoffice/postgresql:/var/lib/postgresql# - ./default.json:/etc/onlyoffice/documentserver/default.json

修改default.json

docker cp onlyoffice:/etc/onlyoffice/documentserver/default.json ./

修改以下值为:

...
"request-filtering-agent" : {"allowPrivateIPAddress": true,"allowMetaIPAddress": true},
...

在docker-compose中添加挂载:

- ./default.json:/etc/onlyoffice/documentserver/default.json

前端代码

保存为 test.html

<!DOCTYPE html>
<html><head><script type='text/javascript' src='http://IP:PORT/web-apps/apps/api/documents/api.js'></script><style>html {height: 100%;width: 100%;padding: 0;margin: 0;}body {height: 100%;width: 100%;padding: 0;margin: 0;}</style></head><body><div id="placeholder"></div><script language="javascript" type="text/javascript">var docEditor = new DocsAPI.DocEditor("placeholder", {"document": {// 文件类型"fileType": "docx",// 每次需要重新生成随机字符串"key": "adfgadfgadfgad",// 标题"title": "test.docx",// 文档地址,GET"url": "http://IP:PORT/api/file?name=test.docx"},"documentType": "word","editorConfig": {// 保存文档的回调地址, POST"callbackUrl": "http://IP:PORT/api/file?name=test.docx",// 查看模式// "mode": "view",// 编辑模式"mode": "edit",// 中文 "lang": "zh-CN","customization": {// 插件"plugins":false,// 关于"about": false,// 自动保存"autosave":true,// 聊天"chat":false,// 批注"comments":false,// 帮助"help":false,}}});</script>
</body></html>

python回调接口

import requests
from flask import Flask, requestapp = Flask(__name__)@app.get("/api/file")
def get_file():file_path = "/data/test.docx"return make_response(send_file(file_path, as_attachment=True))@app.post("/api/file")
def save_file():file_path = "/data/test.docx"callback_obj = request.get_json()print(callback_obj)status = callback_obj.get("status", -1)if status == 2 or status == 3 or status == 6:try:r = requests.get(callback_obj["url"])with open(file_path, "wb") as f:f.write(r.content)except Exception as e:print("保存错误:", e)return {"error": 1}return {"error": 0}
关键字:北京科技公司名单_python游戏编程入门_网站关键词收录查询_网络销售平台有哪些

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: