Giter Site home page Giter Site logo

zhtengw / kodexplorer-plugins Goto Github PK

View Code? Open in Web Editor NEW
210.0 8.0 117.0 53.73 MB

Plugins for KodExplorer and KodBox

PHP 63.92% JavaScript 9.65% HTML 2.51% CSS 23.64% Shell 0.28%
kodexplorer-plugins kodexplorer weboffice onlyoffice webps photopea kodbox

kodexplorer-plugins's People

Contributors

jymusic0663 avatar sit17 avatar zhtengw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kodexplorer-plugins's Issues

How to use docker-compose instead of docker run

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:
image

but if I open an Office file I get:
image

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 同步

在可道云中用onlyoffice编辑后,不能和下载和分享的文件同步,
在线编辑后的文档只能用在线编辑时才保持最新,但是下载下来的文件还是没有变化,分享的文件也没有变,

only office 分享文档出去 报错Null问题 已解决

原始代码:

"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预览与编辑代码,麻烦你看一下有没有用

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

Full text search

Is there anyway find that plugin for kodbox ?
Fulltext Search

插件显示异常

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.