PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

images
main.js
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/webdav/static/main.js'
View Content
kodReady.push(function () {
	G.webdavOption = {
		host:  G.kod.APP_HOST+'index.php/dav/',
		allow: parseInt("{{isAllow}}"),
		systemAutoMount: parseInt("{{systemAutoMount}}"),
		pathAllow: '{{pathAllow}}',
		version: '{{package.version}}'
	};
	
	// 菜单地址,兼容旧版
	var newMenuVers = (G.kod.version+'.'+G.kod.build) > '1.60.03' ? true : false;
	var newMenuHash = function(hash){
		if (newMenuVers) return hash;
		if (arguments[1]) return arguments[1];	// 直接用指定hash
		return hash.replace('/server/', '/storage/');	// 替换server部分
	}
	Events.bind("admin.leftMenu.before",function(menuList){
		var menu = {
			title:LNG['admin.server.file'],	// 文件服务
			icon:"ri-folder-shared-fill",
			link:newMenuHash("admin/server/webdav"),
			before:newMenuHash('admin/server/index','admin/storage/share'),//after/before; 插入菜单所在位置;
			sort:100,
			pluginName:"{{pluginName}}",
		};
		menuList.push(menu);
	});
	// 菜单页预览:合并配置菜单
	Events.bind('plugin.config.formBefore', function(formData, options, _this){
		if (_.get(options, 'id') != 'app-config-{{pluginName}}') return;
		if (Router.hash != newMenuHash('admin/server/webdav')) return;
		formData.sep002 = '<hr/>';
		formData.formStyle.tabs[LNG['webdav.config.tab1']] += ',sep002,mountWebdav,mountDetail,kodboxUpload,kodboxDownload';
		formData.formStyle.tabs[LNG['webdav.config.tab2']] = '';
		formData.isOpen.switchItem['1'] += ',sep002,mountWebdav';
	});
	// 关闭服务时,同时关闭挂载存储
	Events.bind('plugin.config.formAfter', function(_this){
		var form = _this['formwebdav'];
		if (!form || !form.$el) return;
		if (Router.hash != newMenuHash('admin/server/webdav')) return;
		form.$('.form-row.item-mountWebdav').before(form.$('.form-row.item-sep002'));
	});
	Events.bind("user.leftMenu.before",function(menuList){
		if(!G.webdavOption.allow) return;
		menuList.push({
			title:LNG['webdav.meta.name'],
			icon:"ri-hard-drive-fill-2",
			link:"setting/user/webdav",
			pluginName:"{{pluginName}}",
			sort:100,
			fileSrc:'{{pluginHost}}static/user.js',
		});
	});
	
	// 挂载webdav存储
	
	var ioAdd = [
		{type:'webdav',name:"Webdav",icon:"webdav.png"},
		// {type:'nfs',name:"NFS",icon:"nfs.png"},
		// {type:'samba',name:"Samba",icon:"samba.png"},
	];
	var styles = "";
	_.each(ioAdd,function(item){
		var ioIcon = '{{pluginHost}}static/images/'+item.icon;
		styles += '.x-item-icon.x-io-' + item.type +'{background-image:url("'+ioIcon+'");margin-top:1px;}';
		styles += '.header-middle .header-address .path-ico.name-io-'+item.type+'{padding-top:4px;}';
	});
	$.addStyle(styles);
	if('{{config.mountWebdav}}' == '0') return; // 挂载支持开关;

	var resortIO = function(viewStorage){
		var ioLocal = 'local,ftp,webdav,nfs,samba'.split(',');
		var typeListNew = {};
		_.each(viewStorage.typeList,function(name,type){
			if(!_.includes(ioLocal,type)){return;}
			typeListNew[type] = name;
		});
		typeListNew['--group-oss'] = '';viewStorage.iconList['--group-oss'] = '';
		_.each(viewStorage.typeList,function(name,type){
			if(_.includes(ioLocal,type)){return;}
			typeListNew[type] = name;
		});
		viewStorage.typeList = typeListNew;
	};
	var ioTypeAdd = function(viewStorage){
		requireAsync('{{pluginHost}}static/package.js',function(package){
			_.each(package,function(v,k){
				viewStorage.allPkgList[k] = v;
			});
		});
		_.each(ioAdd,function(item){
			var ioIcon = '{{pluginHost}}static/images/'+item.icon;
			var image  = '<img style="max-height:100%;max-width:100%;" src="'+ioIcon+'">';
			viewStorage.typeList[item.type] = item.name;
			viewStorage.iconList[item.type] = '<i class="path-ico name-kod-webdav">'+image+'</i>';
		});
		resortIO(viewStorage);
	};

	Events.bind('storage.init.load',ioTypeAdd);
	Events.bind('storage.config.view.load', function(self, type, action){
		if(type != 'webdav') return;
		// 链接到kodbox时, 支持设置上传下载中转;
		var davValue = _.get(self.formMaker.formData,'dav.value','');
		var $items = self.formMaker.$('.item-ioUploadServer,.item-ioFileOutServer,.item-sep-1,.item-sep-2');
		if(!_.includes(davValue, 'extended-kodbox')){
			$items.addClass('hidden');
		}else{
			$items.removeClass('hidden');
		}
	});
	// 'storage.list.view.load'; 'storage.config.form.load'; 'storage.config.view.load'
});
package.js
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/webdav/static/package.js'
View Content
define(function(require, exports) {
	var optionWebdav = {
        "name":{
            "type":"input",
            "value":"",	
            "display":LNG['common.name'],
            "desc":LNG['admin.storage.nameDesc'],
            "require":1
        },
        "sizeMax":{
            "type":"number",
            "value":1024,
            "display":LNG['admin.member.spaceSize'],
            "desc":LNG['admin.storage.sizeDesc'],
			"titleRight":"GB",
            "require":1
        },
		"sep_webdav":"<hr/>",
		"host":{
            "type":"input",
            "display":"Webdav URL",
            "desc":"",
            "require":1
        },
		"dav":{"type":"hidden"},
		"user":{
            "type":"input",
            "display":LNG['admin.install.userName'],
        },
		"password":{
			"type":"input","className":"input-password",  //替代; 避免保存密码提示,选择密码框弹出
            "display":LNG['common.password'],
        },
        
        "basePath":{
            "type":"input",
            "value":"/",	
            "display":LNG['admin.storage.path'],
            "desc":LNG['admin.storage.pathDesc'],
        },
		
		"sep-1":{"className":"hidden","value":"<hr/>"},
		"ioUploadServer":{
            "type":"switch",
            "value":'0',"className":"hidden",
            "display":LNG['admin.storage.uploadSrv'],
            "desc":LNG['admin.storage.uploadSrvDesc']
        },
        "ioFileOutServer":{
            "type":"switch",
            "value":'0',"className":"hidden",
            "display":LNG['admin.storage.fileoutSrv'],
            "desc":LNG['admin.storage.fileoutSrvDesc']
        },
		"sep-2":{
			"display":"","className":"hidden",
			"value":"<div class='info-alert info-alert-blue p-10 align-left can-select can-right-menu'>\
			<li>"+LNG['webdav.config.mountDetail3']+"</li></div>"
		}		
    };
	var optionNFS = {
		"name":{
            "type":"input",
            "value":"",	
            "display":LNG['common.name'],
            "desc":LNG['admin.storage.nameDesc'],
            "require":1
        },
        "sizeMax":{
            "type":"number",
            "value":1024,
            "display":LNG['admin.member.spaceSize'],
            "desc":LNG['admin.storage.sizeDesc'],
			"titleRight":"GB",
            "require":1
        },
		"sep_io_nfs":"<hr/>",
		"host":{
            "type":"input",
            "display":"ip",
            "desc":"服务器地址",
            "require":1
        },
		"serverPath":{
            "type":"input",
            "display":"服务器路径",
            "desc":"",
            "require":1
        },
		"openMore":{
			"type":"button",
			"className":"form-button-line",//横线腰线
			"info":{
				'1':{ //按钮名称
					"display":LNG['explorer.share.advanceSet']+" <b class='caret'></b>",
					"className":"btn btn-default btn-sm",
				},
			},
			"switchItem":{
				'1':"user,password", //开启或关闭的字段
			}
		},
		"user":{
            "type":"input",
            "display":LNG['admin.install.userName'],
        },
		"password":{
			"type":"input","className":"input-password",  //替代; 避免保存密码提示,选择密码框弹出
            "display":LNG['common.password'],
        },
        "basePath":{
            "type":"input",className:"hidden",
            "value":"/",	
            "display":LNG['admin.storage.path'],
            "desc":LNG['admin.storage.pathDesc'],
        },
	};
	var optionSamba = {
		"name":{
            "type":"input",
            "value":"",	
            "display":LNG['common.name'],
            "desc":LNG['admin.storage.nameDesc'],
            "require":1
        },
        "sizeMax":{
            "type":"number",
            "value":1024,
            "display":LNG['admin.member.spaceSize'],
            "desc":LNG['admin.storage.sizeDesc'],
			"titleRight":"GB",
            "require":1
        },
		
		"sep_io_samba":"<hr/>",
		"host":{
            "type":"input",
            "display":"ip",
            "desc":"服务器地址",
            "require":1
        },		
		"user":{
            "type":"input",
            "display":LNG['admin.install.userName'],
        },
		"password":{
			"type":"input","className":"input-password",  //替代; 避免保存密码提示,选择密码框弹出
            "display":LNG['common.password'],
        },
		"serverPath":{
            "type":"input",
            "display":"服务器路径",
            "desc":"",
            "require":1
        },
        "basePath":{
            "type":"input",className:"hidden",
            "value":"/",	
            "display":LNG['admin.storage.path'],
            "desc":LNG['admin.storage.pathDesc'],
        },
	};
	var container = 'span.form-select2-dropdown-key-storeType.select2-container';
	var optionPre = container + ' .select2-results__options .select2-results__option[role="group"]';
	$.addStyle(optionPre+'{float:none;height: 2px;margin: 0;width: 100% !important;padding: 2px 0 5px 0;cursor:default;}'+optionPre+':hover{background:none;}');
	
    return {webdav:optionWebdav,nfs:optionNFS,samba:optionSamba};
});
user.js
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/webdav/static/user.js'
View Content
ClassBase.define({
	init: function(param){
		this.webdavPath = G.webdavOption.host;
		this.initParentView(param);
		this.initFormView(this.formData());
		this.initPath();
	},
	
	initPath: function(){
		var self = this;
		if(G.webdavOption.pathAllow == 'self'){
			this.$('.item-openMore').remove();
			return;
		}

		var tpl = '{{each dataList item}}\
		<div class="row-item mb-10" tabindex="0">\
			<span class="title" style="display:inline-block;width:100px;">{{item.title}}:</span>\
			<input type="text" value="{{item.value}}" readonly="" style="width:45%;" class="span-title-right">\
			<span class="input-title input-title-right kui-btn" action="copy">\
				<i class="font-icon ri-file-copy-line-2"></i>{{LNG["explorer.copy"]}}</span>\
		</div>\
		{{/each}}';
		var data = [
			{
				title:LNG['explorer.file.address']+"(all)",
				value:this.webdavPath
			},
			{
				title:LNG['explorer.toolbar.fav'],
				value:this.webdavPath+urlEncode(LNG['explorer.toolbar.fav'])+'/'
			},
			{
				title:LNG['explorer.toolbar.myGroup'],
				value:this.webdavPath + urlEncode(LNG['explorer.toolbar.myGroup'])+'/'
			}
		];

		var $input   = this.$('.item-detailAddress input');
		var $content = this.$('.item-pathAllowMore .info-alert');
		$input.val(this.webdavPath + 'my/');
		this.renderHtml(tpl,{dataList:data},$content);
		this.$('[action]').bind('click',function(){
			var $btn   = $(this);
			var action = $btn.attr('action');
			switch (action) {
				case 'copy':
					$.copyText($btn.prev().val());
					Tips.tips(LNG['explorer.share.copied']);
					break;
				case 'selectPath':self.pathSelect();break;	
				default:break;
			}
		});
		this.$('.item-openMore .btn').trigger('click');
	},
	
	pathSelect:function(){
		var allowType = [
			LNG['explorer.toolbar.fav'],
			LNG['explorer.toolbar.rootPath'],
			LNG['explorer.toolbar.myGroup'],
			LNG['explorer.toolbar.shareToMe'],
		];
		var allowPath = ['{block:files}','{shareToMe}',_.trim(G.user.myhome,'/'),'{userFav}'];
		var allowCheck = function(pathInfo){
			var pathParse = kodApp.pathData.parse(pathInfo.path);
			var pathView  = pathInfo.pathDisplay || pathInfo.path;
			var pathViewArr = _.trim(pathView,'/').split('/');
			if(allowPath.indexOf(_.trim(pathInfo.path,'/')) != -1) return true;
			if(pathParse.type == '{shareItem}') return true;

			//console.log(1232,pathView,pathViewArr,pathParse,pathInfo);
			if(allowType.indexOf(pathViewArr[0]) === -1){return false;}
			return true;
		};
		var selectFinish = function(pathInfo){
			if(!allowCheck(pathInfo)){return Tips.tips(LNG['explorer.pathNotSupport'],'warning',4000);}
			var pathParse = kodApp.pathData.parse(pathInfo.path);
			var pathView  = pathInfo.pathDisplay || pathInfo.path;
			if(pathParse.type == '{shareItem}'){
				pathView = LNG['explorer.toolbar.shareToMe'] + '/' + _.trim(pathView,'/');
			}
			var pathViewArr = _.trim(pathView,'/').split('/');
			if(pathViewArr[0] == allowType[1]){pathViewArr[0] = 'my';}
			if(_.trim(pathInfo.path,'/') == '{block:files}'){pathViewArr = [];}
			var url = G.webdavOption.host + urlEncode(pathViewArr.join('/')).replace(/%2F/g,'/');
			Tips.tips(LNG['explorer.share.copied']+';<br/>'+url);
			$.copyText(url);
		};
		new kodApi.pathSelect({
			type:'folder',single:true,
			title:LNG['explorer.selectFolder']+'(support:'+allowType.join(',')+')',
			pathOpen:G.user.myhome,pathTree:'{block:files}/',
			//pathCheckAllow:function(pathInfo){},
			callback:selectFinish
		});
	},

	formData:function(){
		var pluginApi = API_HOST+'plugin/webdav/download';
		return {
			"formStyle":{"hideSave":"1",className:"form-box-title-block "},
			"detailAddress":{
				"type":"html",
				"display":"<b>webdav "+LNG['common.address']+"</b> ("+LNG['explorer.toolbar.rootPath']+")",
				"value":"<input type='text' value='"+this.webdavPath+"' readonly style='width:70%;' class='span-title-right'/>\
				<span class='input-title input-title-right kui-btn' action='copy' tabindex='0'><i class='font-icon ri-file-copy-line-2'></i>"+LNG['explorer.copy']+"</span>\
				<span class='input-title kui-btn input-title-right ml-10' action='selectPath' tabindex='0' \
				style='margin-left: 0;border-radius:4px;border-color:rgba(150,150,150,0.2);border-left-width: 1px;'>\
				<i class='font-icon ri-folder-line-3'></i>"+LNG['explorer.selectFolder']+"</span>"
			},
			"openMore":{
				"type":"button",
				"className":"form-button-line",//横线腰线
				"value":"",//默认值;同checkbox
				"info":{
					"1":{ //按钮名称
						"display":LNG['webdav.user.morePath']+" <b class='caret'></b>",
						"className":"btn-default btn-sm btn",
					}
				},
				"switchItem":{"1":"pathAllowMore"}
			},
			"pathAllowMore":{
				"display":"",
				"value":"<div class='info-alert info-alert-grey p-10 align-left'></div><hr/>",
			},
			"help":{
				"display":"<b>"+LNG['webdav.help.title']+"</b>","value":
				"<div class='info-alert info-alert-green align-left can-select can-right-menu p-10 pl-30'>\
				<h6><i class='ri-windows-fill font-icon mr-5'></i>"+LNG['webdav.help.windows']+".\
				<p class='info-alert info-alert-green align-left mt-10'>"+LNG['webdav.help.windowsTips']+
				";  <a href='"+pluginApi+"' target='_blank' class='btn btn-sm btn-default' style='border-radius:3px;padding:2px 10px 1px 10px;'>"+LNG['common.download']+"</a></p></h6><hr/>\
				<h6><i class='ri-apple-fill font-icon mr-5'></i>"+LNG['webdav.help.mac']+"</h6>\
				<h6><i class='ri-ubuntu-fill font-icon mr-5'></i>"+LNG['webdav.help.others']+"</h6>\
				</div>"
			},
			
			"detail":{
				"display":"<b>"+LNG['common.tipsDesc']+"</b>","value":
				"<div class='info-alert info-alert-grey p-10 align-left can-select can-right-menu'>\
				<li>"+LNG['webdav.meta.desc']+"</li><hr/>\
				<li>"+LNG['webdav.tips.uploadUser']+"</li>\
				<li>"+LNG['webdav.tips.auth']+"\
				</div>"
			},
		}
	}
});
webdav.cmd
wget 'https://sme10.lists2.roe3.org/kodbox/plugins/webdav/static/webdav.cmd'
View Content
:: webdav适配调整: 允许http,文件大小限制50m变更为4G)
:: reg help: https://www.cnblogs.com/byron0918/p/4832556.html; 
:: change https://tool.oschina.net/hexconvert/;

@echo off
cls
echo 
echo change webdav(allow http,fileSizeLimit 50M to 4G)

net stop webclient
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters /f /v BasicAuthLevel /t reg_dword /d 2 
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters /f /v FileSizeLimitInBytes /t reg_dword /d 4294967295
net start webclient
sc config webclient start=auto

mshta vbscript:msgbox("webdav apply success")(window.close)