zhtengw / kodexplorer-plugins Goto Github PK
View Code? Open in Web Editor NEWPlugins for KodExplorer and KodBox
Plugins for KodExplorer and KodBox
rt,配置好了插件打开Word文档一直提示“文件加载中”,onlyoffice的服务端是正常的,拿KodExplorer来测试onlyoffice的服务端是可以正常使用的
在onlyoffice编辑后每次用onlyoffice打开就记录,但是从可道云下载下来是原文件没编辑的
目前最新的版本上都有这个问题,程序是kodbox,网盘内打开正常
以前有人遇到过这个问题吗?它在程序中只是不起作用
不知道是为什么,如果多尝试几次直接提示文件不存在了,有人一样的情况吗
你好,关于onlyoffice插件,我给了游客编辑保存文件的权限,但是还是无法编辑,请问是不是根据账户的性质,把代码写死了?
Originally posted by @13414897882 in #3 (comment)
Your example was this:
docker run --name onlyoffice --restart always -i -t -d -p 8000:80 onlyoffice/documentserver
Here is my try to get this working via docker-compose, does this look right?
onlyoffice:
container_name: onlyoffice
hostname: onlyoffice
image: onlyoffice/documentserver:latest
networks:
- kodexplorer_network
restart: "always"
ports:
- "8000:80"
stdin_open: true
tty: true
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
My problem is that I then configured the plugin like this:
but if I open an Office file I get:
Any help on how to debug the problem? The 172.21.0.3 is correct as from my docker host I can curl curl -I http://172.21.0.3:8000/web-apps/apps/api/documents/api.js
在可道云中用onlyoffice编辑后,不能和下载和分享的文件同步,
在线编辑后的文档只能用在线编辑时才保持最新,但是下载下来的文件还是没有变化,分享的文件也没有变,
原始代码:
"editorConfig": {
"callbackUrl": <?php var_export($option['callbackUrl']); ?>,
"lang": <?php var_export($option['lang']); ?>,
"mode": <?php var_export($option['mode']); ?>,
"user": {
"id": <?php var_export($option['UID']); ?>,
"name": <?php var_export($option['user']); ?>
},
修改为
"editorConfig": {
"callbackUrl": <?php var_export($option['callbackUrl']); ?>,
"lang": <?php var_export($option['lang']); ?>,
"mode": <?php var_export($option['mode']); ?>,
"user": {
"id": <?php echo $option['UID']??0; ?>,
"name": '<?php echo $option['user']??''; ?>'
},
注:需要php7支持 其他低版本自行修改为 三元运算判断
请问下,onlyoffice和kodbox同机部署(云主机),插件配置的地址能不能使用内网ip,我部署了发现只能填写外网ip才能正常使用onlioffice
5.0版本的好像又改了下结构。。 我对照着改了下json文件,还是不能用
onlyoffice的app.php代码
hookRegiest(array( 'user.commonJs.insert' => 'onlyofficePlugin.echoJs' )); } public function echoJs($st,$act){ if($this->isFileExtence($st,$act)){ $this->echoFile('static/main.js'); } } public function index(){ $fileName = get_path_this(rawurldecode($this->in['path'])); $pathIsUrl = false; if(substr($this->in['path'],0,4) == 'http'){ $path = $fileUrl = $this->in['path']; $pathIsUrl = true; }else{ $path = _DIR($this->in['path']); $fileUrl = _make_file_proxy($path); if (!file_exists($path)) { show_tips(LNG('not_exists')); } } $appConfig = $this->options(); $ext = get_path_ext($path); $option = array( 'officeApi' => $this->pluginApi, 'officeFile' => rawurlencode($this->in['path']), 'url' => $fileUrl, 'key' => $pathIsUrl?rand_string(10):@md5_file($path), 'time' => $pathIsUrl?rand_string(10):@filemtime($path), 'fileType' => $this->fileTypeAlias($ext), 'title' => $fileName, 'documentType' => $this->appType($ext), 'user' => $_SESSION['kodUser']['name'], 'userID' => $_SESSION['kodUser']['userID'], 'mode' => 'view', 'lang' => I18n::getType(), ); //只读 if($GLOBALS['kodPathType'] == KOD_USER_SHARE){ }else if(!$pathIsUrl){ if(check_file_writable_user($path)){//可读写权限检测 $option['mode'] = 'edit'; $option['key'] = md5($path.$option['time']); $option['callbackUrl'] = $option['officeApi'].'save&path=' .$option['officeFile'].'&accessToken='.access_token_get(); } }else if(isset($this->in['saveCallback'])){ $option['officeFile'] .= rawurlencode('&saveCallback='.$this->in['saveCallback'].'&name=/'.$fileName); if(substr($this->in['saveCallback'],0,4) == 'http'){ $option['mode'] = 'edit'; $option['callbackUrl'] = $option['officeApi'].'save&path=' .$option['officeFile'].'&accessToken='.access_token_get(); } } //移动端预览模式 if( is_wap() && $appConfig['wapViewMode'] == 'view'){ $option['mode'] = 'view'; } Hook::filter('onlyoffice.fileGet.filter',$option);//数据处理 $this->resetAppHost($option); //旧版本 if( defined("OFFICE_KOD_SERVER")){ $fileLink = $option['officeApi'].'save&type=explorer/fileProxy&path='.$option['officeFile']; $appRandom = rand_string(10); $officeUrl = OFFICE_KOD_SERVER.rawurlencode($fileLink) .'&lang='.I18n::getType().'&appType=desktop' .'&appMode='.$option['mode'].'&access_token='.access_token_get() .'&file_time='.$option['time'].'&key='.$option['key'] .'&user_id='.$option['userID'].'&user_name='.$option['user'] .'&app_id='.OFFICE_KOD_APP_ID.'&app_s='.$appRandom.'&app_v='.md5($appRandom.OFFICE_KOD_APP_KEY); header("Location: ".$officeUrl); return; } //新版本 $fileName.= ' - '.LNG('kod_name').LNG('kod_power_by'); include($this->pluginPath.'php/template.html'); } private function options(){ $appConfig = $this->getConfig(); //未填写;则默认和kod同服务器 if(!$appConfig['serverApi']){ $host = rtrim(get_host(),'/'); if(strrpos($host,':') > 5){ $host = substr($host,0,strrpos($host,':')); } $appConfig['serverApi'] = $host.':8001/web/'; } if( !trim($appConfig['cdnPath']) ){ $appConfig['cdnPath'] = $appConfig['serverApi']; } if( !trim($appConfig['kodAppHost']) ){ $appConfig['kodAppHost'] = APP_HOST; } $appConfig['cdnPath'] = rtrim($appConfig['cdnPath'],'/').'/'; $appConfig['serverApi'] = rtrim($appConfig['serverApi'],'/').'/'; if(!$GLOBALS['isRoot']){ /** * 下载&打印&导出:权限取决于文件是否可以下载;(管理员无视所有权限拦截) * 1. 当前用户是否允许下载 * 2. 所在群组文件,用户在群组内的权限是否可下载 * 3. 文件分享,限制了下载 */ if($GLOBALS['auth'] && !$GLOBALS['auth']['explorer.fileDownload']){ $appConfig['canDownload'] = false; } if( $GLOBALS['kodShareInfo'] && $GLOBALS['kodShareInfo']['notDownload'] == '1'){ $appConfig['canDownload'] = false; } if( $GLOBALS['kodPathRoleGroupAuth'] && !$GLOBALS['kodPathRoleGroupAuth']['explorer.fileDownload']){ $appConfig['canDownload'] = false; } } //特殊处理 $temp = Hook::trigger("onlyofficeOptions",$appConfig); if(is_array($temp)){ $appConfig = $temp; } // $appConfig['info'] = array( // 'versionHash' => systemOption('versionHash'), // 'versionHashUser' => systemOption('versionHashUser'), // ); return $appConfig; } public function check(){ $appConfig = $this->options(); //kod访问office服务器;网络检测;office提交保存文件时;kod通过url从office服务器获取文件并保存 if(isset($this->in['fileSave'])){ $result = curl_get_contents($appConfig['serverApi'].'/sdkjs/common/AllFonts.js'); if( $result && strlen($result) > 5000 ){ echo 'success'; } exit; } //office服务器访问kod;网络检测 if(isset($this->in['output'])){ echo 'success'; exit; } $kod = array( "url" => APP_HOST, "callbackUrl" => $this->pluginApi.'check&output=&accessToken='.access_token_get() ); $this->resetAppHost($kod); include($this->pluginPath.'php/check.html'); } private function resetAppHost(&$data){ $appConfig = $this->options(); if( $appConfig['kodAppHost'] == APP_HOST ){ return; } $replace = array('officeFile','url','officeApi','callbackUrl'); foreach ($replace as $key) { if(is_string($data)) { $data = str_replace(APP_HOST,$appConfig['kodAppHost'],$data); return $data; } if(isset($data[$key])){ $data[$key] = str_replace(APP_HOST,$appConfig['kodAppHost'],$data[$key]); } } } public function save(){ $this->log(array('call save',$this->in)); //手动保存 if(isset($this->in['EditorBin'])){ $this->saveFile($this->in['EditorBin']); return; } if($this->in['type'] == 'explorer/fileProxy'){ if(substr($this->in['path'],0,4) == 'http'){ header('Location: '.$this->in['path']); exit; } $savePath = _DIR($this->in['path']); //var_dump(file_exists($savePath),$savePath);exit; file_put_out($savePath,false); exit; } if (($bodyStream = file_get_contents('php://input'))===FALSE){ $this->jsonPutout(array('error'=>'Bad Request'),'bodyStream null'); } $data = json_decode($bodyStream,true); if ($data === NULL){ $this->jsonPutout(array('error'=>'Bad Response'),'bodyStream json_decode error'); } $trackerStatus = array( 0 => 'NotFound', 1 => 'Editing', 2 => 'MustSave', 3 => 'Corrupted', 4 => 'Closed' //4 => 'Editing' ); $result = array('error'=>0,'action'=>$trackerStatus[$data["status"]]); switch ($trackerStatus[$data["status"]]){ case "MustSave": case "Corrupted": Hook::trigger('explorer.fileSave'); Hook::filter('onlyoffice.fileSave.filter',$data); $this->resetAppHost($data); $data['saveResult'] = $this->saveFile($data["url"]); $result["c"] = "saved"; $result['status'] = '0'; $result['status'] = 'success'; break; default:break; } $this->jsonPutout($result,$data); } private function saveFile($resultUrl){ $options = $this->getConfig(); //支持https转发的情况 if(substr($options['serverApi'],0,8) == 'https://'){ $resultUrl = str_replace("http://","https://",$resultUrl); } //同一台机器,保存时获取临时文件 if( !$options['serverApi'] ){ $host = get_url_root($resultUrl); $resultUrl = str_replace($host,'http://127.0.0.1:8001/',$resultUrl); } $this->log(array('saveFile',$resultUrl,$this->in['path'])); $path = $this->in['path']; if(strstr($path,'&saveCallback=')){ $param = parse_url_query($path); if(!isset($param['saveCallback'])){ $this->jsonPutout(array('error'=>'Bad Request'),'saveCallback null'); } $callback = rawurldecode($param['saveCallback']).'&fileUrl='.rawurlencode($resultUrl); $this->log(array('saveFileApiCallback',$callback,$param)); $return = file_get_contents($callback); $this->log(array('saveFileApiCallback-return',$return)); return $callback; }else{ $savePath = _DIR($path); if ( !path_writeable($savePath) ){ $this->jsonPutout(array('error'=>'no_permission_write'),'no_permission_write'); } $this->log(array('saveFileLocalStart',$resultUrl,$savePath)); return file_download_this($resultUrl,$savePath); } } private function log($log){ $appConfig = $this->getConfig(); if($appConfig['debug']){ write_log($log,'onlyoffice'); } } private function jsonPutout($info,$log){ @ob_end_clean(); @Header( 'Content-Type: application/json; charset==utf-8'); @Header( 'X-Robots-Tag: noindex' ); @Header( 'X-Content-Type-Options: nosniff' ); $this->log(array('jsonPutout',$info,$log)); echo json_encode($info); exit; } //格式转义 private function fileTypeAlias($ext){ if(strpos(".docm.dotm.dot.wps.wpt",'.'.$ext) !== false){ $ext = 'doc'; }else if(strpos(".xlt.xltx.xlsm.dotx.et.ett",'.'.$ext) !== false){ $ext = 'xls'; }else if(strpos(".pot.potx.pptm.ppsm.potm.dps.dpt",'.'.$ext) !== false){ $ext = 'ppt'; } return $ext; } private function appType($ext){ $typeArr = array( 'text' => array('docx','doc','odt','rtf','mht','djvu','fb2','xps', 'docm','dotm','dot','dotx', 'wps','wpt','pdf'), 'spreadsheet' => array('xls','xlsx','ods','csv','xlt','xltx','xlsm', 'et','ett'), 'presentation' => array('pps','ppsx','ppt','pptx','odp','pot', 'potx','pptm','ppsm','potm','dps','dpt'), ); foreach ($typeArr as $key => $value) { if(in_array($ext,$value)){ return $key; } } show_tips("暂不支持该扩展名!"); return ''; } public function view(){ $path = $this->filePath($this->in['path']); $viewFile = TEMP_PATH.$this->pluginName.'/'.hash_path($path).'.pdf'; if(!file_exists($viewFile)){ $json = $this->convert($path,'pdf'); if($json['fileUrl']){ $content = file_get_contents($json['fileUrl']); mk_dir(get_path_father($viewFile)); file_put_contents($viewFile,$content); } } if(!file_exists($viewFile)){ show_tips("您的文档中存在无法解析的内容。请尝试下载到本地进行操作。"); } $fileUrl = _make_file_proxy($viewFile); if(file_exists(PLUGIN_DIR.'pdfjs')){ $fileName = get_path_this(rawurldecode($this->in['path'])); $fileName.= ' - '.LNG('kod_name').LNG('kod_power_by'); $this->pluginHost = get_path_father($this->pluginHost).'pdfjs/'; include(PLUGIN_DIR.'pdfjs/php/pdf.php'); }else{ header("Location: ".$fileUrl); } } // convert https://api.onlyoffice.com/editors/conversionapi // view https://api.onlyoffice.com/editors/try private function convert($path,$ext){ $appConfig = $this->getConfig(); $host = get_url_root($appConfig['serverApi']); $api = rtrim($host,'/')."/ConvertService.ashx"; $param = array( //"async" => true, "url" => _make_file_proxy($path), "outputtype" => $ext, "filetype" => get_path_ext($path), "title" => "file", "key" => md5("office".hash_path($path)) ); $this->resetAppHost($param); $opts = array( 'http' => array( 'method' => 'POST', 'timeout' => 500, 'header' => "Content-type: application/json\r\nAccept: application/json\r\n", 'content' => json_encode($param) ) ); $response = file_get_contents($api,false,stream_context_create($opts)); return json_decode($response,true); } }不使用所有人权限,使用别的权限后有警告不能保存,但是点了ok后 又正常的可以编辑
Kodbox已经没法用了吗?
启用以后,无法创建文件也无法打开文件。
版本:kodbox V1.11.0805
Is there anyway find that plugin for kodbox ?
Fulltext Search
为啥我打开你的所有插件都是空白的窗口,所有插件都是空白界面
看了一下onlyoffice的接口,想自己实现这个功能,但貌似很麻烦,个人不懂php,麻烦大佬支持一下这个功能!谢谢!
onlyoffice 插件kodbox1.40版本上通过webadv挂载群辉文件无法编辑和预览
@zhtengw
你好 我想咨询下你的这个站点 https://home.aten.ml:4443 是怎么做到远程服务器还能使用的? 我本地搭建好的毕升远程可以访问 但是无法调用 也不能说是远程 是cdn的环境下 你的毕升可以调用 但是我的毕升却无法调用 求解
kodbox的版本是1.06,插件拷进去后在系统中插件的名字都是 {{LNG.Photopea.meta.name}}。
点击【配置插件】浏览器会报错
Uncaught TypeError: e.split is not a function
at main.js?1.07.2020040302:1
at r (eval at t.exports (vendor.js?v=1024b69f:1), :1:352)
at Function.Xe (eval at t.exports (vendor.js?v=1024b69f:1), :1:34286)
at e.exports (main.js?1.07.2020040302:1)
at s (vendor.js?v=1024b69f:1)
at child.renderHtml (vendor.js?v=1024b69f:1)
at child.makeHtml (main.js?1.07.2020040302:1)
at child.renderDialog (main.js?1.07.2020040302:1)
at main.js?1.07.2020040302:1
at Object.l. [as LkdXU] (main.js?1.07.2020040302:1)
打开office提示文档安全令牌未正确形成,onlyoffice7.3.3
有CAD离线预览的插件吗??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.