Browse Source

file and directory's permission improved

master
filesite 2 years ago
parent
commit
5519c0d111
  1. 54
      README.md
  2. 15
      bin/upgrade.sh
  3. 2
      conf/smb.conf
  4. 4
      controller/ApiController.php

54
README.md

@ -21,6 +21,11 @@ Filesite.io也一样,它短小精悍,使用它把常见的本地文件制作
docker pull filesite/machete docker pull filesite/machete
``` ```
支持samba文件共享管理内容的版本:
```
docker pull filesite/machete
```
启动machete容器: 启动machete容器:
@ -80,3 +85,52 @@ docker ps
``` ```
http://127.0.0.1:1080 http://127.0.0.1:1080
``` ```
## 后台管理内容
最新版本已经支持网页版后台和samba文件共享方式管理内容。
### 网页版后台
网址为域名后面加**/admin/**来访问,
默认账号密码:
> 账号:filesite
> 密码:88888888
账号密码可在```conf/app.php```里修改。
### samba文件共享
文件共享网址格式为:
> //filesite:88888888@服务器ip或域名/machete
默认账号密码:
> 账号:filesite
> 密码:88888888
账号密码可在容器中执行命令修改:
```
smbpwd filesite 新密码
```
### 文件共享使用方法
windows下在**运行**里输入:
```
\\服务器ip或域名\machete
```
然后在弹出的登陆框里输入账号密码就可以完成远程磁盘挂载。
macos下挂载共享目录的命令:
```
mount_smbfs //filesite:88888888@服务器ip或域名/machete 本地目录
```
挂载好之后就可以打开Finder看到共享目录了,
点击进去就可以跟管理本地文件和目录一样操作了。

15
bin/upgrade.sh

@ -17,21 +17,6 @@ rsync -vruL machete/* /var/www/machete/ \
--exclude=www/videos/ \ --exclude=www/videos/ \
--exclude=runtime/ --exclude=runtime/
# check the user of php-fpm
phpUser='apache'
isAlpine=`grep 'www-data' /etc/passwd | wc -l`
if [ $isAlpine -ge 1 ]; then
phpUser='www-data'
fi
cd /var/www/machete/ \
&& chown "${phpUser}:${phpUser}" runtime/ \
&& chown -R "${phpUser}:${phpUser}" www/content/ \
&& chown "${phpUser}:${phpUser}" www/navs/ \
&& chown "${phpUser}:${phpUser}" www/girls/ \
&& chown "${phpUser}:${phpUser}" www/videos/
# upgrade admin # upgrade admin
cd /var/www/downloads/ cd /var/www/downloads/
wget "https://git.filesite.io/wen/jialuomaadmin/archive/master.tar.gz" wget "https://git.filesite.io/wen/jialuomaadmin/archive/master.tar.gz"

2
conf/smb.conf

@ -6,7 +6,7 @@
path = /var/www/sambashare/filesite path = /var/www/sambashare/filesite
browseable = yes browseable = yes
read only = no read only = no
force create mode = 0665 force create mode = 0664
force directory mode = 0775 force directory mode = 0775
force group = apache force group = apache
valid users = filesite @sambashare valid users = filesite @sambashare

4
controller/ApiController.php

@ -187,8 +187,9 @@ Class ApiController extends Controller {
} }
try { try {
$res = mkdir("{$target}/{$newDir}"); $res = mkdir("{$target}/{$newDir}", 0775);
if ($res) { if ($res) {
chmod("{$target}/{$newDir}", 0775);
$code = 1; $code = 1;
$msg = '目录创建完成'; $msg = '目录创建完成';
}else { }else {
@ -581,6 +582,7 @@ Class ApiController extends Controller {
$base64 = str_replace(' ', '+', $base64); $base64 = str_replace(' ', '+', $base64);
$fileContent = base64_decode($base64); $fileContent = base64_decode($base64);
file_put_contents($filePath, $fileContent); file_put_contents($filePath, $fileContent);
chmod($filePath, 0664);
//判断文件大小 //判断文件大小
$maxLength = FSC::$app['config']['admin']['maxUploadFileSize'] * 1024*1024; $maxLength = FSC::$app['config']['admin']['maxUploadFileSize'] * 1024*1024;

Loading…
Cancel
Save