Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
reruin committed Oct 19, 2021
1 parent 5fbecac commit 58023e8
Show file tree
Hide file tree
Showing 33 changed files with 68 additions and 598 deletions.
2 changes: 1 addition & 1 deletion docs/zh-cn/configuration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 后台管理
访问 ```http:https://localhost:33001/manage```,填写口令即可进入后台管理。
访问 ```http:https://localhost:33001/@manage```,填写口令即可进入后台管理。

## 常规

Expand Down
21 changes: 13 additions & 8 deletions packages/sharelist/app/controller/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,23 @@ const getFilePath = (file, app) => {
module.exports = {
async page(ctx, next) {
let filepath = getFilePath(ctx.path == '/' ? 'index.html' : ctx.path.substring(1), this.app)
try {
if (!fs.existsSync(filepath)) {
if ('download' in ctx.query) {
await this.get(ctx, next)
} else {
try {
if (!fs.existsSync(filepath)) {
filepath = getFilePath('index.html', this.app)
}
} catch (e) {
filepath = getFilePath('index.html', this.app)
}
} catch (e) {
filepath = getFilePath('index.html', this.app)
}

let status = await sendfile(ctx, filepath)
if (!status) {
return await this.list(ctx, next)
let status = await sendfile(ctx, filepath)
if (!status) {
return await this.list(ctx, next)
}
}

},
async config(ctx, next) {
let config = getConfig(this.app)
Expand Down
9 changes: 3 additions & 6 deletions packages/sharelist/app/controller/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ exports.send = async (ctx, app, data) => {
//the request need proxy
if (data.extra.proxy) {
let reqHeaders = mergeHeaders(ctx.headers, data.extra.proxy.headers)
console.log(reqHeaders)
let { data: stream, status, error, headers } = await app.curl(download_url, { headers: reqHeaders, responseType: 'stream' })
if (error) {
ctx.status = 500
Expand All @@ -207,14 +206,12 @@ exports.send = async (ctx, app, data) => {
}
} else {
let range = getRange(ctx.header.range, data.size) || { start: 0, end: data.size - 1 }
let { stream, error, headers, acceptRanges = false } = await app.sharelist.createReadStream(data.id, range)

let { stream, error, status, headers, acceptRanges = false } = await app.sharelist.createReadStream(data.id, range)
let isReqRange = !!ctx.header.range
if (stream) {
let options = acceptRanges ? { range } : {}
let resHeaders = createHeaders(data, options)
ctx.set({ ...headers, ...resHeaders })
ctx.status = isReqRange && acceptRanges ? 206 : 200
ctx.set(headers || createHeaders(data, options))
ctx.status = status || (isReqRange && acceptRanges ? 206 : 200)
ctx.body = stream
} else {
ctx.status = 404
Expand Down
Empty file removed packages/sharelist/docs/.nojekyll
Empty file.
13 changes: 0 additions & 13 deletions packages/sharelist/docs/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/sharelist/docs/_navbar.md

This file was deleted.

13 changes: 0 additions & 13 deletions packages/sharelist/docs/en/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/sharelist/docs/en/_navbar.md

This file was deleted.

14 changes: 0 additions & 14 deletions packages/sharelist/docs/en/_sidebar.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/sharelist/docs/en/installation.md

This file was deleted.

51 changes: 0 additions & 51 deletions packages/sharelist/docs/index.html

This file was deleted.

10 changes: 0 additions & 10 deletions packages/sharelist/docs/zh-cn/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/sharelist/docs/zh-cn/_navbar.md

This file was deleted.

17 changes: 0 additions & 17 deletions packages/sharelist/docs/zh-cn/_sidebar.md

This file was deleted.

118 changes: 0 additions & 118 deletions packages/sharelist/docs/zh-cn/advance.md

This file was deleted.

Loading

0 comments on commit 58023e8

Please sign in to comment.