repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/utils/utils_test.go
src/utils/utils_test.go
package utils import ( "archive/zip" "bytes" "fmt" "log" "math/rand" "os" "path" "path/filepath" "strings" "testing" "time" "github.com/stretchr/testify/assert" ) const TCP_BUFFER_SIZE = 1024 * 64 var bigFileSize = 75000000 func bigFile() { os.WriteFile("bigfile.test", bytes.Repeat([]byte("z"), bigFil...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/diskusage/diskusage_windows.go
src/diskusage/diskusage_windows.go
package diskusage import ( "unsafe" "golang.org/x/sys/windows" ) type DiskUsage struct { freeBytes int64 totalBytes int64 availBytes int64 } // NewDiskUsage returns an object holding the disk usage of volumePath // or nil in case of error (invalid path, etc) func NewDiskUsage(volumePath string) *DiskUsage { ...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/diskusage/diskusage_test.go
src/diskusage/diskusage_test.go
package diskusage import ( "fmt" "testing" ) var KB = uint64(1024) func TestNewDiskUsage(t *testing.T) { usage := NewDiskUsage(".") fmt.Println("Free:", usage.Free()/(KB*KB)) fmt.Println("Available:", usage.Available()/(KB*KB)) fmt.Println("Size:", usage.Size()/(KB*KB)) fmt.Println("Used:", usage.Used()/(KB*K...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/diskusage/diskusage.go
src/diskusage/diskusage.go
//go:build !windows // +build !windows package diskusage import ( "golang.org/x/sys/unix" ) // DiskUsage contains usage data and provides user-friendly access methods type DiskUsage struct { stat *unix.Statfs_t } // NewDiskUsage returns an object holding the disk usage of volumePath // or nil in case of error (in...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/crypt/crypt.go
src/crypt/crypt.go
package crypt import ( "crypto/aes" "crypto/cipher" "crypto/rand" "crypto/sha256" "fmt" "log" "golang.org/x/crypto/argon2" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/pbkdf2" ) // New generates a new key based on a passphrase and salt func New(passphrase []byte, usersalt []byte) (key []byte,...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/crypt/crypt_test.go
src/crypt/crypt_test.go
package crypt import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func BenchmarkEncrypt(b *testing.B) { bob, _, _ := New([]byte("password"), nil) for i := 0; i < b.N; i++ { Encrypt([]byte("hello, world"), bob) } } func BenchmarkDecrypt(b *testing.B) { key, _, _ := New([]byte("password"), nil) ...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/mnemonicode/mnemonicode.go
src/mnemonicode/mnemonicode.go
// From GitHub version/fork maintained by Stephen Paul Weber available at: // https://github.com/singpolyma/mnemonicode // // Originally from: // http://web.archive.org/web/20101031205747/http://www.tothink.com/mnemonic/ /* Copyright (c) 2000 Oren Tirosh <oren@hishome.net> Permission is hereby granted, free of cha...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/mnemonicode/wordlist.go
src/mnemonicode/wordlist.go
// From GitHub version/fork maintained by Stephen Paul Weber available at: // https://github.com/singpolyma/mnemonicode // // Originally from: // http://web.archive.org/web/20101031205747/http://www.tothink.com/mnemonic/ /* Copyright (c) 2000 Oren Tirosh <oren@hishome.net> Permission is hereby granted, free of charg...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/mnemonicode/mnemonicode_test.go
src/mnemonicode/mnemonicode_test.go
package mnemonicode import ( "testing" ) func TestWordsRequired(t *testing.T) { tests := []struct { name string length int want int }{ {"empty", 0, 0}, {"1 byte", 1, 1}, {"2 bytes", 2, 2}, {"3 bytes", 3, 3}, {"4 bytes", 4, 3}, {"5 bytes", 5, 4}, {"8 bytes", 8, 6}, {"12 bytes", 12, 9}, } ...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/croc/croc.go
src/croc/croc.go
package croc import ( "bytes" "crypto/rand" "crypto/sha256" "encoding/binary" "encoding/hex" "encoding/json" "fmt" "io" "math" "net" "os" "os/exec" "path" "path/filepath" "runtime" "strconv" "strings" "sync" "time" "github.com/denisbrodbeck/machineid" ignore "github.com/sabhiram/go-gitignore" lo...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
true
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/croc/croc_test.go
src/croc/croc_test.go
package croc import ( "os" "path" "path/filepath" "runtime" "strings" "sync" "testing" "time" "github.com/schollz/croc/v10/src/tcp" log "github.com/schollz/logger" "github.com/stretchr/testify/assert" ) func init() { log.SetLevel("trace") go tcp.Run("debug", "127.0.0.1", "8281", "pass123", "8282,8283,8...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/compress/compress.go
src/compress/compress.go
package compress import ( "bytes" "compress/flate" "io" log "github.com/schollz/logger" ) // CompressWithOption returns compressed data using the specified level func CompressWithOption(src []byte, level int) []byte { compressedData := new(bytes.Buffer) compress(src, compressedData, level) return compressedDa...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/compress/compress_test.go
src/compress/compress_test.go
package compress import ( "crypto/rand" "fmt" "testing" "github.com/stretchr/testify/assert" ) var fable = []byte(`The Frog and the Crocodile Once, there was a frog who lived in the middle of a swamp. His entire family had lived in that swamp for generations, but this particular frog decided that he had had quit...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/message/message.go
src/message/message.go
package message import ( "encoding/json" "github.com/schollz/croc/v10/src/comm" "github.com/schollz/croc/v10/src/compress" "github.com/schollz/croc/v10/src/crypt" log "github.com/schollz/logger" ) // Type is a message type type Type string const ( TypePAKE Type = "pake" TypeExternalIP Type = "e...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/message/message_test.go
src/message/message_test.go
package message import ( "crypto/rand" "fmt" "net" "testing" "time" "github.com/schollz/croc/v10/src/comm" "github.com/schollz/croc/v10/src/crypt" log "github.com/schollz/logger" "github.com/stretchr/testify/assert" ) var TypeMessage Type = "message" func TestMessage(t *testing.T) { log.SetLevel("debug") ...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/cli/cli.go
src/cli/cli.go
package cli import ( "encoding/json" "errors" "fmt" "io" "os" "path" "path/filepath" "runtime" "strconv" "strings" "time" "github.com/chzyer/readline" "github.com/schollz/cli/v2" "github.com/schollz/croc/v10/src/comm" "github.com/schollz/croc/v10/src/croc" "github.com/schollz/croc/v10/src/mnemonicode"...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
schollz/croc
https://github.com/schollz/croc/blob/913c22f8ab0b399f87ac3a681091771b39dc763b/src/install/updateversion.go
src/install/updateversion.go
package main import ( "fmt" "os" "os/exec" "strings" ) func main() { err := run() if err != nil { fmt.Println(err) } } func run() (err error) { versionNew := "v" + os.Getenv("VERSION") versionHash, err := exec.Command("git", "rev-parse", "--short", "HEAD").Output() if err != nil { return } versionHas...
go
MIT
913c22f8ab0b399f87ac3a681091771b39dc763b
2026-01-07T08:36:10.668174Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/main.go
main.go
package main import ( "os" "github.com/filebrowser/filebrowser/v2/cmd" ) func main() { if err := cmd.Execute(); err != nil { os.Exit(1) } }
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/storage/storage.go
storage/storage.go
package storage import ( "github.com/filebrowser/filebrowser/v2/auth" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/share" "github.com/filebrowser/filebrowser/v2/users" ) // Storage is a storage powered by a Backend which makes the necessary // verifications when fetching...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/storage/bolt/share.go
storage/bolt/share.go
package bolt import ( "errors" "github.com/asdine/storm/v3" "github.com/asdine/storm/v3/q" fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/share" ) type shareBackend struct { db *storm.DB } func (s shareBackend) All() ([]*share.Link, error) { var v []*share.Lin...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/storage/bolt/utils.go
storage/bolt/utils.go
package bolt import ( "errors" "github.com/asdine/storm/v3" fberrors "github.com/filebrowser/filebrowser/v2/errors" ) func get(db *storm.DB, name string, to interface{}) error { err := db.Get("config", name, to) if errors.Is(err, storm.ErrNotFound) { return fberrors.ErrNotExist } return err } func save(d...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/storage/bolt/config.go
storage/bolt/config.go
package bolt import ( "github.com/asdine/storm/v3" "github.com/filebrowser/filebrowser/v2/settings" ) type settingsBackend struct { db *storm.DB } func (s settingsBackend) Get() (*settings.Settings, error) { set := &settings.Settings{} return set, get(s.db, "settings", set) } func (s settingsBackend) Save(set...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/storage/bolt/auth.go
storage/bolt/auth.go
package bolt import ( "github.com/asdine/storm/v3" "github.com/filebrowser/filebrowser/v2/auth" fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/settings" ) type authBackend struct { db *storm.DB } func (s authBackend) Get(t settings.AuthMethod) (auth.Auther, error...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/storage/bolt/bolt.go
storage/bolt/bolt.go
package bolt import ( "github.com/asdine/storm/v3" "github.com/filebrowser/filebrowser/v2/auth" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/share" "github.com/filebrowser/filebrowser/v2/storage" "github.com/filebrowser/filebrowser/v2/users" ) // NewStorage creates a ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/storage/bolt/users.go
storage/bolt/users.go
package bolt import ( "errors" "fmt" "reflect" "github.com/asdine/storm/v3" fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/users" ) type usersBackend struct { db *storm.DB } func (st usersBackend) GetBy(i interface{}) (user *users.User, err error) { user = &u...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/img/service.go
img/service.go
//go:generate go-enum --sql --marshal --file $GOFILE package img import ( "bytes" "context" "errors" "fmt" "image" "io" "github.com/disintegration/imaging" "github.com/dsoprea/go-exif/v3" "github.com/marusama/semaphore/v2" exifcommon "github.com/dsoprea/go-exif/v3/common" ) // ErrUnsupportedFormat means t...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/img/service_test.go
img/service_test.go
package img import ( "bytes" "context" "image" "image/gif" "image/jpeg" "image/png" "io" "testing" "github.com/spf13/afero" "github.com/stretchr/testify/require" "golang.org/x/image/bmp" "golang.org/x/image/tiff" ) func TestService_Resize(t *testing.T) { testCases := map[string]struct { options []Opti...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/img/service_enum.go
img/service_enum.go
// Code generated by go-enum // DO NOT EDIT! package img import ( "database/sql/driver" "fmt" ) const ( // FormatJpeg is a Format of type Jpeg FormatJpeg Format = iota // FormatPng is a Format of type Png FormatPng // FormatGif is a Format of type Gif FormatGif // FormatTiff is a Format of type Tiff Format...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/auth/hook.go
auth/hook.go
package auth import ( "encoding/json" "errors" "fmt" "log" "net/http" "os" "os/exec" "slices" "strings" fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/files" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) /...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/auth/json.go
auth/json.go
package auth import ( "encoding/json" "net/http" "net/url" "os" "strings" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) // MethodJSONAuth is used to identify json auth. const MethodJSONAuth settings.AuthMethod = "json" type jsonCred struct { Password strin...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/auth/storage.go
auth/storage.go
package auth import ( "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) // StorageBackend is a storage backend for auth storage. type StorageBackend interface { Get(settings.AuthMethod) (Auther, error) Save(Auther) error } // Storage is a auth storage. type Storage ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/auth/proxy.go
auth/proxy.go
package auth import ( "errors" "net/http" fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) // MethodProxyAuth is used to identify no auth. const MethodProxyAuth settings.AuthMethod = "proxy" // ProxyAuth is ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/auth/none.go
auth/none.go
package auth import ( "net/http" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) // MethodNoAuth is used to identify no auth. const MethodNoAuth settings.AuthMethod = "noauth" // NoAuth is no auth implementation of auther. type NoAuth struct{} // Auth uses authen...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/auth/auth.go
auth/auth.go
package auth import ( "net/http" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) // Auther is the authentication interface. type Auther interface { // Auth is called to authenticate a request. Auth(r *http.Request, usr users.Store, stg *settings.Settings, srv *se...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/cmds_add.go
cmd/cmds_add.go
package cmd import ( "strings" "github.com/spf13/cobra" ) func init() { cmdsCmd.AddCommand(cmdsAddCmd) } var cmdsAddCmd = &cobra.Command{ Use: "add <event> <command>", Short: "Add a command to run on a specific event", Long: `Add a command to run on a specific event.`, Args: cobra.MinimumNArgs(2), RunE:...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/rule_rm.go
cmd/rule_rm.go
package cmd import ( "strconv" "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) func init() { rulesCmd.AddCommand(rulesRmCommand) rulesRmCommand.Flags().Uint("index", 0, "index of rule to remove") _ = rulesRmCommand.MarkFlagRequired("in...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/root.go
cmd/root.go
package cmd import ( "context" "crypto/tls" "errors" "fmt" "io" "io/fs" "log" "net" "net/http" "os" "os/signal" "path/filepath" "syscall" "time" "github.com/spf13/afero" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" lumberjack "gopkg.in/natefinch/lumberjack.v2" "githu...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/rules.go
cmd/rules.go
package cmd import ( "fmt" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/filebrowser/filebrowser/v2/rules" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/storage" "github.com/filebrowser/filebrowser/v2/users" ) func init() { rootCmd.AddCommand(rulesCm...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/config_init.go
cmd/config_init.go
package cmd import ( "fmt" "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/settings" ) func init() { configCmd.AddCommand(configInitCmd) addConfigFlags(configInitCmd.Flags()) } var configInitCmd = &cobra.Command{ Use: "init", Short: "Initialize a new database", Long: `Initialize a new dat...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/rules_ls.go
cmd/rules_ls.go
package cmd import ( "github.com/spf13/cobra" ) func init() { rulesCmd.AddCommand(rulesLsCommand) } var rulesLsCommand = &cobra.Command{ Use: "ls", Short: "List global rules or user specific rules", Long: `List global rules or user specific rules.`, Args: cobra.NoArgs, RunE: withStore(func(cmd *cobra.Comm...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/cmd_test.go
cmd/cmd_test.go
package cmd import ( "testing" "github.com/samber/lo" "github.com/spf13/cobra" ) // TestEnvCollisions ensures that there are no collisions in the produced environment // variable names for all commands and their flags. func TestEnvCollisions(t *testing.T) { testEnvCollisions(t, rootCmd) } func testEnvCollisions...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/cmds.go
cmd/cmds.go
package cmd import ( "fmt" "github.com/spf13/cobra" ) func init() { rootCmd.AddCommand(cmdsCmd) } var cmdsCmd = &cobra.Command{ Use: "cmds", Short: "Command runner management utility", Long: `Command runner management utility.`, Args: cobra.NoArgs, } func printEvents(m map[string][]string) { for evt, c...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/hash.go
cmd/hash.go
package cmd import ( "fmt" "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/users" ) func init() { rootCmd.AddCommand(hashCmd) } var hashCmd = &cobra.Command{ Use: "hash <password>", Short: "Hashes a password", Long: `Hashes a password using bcrypt algorithm.`, Args: cobra.ExactArgs(1), ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/cmds_ls.go
cmd/cmds_ls.go
package cmd import ( "github.com/spf13/cobra" ) func init() { cmdsCmd.AddCommand(cmdsLsCmd) cmdsLsCmd.Flags().StringP("event", "e", "", "event name, without 'before' or 'after'") } var cmdsLsCmd = &cobra.Command{ Use: "ls", Short: "List all commands for each event", Long: `List all commands for each event.`...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/utils.go
cmd/utils.go
package cmd import ( "encoding/json" "errors" "fmt" "io/fs" "log" "os" "path/filepath" "strconv" "strings" "github.com/asdine/storm/v3" homedir "github.com/mitchellh/go-homedir" "github.com/samber/lo" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" yaml "gopkg.in/yaml.v3" ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/config.go
cmd/config.go
package cmd import ( "encoding/json" "errors" "fmt" "os" "strings" "text/tabwriter" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/filebrowser/filebrowser/v2/auth" fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/settings" ) func init() { root...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/cmds_rm.go
cmd/cmds_rm.go
package cmd import ( "strconv" "github.com/spf13/cobra" ) func init() { cmdsCmd.AddCommand(cmdsRmCmd) } var cmdsRmCmd = &cobra.Command{ Use: "rm <event> <index> [index_end]", Short: "Removes a command from an event hooker", Long: `Removes a command from an event hooker. The provided index is the same that's...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/users_find.go
cmd/users_find.go
package cmd import ( "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/users" ) func init() { usersCmd.AddCommand(usersFindCmd) usersCmd.AddCommand(usersLsCmd) } var usersFindCmd = &cobra.Command{ Use: "find <id|username>", Short: "Find a user by username or id", Long: `Find a user by userna...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/users_export.go
cmd/users_export.go
package cmd import ( "github.com/spf13/cobra" ) func init() { usersCmd.AddCommand(usersExportCmd) } var usersExportCmd = &cobra.Command{ Use: "export <path>", Short: "Export all users to a file.", Long: `Export all users to a json or yaml file. Please indicate the path to the file where you want to write the ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/config_export.go
cmd/config_export.go
package cmd import ( "github.com/spf13/cobra" ) func init() { configCmd.AddCommand(configExportCmd) } var configExportCmd = &cobra.Command{ Use: "export <path>", Short: "Export the configuration to a file", Long: `Export the configuration to a file. The path must be for a json or yaml file. This exported conf...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/docs.go
cmd/docs.go
package cmd import ( "bytes" "fmt" "os" "path" "regexp" "strings" "github.com/spf13/cobra" "github.com/spf13/cobra/doc" ) func init() { rootCmd.AddCommand(docsCmd) docsCmd.Flags().String("out", "www/docs/cli", "directory to write the docs to") } var docsCmd = &cobra.Command{ Use: "docs", Hidden: true...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/users_add.go
cmd/users_add.go
package cmd import ( "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/users" ) func init() { usersCmd.AddCommand(usersAddCmd) addUserFlags(usersAddCmd.Flags()) } var usersAddCmd = &cobra.Command{ Use: "add <username> <password>", Short: "Create a new user", Long: `Create a new user and add ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/cmd.go
cmd/cmd.go
package cmd // Execute executes the commands. func Execute() error { return rootCmd.Execute() }
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/users_update.go
cmd/users_update.go
package cmd import ( "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) func init() { usersCmd.AddCommand(usersUpdateCmd) usersUpdateCmd.Flags().StringP("password", "p", "", "new password") usersUpdateCmd.Flags().StringP("username", "u", "...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/users_import.go
cmd/users_import.go
package cmd import ( "errors" "fmt" "os" "strconv" "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/users" ) func init() { usersCmd.AddCommand(usersImportCmd) usersImportCmd.Flags().Bool("overwrite", false, "overwrite users with the same id/username combo") usersImportCmd.Flags().Bool("repla...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/config_import.go
cmd/config_import.go
package cmd import ( "encoding/json" "errors" "path/filepath" "reflect" "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/auth" "github.com/filebrowser/filebrowser/v2/settings" ) func init() { configCmd.AddCommand(configImportCmd) } type settingsFile struct { Settings *settings.Settings `jso...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/version.go
cmd/version.go
package cmd import ( "fmt" "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/version" ) func init() { rootCmd.AddCommand(versionCmd) } var versionCmd = &cobra.Command{ Use: "version", Short: "Print the version number", Run: func(_ *cobra.Command, _ []string) { fmt.Println("File Browser v" ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/rules_add.go
cmd/rules_add.go
package cmd import ( "regexp" "github.com/spf13/cobra" "github.com/filebrowser/filebrowser/v2/rules" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) func init() { rulesCmd.AddCommand(rulesAddCmd) rulesAddCmd.Flags().BoolP("allow", "a", false, "indicates this i...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/config_set.go
cmd/config_set.go
package cmd import ( "github.com/spf13/cobra" ) func init() { configCmd.AddCommand(configSetCmd) addConfigFlags(configSetCmd.Flags()) } var configSetCmd = &cobra.Command{ Use: "set", Short: "Updates the configuration", Long: `Updates the configuration. Set the flags for the options you want to change. Other ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/config_cat.go
cmd/config_cat.go
package cmd import ( "github.com/spf13/cobra" ) func init() { configCmd.AddCommand(configCatCmd) } var configCatCmd = &cobra.Command{ Use: "cat", Short: "Prints the configuration", Long: `Prints the configuration.`, Args: cobra.NoArgs, RunE: withStore(func(_ *cobra.Command, _ []string, st *store) error { ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/users_rm.go
cmd/users_rm.go
package cmd import ( "fmt" "github.com/spf13/cobra" ) func init() { usersCmd.AddCommand(usersRmCmd) } var usersRmCmd = &cobra.Command{ Use: "rm <id|username>", Short: "Delete a user by username or id", Long: `Delete a user by username or id`, Args: cobra.ExactArgs(1), RunE: withStore(func(_ *cobra.Comma...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/cmd/users.go
cmd/users.go
package cmd import ( "errors" "fmt" "os" "strconv" "text/tabwriter" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) func init() { rootCmd.AddCommand(usersCmd) } var usersCmd = &cobra.Command{ Use: "users...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/fileutils/file.go
fileutils/file.go
package fileutils import ( "io" "io/fs" "os" "path" "path/filepath" "github.com/spf13/afero" ) // MoveFile moves file from src to dst. // By default the rename filesystem system call is used. If src and dst point to different volumes // the file copy is used as a fallback func MoveFile(afs afero.Fs, src, dst s...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/fileutils/file_test.go
fileutils/file_test.go
package fileutils import "testing" func TestCommonPrefix(t *testing.T) { testCases := map[string]struct { paths []string want string }{ "same lvl": { paths: []string{ "/home/user/file1", "/home/user/file2", }, want: "/home/user", }, "sub folder": { paths: []string{ "/home/user/fol...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/fileutils/copy.go
fileutils/copy.go
package fileutils import ( "io/fs" "os" "path" "github.com/spf13/afero" ) // Copy copies a file or folder from one place to another. func Copy(afs afero.Fs, src, dst string, fileMode, dirMode fs.FileMode) error { if src = path.Clean("/" + src); src == "" { return os.ErrNotExist } if dst = path.Clean("/" + ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/fileutils/dir.go
fileutils/dir.go
package fileutils import ( "errors" "io/fs" "github.com/spf13/afero" ) // CopyDir copies a directory from source to dest and all // of its sub-directories. It doesn't stop if it finds an error // during the copy. Returns an error if any. func CopyDir(afs afero.Fs, source, dest string, fileMode, dirMode fs.FileMod...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/share/storage.go
share/storage.go
package share import ( "time" fberrors "github.com/filebrowser/filebrowser/v2/errors" ) // StorageBackend is the interface to implement for a share storage. type StorageBackend interface { All() ([]*Link, error) FindByUserID(id uint) ([]*Link, error) GetByHash(hash string) (*Link, error) GetPermanent(path stri...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/share/share.go
share/share.go
package share type CreateBody struct { Password string `json:"password"` Expires string `json:"expires"` Unit string `json:"unit"` } // Link is the information needed to build a shareable link. type Link struct { Hash string `json:"hash" storm:"id,index"` Path string `json:"path" storm:"inde...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/version/version.go
version/version.go
package version var ( // Version is the current File Browser version. Version = "(untracked)" // CommitSHA is the commit sha. CommitSHA = "(unknown)" )
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/errors/errors.go
errors/errors.go
package fberrors import ( "errors" "fmt" ) var ( ErrEmptyKey = errors.New("empty key") ErrExist = errors.New("the resource already exists") ErrNotExist = errors.New("the resource does not exist") ErrEmptyPassword = errors.New("password is empty") Er...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/settings/storage.go
settings/storage.go
package settings import ( fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/rules" "github.com/filebrowser/filebrowser/v2/users" ) // StorageBackend is a settings storage backend. type StorageBackend interface { Get() (*Settings, error) Save(*Settings) error GetServe...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/settings/tus.go
settings/tus.go
package settings const DefaultTusChunkSize = 10 * 1024 * 1024 // 10MB const DefaultTusRetryCount = 5 // Tus contains the tus.io settings of the app. type Tus struct { ChunkSize uint64 `json:"chunkSize"` RetryCount uint16 `json:"retryCount"` }
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/settings/defaults.go
settings/defaults.go
package settings import ( "github.com/filebrowser/filebrowser/v2/files" "github.com/filebrowser/filebrowser/v2/users" ) // UserDefaults is a type that holds the default values // for some fields on User. type UserDefaults struct { Scope string `json:"scope"` Locale string `j...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/settings/settings.go
settings/settings.go
package settings import ( "crypto/rand" "io/fs" "log" "strings" "time" "github.com/filebrowser/filebrowser/v2/rules" ) const DefaultUsersHomeBasePath = "/users" const DefaultLogoutPage = "/login" const DefaultMinimumPasswordLength = 12 const DefaultFileMode = 0640 const DefaultDirMode = 0750 // AuthMethod des...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/settings/branding.go
settings/branding.go
package settings // Branding contains the branding settings of the app. type Branding struct { Name string `json:"name"` DisableExternal bool `json:"disableExternal"` DisableUsedPercentage bool `json:"disableUsedPercentage"` Files string `json:"files"` Theme ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/settings/dir.go
settings/dir.go
package settings import ( "errors" "fmt" "log" "os" "path" "regexp" "strings" "github.com/spf13/afero" ) var ( invalidFilenameChars = regexp.MustCompile(`[^0-9A-Za-z@_\-.]`) dashes = regexp.MustCompile(`[\-]+`) ) // MakeUserDir makes the user directory according to settings. func (s *Settings) MakeUserDi...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/rules/rules_test.go
rules/rules_test.go
package rules import "testing" func TestMatchHidden(t *testing.T) { cases := map[string]bool{ "/": false, "/src": false, "/src/": false, "/.circleci": true, "/a/b/c/.docker.json": true, ".docker.json": true, "Dockerfile": false, ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/rules/rules.go
rules/rules.go
package rules import ( "path/filepath" "regexp" "strings" ) // Checker is a Rules checker. type Checker interface { Check(path string) bool } // Rule is a allow/disallow rule. type Rule struct { Regex bool `json:"regex"` Allow bool `json:"allow"` Path string `json:"path"` Regexp *Regexp `json:"reg...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/files/mime.go
files/mime.go
package files // This file contains code primarily sourced from:: // github.com/kataras/iris import ( "mime" ) const ( // ContentBinaryHeaderValue header value for binary data. ContentBinaryHeaderValue = "application/octet-stream" // ContentWebassemblyHeaderValue header value for web assembly files. ContentWeba...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/files/file.go
files/file.go
package files import ( "crypto/md5" "crypto/sha1" "crypto/sha256" "crypto/sha512" "encoding/hex" "errors" "hash" "image" "io" "io/fs" "log" "mime" "net/http" "os" "path" "path/filepath" "regexp" "strings" "time" "github.com/spf13/afero" fberrors "github.com/filebrowser/filebrowser/v2/errors" "g...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/files/utils.go
files/utils.go
package files import ( "os" "unicode/utf8" ) func isBinary(content []byte) bool { maybeStr := string(content) runeCnt := utf8.RuneCount(content) runeIndex := 0 gotRuneErrCnt := 0 firstRuneErrIndex := -1 const ( // 8 and below are control chars (e.g. backspace, null, eof, etc) maxControlCharsCode = 8 //...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/files/listing.go
files/listing.go
package files import ( "sort" "strings" "github.com/maruel/natural" ) // Listing is a collection of files. type Listing struct { Items []*FileInfo `json:"items"` NumDirs int `json:"numDirs"` NumFiles int `json:"numFiles"` Sorting Sorting `json:"sorting"` } // ApplySort applies the so...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/files/sorting.go
files/sorting.go
package files // Sorting contains a sorting order. type Sorting struct { By string `json:"by"` Asc bool `json:"asc"` }
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/diskcache/noop_cache.go
diskcache/noop_cache.go
package diskcache import ( "context" ) type NoOp struct { } func NewNoOp() *NoOp { return &NoOp{} } func (n *NoOp) Store(_ context.Context, _ string, _ []byte) error { return nil } func (n *NoOp) Load(_ context.Context, _ string) (value []byte, exist bool, err error) { return nil, false, nil } func (n *NoOp) ...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/diskcache/cache.go
diskcache/cache.go
package diskcache import ( "context" ) type Interface interface { Store(ctx context.Context, key string, value []byte) error Load(ctx context.Context, key string) (value []byte, exist bool, err error) Delete(ctx context.Context, key string) error }
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/diskcache/file_cache.go
diskcache/file_cache.go
package diskcache import ( "context" "crypto/sha1" "encoding/hex" "errors" "fmt" "io" "os" "path/filepath" "sync" "github.com/spf13/afero" ) type FileCache struct { fs afero.Fs // granular locks scopedLocks struct { sync.Mutex sync.Once locks map[string]sync.Locker } } func New(fs afero.Fs, roo...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/diskcache/file_cache_test.go
diskcache/file_cache_test.go
package diskcache import ( "context" "path/filepath" "testing" "github.com/spf13/afero" "github.com/stretchr/testify/require" ) func TestFileCache(t *testing.T) { ctx := context.Background() const ( key = "key" value = "some text" newValue = "new text" cacheRoot = "/cach...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/runner/parser.go
runner/parser.go
package runner import ( "github.com/filebrowser/filebrowser/v2/settings" ) // ParseCommand parses the command taking in account if the current // instance uses a shell to run the commands or just calls the binary // directly. func ParseCommand(s *settings.Settings, raw string) (command []string, name string, err err...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/runner/commands.go
runner/commands.go
// Copyright 2015 Light Code Labs, LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/runner/commands_test.go
runner/commands_test.go
// Copyright 2015 Light Code Labs, LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/runner/runner.go
runner/runner.go
package runner import ( "fmt" "log" "os" "os/exec" "strings" "github.com/filebrowser/filebrowser/v2/settings" "github.com/filebrowser/filebrowser/v2/users" ) // Runner is a commands runner. type Runner struct { Enabled bool *settings.Settings } // RunHook runs the hooks for the before and after event. func...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/users/storage.go
users/storage.go
package users import ( "sync" "time" fberrors "github.com/filebrowser/filebrowser/v2/errors" ) // StorageBackend is the interface to implement for a users storage. type StorageBackend interface { GetBy(interface{}) (*User, error) Gets() ([]*User, error) Save(u *User) error Update(u *User, fields ...string) er...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/users/assets.go
users/assets.go
package users import ( "embed" "strings" ) //go:embed assets var assets embed.FS var commonPasswords map[string]struct{} func init() { // Password list sourced from: // https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/100k-most-used-passwords-NCSC.txt data, err := assets.ReadF...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/users/storage_test.go
users/storage_test.go
package users // Interface is implemented by storage var _ Store = &Storage{}
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/users/password.go
users/password.go
package users import ( "crypto/rand" "encoding/base64" "golang.org/x/crypto/bcrypt" fberrors "github.com/filebrowser/filebrowser/v2/errors" ) // ValidateAndHashPwd validates and hashes a password. func ValidateAndHashPwd(password string, minimumLength uint) (string, error) { if uint(len(password)) < minimumLen...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/users/users.go
users/users.go
package users import ( "path/filepath" "github.com/spf13/afero" fberrors "github.com/filebrowser/filebrowser/v2/errors" "github.com/filebrowser/filebrowser/v2/files" "github.com/filebrowser/filebrowser/v2/rules" ) // ViewMode describes a view mode. type ViewMode string const ( ListViewMode ViewMode = "list...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/users/permissions.go
users/permissions.go
package users // Permissions describe a user's permissions. type Permissions struct { Admin bool `json:"admin"` Execute bool `json:"execute"` Create bool `json:"create"` Rename bool `json:"rename"` Modify bool `json:"modify"` Delete bool `json:"delete"` Share bool `json:"share"` Download bool `j...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/frontend/assets.go
frontend/assets.go
//go:build !dev package frontend import "embed" //go:embed dist/* var assets embed.FS func Assets() embed.FS { return assets }
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/search/search.go
search/search.go
package search import ( "context" "os" "path" "path/filepath" "strings" "github.com/spf13/afero" "github.com/filebrowser/filebrowser/v2/rules" ) type searchOptions struct { CaseSensitive bool Conditions []condition Terms []string } // Search searches for a query in a fs. func Search(ctx contex...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false
filebrowser/filebrowser
https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/search/conditions.go
search/conditions.go
package search import ( "mime" "path/filepath" "regexp" "strings" ) var ( typeRegexp = regexp.MustCompile(`type:(\w+)`) ) type condition func(path string) bool func extensionCondition(extension string) condition { return func(path string) bool { return filepath.Ext(path) == "."+extension } } func imageCon...
go
Apache-2.0
94ec786d34aaaa924ed34719d4a972520f7fecb5
2026-01-07T08:36:13.695467Z
false