Skip to content

Commit

Permalink
docs: remove vercel support
Browse files Browse the repository at this point in the history
  • Loading branch information
reruin committed Jun 6, 2020
1 parent a64ff21 commit c2c90af
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 44 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,3 @@ WebDAV 目录 `http://localhost:33001/webdav`
### Heroku

[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/reruin/sharelist-heroku)

### Vercel

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/reruin/sharelist)
4 changes: 1 addition & 3 deletions app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ const db = createFiledb(configPath , {raw:true} , {

anonymous_uplod_enable:0,

anonymous_enable:1,

anonymous_download:'',

plugin_option:[],

custom_style:'',
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const handlers = async (a, body , ctx) => {
cache.clear()
result.message = 'Success'
} else if (a == 'cfg') {
let { proxy_enable, preview_enable, readme_enable, max_age_dir, max_age_file,max_age_download, webdav_path, anonymous_uplod_enable, ignore_file_extensions , ignore_paths , custom_style , custom_script , proxy_paths , proxy_server , ocr_server , language,anonymous_enable, anonymous_download, index_enable } = body
let { proxy_enable, preview_enable, readme_enable, max_age_dir, max_age_file,max_age_download, webdav_path, anonymous_uplod_enable, ignore_file_extensions , ignore_paths , custom_style , custom_script , proxy_paths , proxy_server , ocr_server , language, anonymous_download, index_enable } = body
let opts = {}
if (max_age_dir !== undefined) {
max_age_dir = parseInt(max_age_dir)
Expand Down Expand Up @@ -114,11 +114,6 @@ const handlers = async (a, body , ctx) => {
anonymous_uplod_enable = anonymous_uplod_enable == '1' ? 1 : 0
opts.anonymous_uplod_enable = anonymous_uplod_enable
}

if (anonymous_enable) {
anonymous_enable = anonymous_enable == '1' ? 1 : 0
opts.anonymous_enable = anonymous_enable
}

if (webdav_path) {
opts.webdav_path = webdav_path
Expand Down
11 changes: 3 additions & 8 deletions app/controllers/sharelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const output = async (ctx , data)=>{

const isProxy = (config.getConfig('proxy_enable') && isProxyPath(ctx.path , proxy_paths)) || data.proxy

const preview_enable = config.getConfig('preview_enable')

let url = data.url
//部分webdav客户端不被正常识别
if( ctx.webdav ){
Expand All @@ -65,14 +67,13 @@ const output = async (ctx , data)=>{
return
}

if(isPreview){
if(isPreview && preview_enable){
let re = await service.preview(data)
let displayDownloadLabel = true
if(!download){
if(re.convertible){
displayDownloadLabel = false
}else{
console.log('hit 401',re)
ctx.status = 401
return
}
Expand All @@ -94,7 +95,6 @@ const output = async (ctx , data)=>{
}
else{
if(!download){
console.log('hit 401 here',ctx.runtime)
ctx.status = 401
return
}
Expand Down Expand Up @@ -132,11 +132,6 @@ const output = async (ctx , data)=>{

module.exports = {
async index(ctx){
if( !config.getConfig('anonymous_enable') && !ctx.runtime.isAdmin){
await ctx.renderSkin('manage')
return
}

let downloadLinkAge = config.getConfig('max_age_download')
let cursign = md5(config.getConfig('max_age_download_sign') + Math.floor(Date.now() / downloadLinkAge))
//exclude folder
Expand Down
3 changes: 3 additions & 0 deletions app/plugins/cmd.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ module.exports = ({ cache , getVendor , getConfig , getRuntime , updateFolder ,
}

if(hit.protocol == 'root' ){
if(filter && filter(hit , [])){
return hit;
}
continue
}

Expand Down
32 changes: 12 additions & 20 deletions app/views/default/manage.pug
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ block content
select.form-control(name='readme_enable',value=config.readme_enable,required)
option(value='1', selected=config.readme_enable==1 ? 'selected' : null)= __('enable')
option(value='0', selected=config.readme_enable==0 ? 'selected' : null)= __('disable')
.form-group
.col-sm-4
label= __('anonymous_uplod_enable')
.col-sm-8
select.form-control(name='anonymous_uplod_enable',value=config.anonymous_uplod_enable,required)
option(value='1', selected=config.anonymous_uplod_enable==1 ? 'selected' : null)= __('enable')
option(value='0', selected=config.anonymous_uplod_enable==0 ? 'selected' : null)= __('disable')
.form-group
.col-sm-4
label= __('anonymous_download')
.col-sm-8
input.form-control(type='text', name='anonymous_download' , value=config.anonymous_download,placeholder=__('anonymous_download_placeholder'))
hr
.form-group
.col-sm-4
Expand Down Expand Up @@ -106,26 +118,6 @@ block content
.col-sm-8
input.form-control(type='text', name='ignore_paths' , value=config.ignore_paths.__root__.join(','),placeholder=__('ignore_paths_placeholder'))
hr
.form-group
.col-sm-4
label= __('anonymous_uplod_enable')
.col-sm-8
select.form-control(name='anonymous_uplod_enable',value=config.anonymous_uplod_enable,required)
option(value='1', selected=config.anonymous_uplod_enable==1 ? 'selected' : null)= __('enable')
option(value='0', selected=config.anonymous_uplod_enable==0 ? 'selected' : null)= __('disable')
.form-group
.col-sm-4
label= __('anonymous_enable')
.col-sm-8
select.form-control(name='anonymous_enable',value=config.anonymous_enable,required)
option(value='1', selected=config.anonymous_enable==1 ? 'selected' : null)= __('enable')
option(value='0', selected=config.anonymous_enable==0 ? 'selected' : null)= __('disable')
.form-group
.col-sm-4
label= __('anonymous_download')
.col-sm-8
input.form-control(type='text', name='anonymous_download' , value=config.anonymous_download,placeholder=__('anonymous_download_placeholder'))
hr
.form-group
.col-sm-4
label= __('webdav_path')
Expand Down
4 changes: 2 additions & 2 deletions locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
"max_age_file":"链接缓存时长(秒)",
"max_age_download":"下载链接有效期(秒)",
"max_age_download_placeholder":"设置为0时永久有效",
"anonymous_uplod_enable":"匿名上传",
"anonymous_uplod_enable":"开放上传",
"virtual_path":"虚拟路径",
"general":"常规",
"webdav_path":"WebDAV路径",
Expand All @@ -49,7 +49,7 @@ module.exports = {
"language":"切换语言",
"anonymous_enable":"匿名访问",
"signout":"登出",
"anonymous_download":"匿名下载限制",
"anonymous_download":"下载限制",
"anonymous_download_placeholder":"匹配正则表达式,留空表示允许下载任意文件。",
"index_enable":"目录索引"
}
Loading

0 comments on commit c2c90af

Please sign in to comment.