Skip to content

Commit a77df20

Browse files
committed
web update and cosmetics
1 parent c3677dc commit a77df20

34 files changed

+488
-447
lines changed

server/cmd/preconfig_and.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ package main
55

66
// #cgo LDFLAGS: -static-libstdc++
77
import "C"
8+
89
import (
910
"os"
1011
"os/signal"
12+
"syscall"
13+
"time"
14+
1115
"server"
1216
"server/log"
1317
"server/settings"
14-
"syscall"
15-
"time"
1618
)
1719

1820
func Preconfig(dkill bool) {

server/docs/docs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,18 @@ const docTemplate = `{
150150
},
151151
"/play/{hash}/{id}": {
152152
"get": {
153-
"description": "Play given torrent referenced by hash.",
153+
"description": "Play given torrent referenced by infohash and file id.",
154154
"produces": [
155155
"application/octet-stream"
156156
],
157157
"tags": [
158158
"API"
159159
],
160-
"summary": "Play given torrent referenced by hash",
160+
"summary": "Play given torrent by infohash",
161161
"parameters": [
162162
{
163163
"type": "string",
164-
"description": "Torrent hash",
164+
"description": "Torrent infohash",
165165
"name": "hash",
166166
"in": "path",
167167
"required": true

server/docs/swagger.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,18 @@
143143
},
144144
"/play/{hash}/{id}": {
145145
"get": {
146-
"description": "Play given torrent referenced by hash.",
146+
"description": "Play given torrent referenced by infohash and file id.",
147147
"produces": [
148148
"application/octet-stream"
149149
],
150150
"tags": [
151151
"API"
152152
],
153-
"summary": "Play given torrent referenced by hash",
153+
"summary": "Play given torrent by infohash",
154154
"parameters": [
155155
{
156156
"type": "string",
157-
"description": "Torrent hash",
157+
"description": "Torrent infohash",
158158
"name": "hash",
159159
"in": "path",
160160
"required": true

server/docs/swagger.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,9 @@ paths:
424424
- Pages
425425
/play/{hash}/{id}:
426426
get:
427-
description: Play given torrent referenced by hash.
427+
description: Play given torrent referenced by infohash and file id.
428428
parameters:
429-
- description: Torrent hash
429+
- description: Torrent infohash
430430
in: path
431431
name: hash
432432
required: true
@@ -441,7 +441,7 @@ paths:
441441
responses:
442442
"200":
443443
description: Torrent data
444-
summary: Play given torrent referenced by hash
444+
summary: Play given torrent by infohash
445445
tags:
446446
- API
447447
/playlist:

server/torrfs/categorydir.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package torrfs
22

33
import (
44
"io/fs"
5-
"server/torr"
65
"time"
6+
7+
"server/torr"
78
)
89

910
type CategoryDir struct {
@@ -18,7 +19,7 @@ func NewCategoryDir(category string) *CategoryDir {
1819
info: info{
1920
name: category,
2021
size: 4096,
21-
mode: 0555,
22+
mode: 0o555,
2223
mtime: time.Unix(477033666, 0),
2324
isDir: true,
2425
},

server/torrfs/fuse/fuse.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,13 @@ func (ffs *FuseFS) Unmount() error {
150150

151151
// ----- go-fuse integration -----
152152

153-
var _ = (gofusefs.InodeEmbedder)((*FuseFS)(nil))
154-
var _ = (gofusefs.NodeOnAdder)((*FuseFS)(nil))
155-
var _ = (gofusefs.NodeGetattrer)((*FuseFS)(nil))
156-
var _ = (gofusefs.NodeReaddirer)((*FuseFS)(nil))
157-
var _ = (gofusefs.NodeLookuper)((*FuseFS)(nil))
153+
var (
154+
_ = (gofusefs.InodeEmbedder)((*FuseFS)(nil))
155+
_ = (gofusefs.NodeOnAdder)((*FuseFS)(nil))
156+
_ = (gofusefs.NodeGetattrer)((*FuseFS)(nil))
157+
_ = (gofusefs.NodeReaddirer)((*FuseFS)(nil))
158+
_ = (gofusefs.NodeLookuper)((*FuseFS)(nil))
159+
)
158160

159161
func (ffs *FuseFS) EmbeddedInode() *gofusefs.Inode { return &ffs.Inode }
160162

@@ -223,10 +225,12 @@ type tfsNode struct {
223225
p string
224226
}
225227

226-
var _ = (gofusefs.NodeGetattrer)((*tfsNode)(nil))
227-
var _ = (gofusefs.NodeReaddirer)((*tfsNode)(nil))
228-
var _ = (gofusefs.NodeLookuper)((*tfsNode)(nil))
229-
var _ = (gofusefs.NodeOpener)((*tfsNode)(nil))
228+
var (
229+
_ = (gofusefs.NodeGetattrer)((*tfsNode)(nil))
230+
_ = (gofusefs.NodeReaddirer)((*tfsNode)(nil))
231+
_ = (gofusefs.NodeLookuper)((*tfsNode)(nil))
232+
_ = (gofusefs.NodeOpener)((*tfsNode)(nil))
233+
)
230234

231235
func (n *tfsNode) full(name string) string { return path.Join(n.p, name) }
232236

@@ -301,8 +305,10 @@ type tfsHandle struct {
301305
f fs.File // must implement io.ReadSeeker
302306
}
303307

304-
var _ = (gofusefs.FileReader)((*tfsHandle)(nil))
305-
var _ = (gofusefs.FileReleaser)((*tfsHandle)(nil))
308+
var (
309+
_ = (gofusefs.FileReader)((*tfsHandle)(nil))
310+
_ = (gofusefs.FileReleaser)((*tfsHandle)(nil))
311+
)
306312

307313
func (h *tfsHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {
308314
rs := h.f.(io.ReadSeeker)

server/torrfs/node.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package torrfs
22

33
import (
44
"io/fs"
5-
"server/torr"
65
"strings"
6+
7+
"server/torr"
78
)
89

910
type INode interface {

server/torrfs/rootdir.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package torrfs
33
import (
44
"io/fs"
55
"path"
6-
"server/torr"
76
"strings"
87
"time"
8+
9+
"server/torr"
910
)
1011

1112
type RootDir struct {
@@ -17,7 +18,7 @@ func NewRootDir() *RootDir {
1718
info: info{
1819
name: "/",
1920
size: 4096,
20-
mode: 0555,
21+
mode: 0o555,
2122
mtime: time.Unix(477033600, 0),
2223
isDir: true,
2324
},

server/torrfs/torrdir.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package torrfs
33
import (
44
"io/fs"
55
"path"
6-
"server/settings"
7-
"server/torr"
86
"strings"
97
"time"
8+
9+
"server/settings"
10+
"server/torr"
1011
)
1112

1213
type TorrDir struct {
@@ -25,7 +26,7 @@ func NewTorrDir(parent INode, name string, torrent *torr.Torrent) *TorrDir {
2526
info: info{
2627
name: name,
2728
size: 4096,
28-
mode: 0555,
29+
mode: 0o555,
2930
mtime: time.Unix(torrent.Timestamp, 0),
3031
isDir: true,
3132
},
@@ -37,7 +38,7 @@ func (d *TorrDir) ReadDir(n int) ([]fs.DirEntry, error) {
3738
if d.Torrent() == nil {
3839
return nil, fs.ErrInvalid
3940
}
40-
//соединяемся с торрентом при чтении директории торрента
41+
// соединяемся с торрентом при чтении директории торрента
4142
if !d.Torrent().GotInfo() {
4243
hash := d.Torrent().Hash().String()
4344
for i := 0; i < settings.BTsets.TorrentDisconnectTimeout*2; i++ {

server/torrfs/torrfile.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package torrfs
22

33
import (
44
"io/fs"
5+
"time"
6+
57
sets "server/settings"
68
"server/torr"
79
"server/torr/storage/torrstor"
8-
"time"
910

1011
"github.com/anacrolix/torrent"
1112
)
@@ -33,7 +34,7 @@ func NewTorrFile(parent INode, name string, file *torrent.File) *TorrFile {
3334
info: info{
3435
name: name,
3536
size: file.Length(),
36-
mode: 0444,
37+
mode: 0o444,
3738
mtime: time.Unix(parent.Torrent().Timestamp, 0),
3839
isDir: false,
3940
},

0 commit comments

Comments
 (0)