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 |
|---|---|---|---|---|---|---|---|---|
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/static.go | http/static.go | package fbhttp
import (
"encoding/json"
"errors"
"fmt"
"io/fs"
"log"
"net/http"
"os"
"path"
"path/filepath"
"strings"
"text/template"
"github.com/filebrowser/filebrowser/v2/auth"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/storage"
"github.com/filebrowser/fil... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/data.go | http/data.go | package fbhttp
import (
"log"
"net/http"
"strconv"
"github.com/tomasen/realip"
"github.com/filebrowser/filebrowser/v2/rules"
"github.com/filebrowser/filebrowser/v2/runner"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/storage"
"github.com/filebrowser/filebrowser/v2/... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/share.go | http/share.go | package fbhttp
import (
"crypto/rand"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"net/http"
"sort"
"strconv"
"strings"
"time"
"golang.org/x/crypto/bcrypt"
fberrors "github.com/filebrowser/filebrowser/v2/errors"
"github.com/filebrowser/filebrowser/v2/share"
)
func withPermShare(fn handleFunc) hand... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/preview_enum.go | http/preview_enum.go | // Code generated by go-enum
// DO NOT EDIT!
package fbhttp
import (
"database/sql/driver"
"fmt"
"strings"
)
const (
// PreviewSizeThumb is a PreviewSize of type Thumb
PreviewSizeThumb PreviewSize = iota
// PreviewSizeBig is a PreviewSize of type Big
PreviewSizeBig
)
const _PreviewSizeName = "thumbbig"
var ... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/commands.go | http/commands.go | package fbhttp
import (
"bufio"
"io"
"log"
"net/http"
"os/exec"
"slices"
"strings"
"time"
"github.com/gorilla/websocket"
"github.com/filebrowser/filebrowser/v2/runner"
)
const (
WSWriteDeadline = 10 * time.Second
)
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
}
var... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/preview.go | http/preview.go | //go:generate go-enum --sql --marshal --names --file $GOFILE
package fbhttp
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net/http"
"github.com/gorilla/mux"
"github.com/filebrowser/filebrowser/v2/files"
"github.com/filebrowser/filebrowser/v2/img"
)
/*
ENUM(
thumb
big
)
*/
type PreviewSize int
type ImgSe... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/utils.go | http/utils.go | package fbhttp
import (
"encoding/json"
"errors"
"net/http"
"net/url"
"os"
"strings"
libErrors "github.com/filebrowser/filebrowser/v2/errors"
imgErrors "github.com/filebrowser/filebrowser/v2/img"
)
func renderJSON(w http.ResponseWriter, _ *http.Request, data interface{}) (int, error) {
marsh, err := json.Ma... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/settings.go | http/settings.go | package fbhttp
import (
"encoding/json"
"net/http"
"github.com/filebrowser/filebrowser/v2/rules"
"github.com/filebrowser/filebrowser/v2/settings"
)
type settingsData struct {
Signup bool `json:"signup"`
HideLoginButton bool `json:"hideLoginButton"`
Create... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/search.go | http/search.go | package fbhttp
import (
"context"
"encoding/json"
"errors"
"net/http"
"os"
"sync"
"time"
"github.com/filebrowser/filebrowser/v2/search"
)
const searchPingInterval = 5
var searchHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
response := make(chan map[string]interface... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/public_test.go | http/public_test.go | package fbhttp
import (
"fmt"
"net/http"
"net/http/httptest"
"path/filepath"
"testing"
"github.com/asdine/storm/v3"
"github.com/spf13/afero"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/share"
"github.com/filebrowser/filebrowser/v2/storage/bolt"
"github.com/fileb... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/http.go | http/http.go | package fbhttp
import (
"io/fs"
"net/http"
"github.com/gorilla/mux"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/storage"
)
type modifyRequest struct {
What string `json:"what"` // Answer to: what data type?
Which []string `json:"w... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/resource.go | http/resource.go | package fbhttp
import (
"context"
"errors"
"fmt"
"io"
"io/fs"
"log"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strings"
"github.com/shirou/gopsutil/v4/disk"
"github.com/spf13/afero"
fberrors "github.com/filebrowser/filebrowser/v2/errors"
"github.com/filebrowser/filebrowser/v2/files"
"github.c... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/auth.go | http/auth.go | package fbhttp
import (
"encoding/json"
"errors"
"log"
"net/http"
"os"
"strings"
"time"
"github.com/golang-jwt/jwt/v5"
"github.com/golang-jwt/jwt/v5/request"
fbAuth "github.com/filebrowser/filebrowser/v2/auth"
fberrors "github.com/filebrowser/filebrowser/v2/errors"
"github.com/filebrowser/filebrowser/v2/... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/public.go | http/public.go | package fbhttp
import (
"errors"
"net/http"
"net/url"
"path"
"path/filepath"
"strings"
"github.com/spf13/afero"
"golang.org/x/crypto/bcrypt"
"github.com/filebrowser/filebrowser/v2/files"
"github.com/filebrowser/filebrowser/v2/share"
)
var withHashFile = func(fn handleFunc) handleFunc {
return func(w http... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/tus_handlers.go | http/tus_handlers.go | package fbhttp
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"os"
"path/filepath"
"strconv"
"time"
"github.com/jellydator/ttlcache/v3"
"github.com/spf13/afero"
"github.com/filebrowser/filebrowser/v2/files"
)
const maxUploadWait = 3 * time.Minute
// Tracks active uploads along with their ... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/raw.go | http/raw.go | package fbhttp
import (
"errors"
"io/fs"
"log"
"net/http"
"net/url"
gopath "path"
"path/filepath"
"strings"
"github.com/mholt/archives"
"github.com/filebrowser/filebrowser/v2/files"
"github.com/filebrowser/filebrowser/v2/fileutils"
"github.com/filebrowser/filebrowser/v2/users"
)
func slashClean(name str... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/users.go | http/users.go | package fbhttp
import (
"encoding/json"
"errors"
"log"
"net/http"
"sort"
"strconv"
"github.com/gorilla/mux"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"github.com/filebrowser/filebrowser/v2/auth"
fberrors "github.com/filebrowser/filebrowser/v2/errors"
"github.com/filebrowser/filebrowser/v2/us... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/subtitle.go | http/subtitle.go | package fbhttp
import (
"bytes"
"net/http"
"strings"
"github.com/asticode/go-astisub"
"github.com/filebrowser/filebrowser/v2/files"
)
var subtitleHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
if !d.user.Perm.Download {
return http.StatusAccepted, nil
}
file, err ... | go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
filebrowser/filebrowser | https://github.com/filebrowser/filebrowser/blob/94ec786d34aaaa924ed34719d4a972520f7fecb5/http/headers.go | http/headers.go | //go:build !dev
package fbhttp
// global headers to append to every response
var globalHeaders = map[string]string{
"Cache-Control": "no-cache, no-store, must-revalidate",
}
| go | Apache-2.0 | 94ec786d34aaaa924ed34719d4a972520f7fecb5 | 2026-01-07T08:36:13.695467Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/pocketbase.go | pocketbase.go | package pocketbase
import (
"io"
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/fatih/color"
"github.com/pocketbase/pocketbase/cmd"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/hook"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/pock... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/pocketbase_test.go | pocketbase_test.go | package pocketbase
import (
"os"
"path/filepath"
"testing"
"github.com/spf13/cobra"
)
func TestNew(t *testing.T) {
// copy os.Args
originalArgs := make([]string, len(os.Args))
copy(originalArgs, os.Args)
defer func() {
// restore os.Args
os.Args = originalArgs
}()
// change os.Args
os.Args = os.Args[... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/modernc_versions_check.go | modernc_versions_check.go | package pocketbase
import (
"fmt"
"log/slog"
"runtime/debug"
"github.com/fatih/color"
"github.com/pocketbase/pocketbase/core"
)
const (
expectedDriverVersion = "v1.41.0"
expectedLibcVersion = "v1.66.10"
// ModerncDepsCheckHookId is the id of the hook that performs the modernc.org/* deps checks.
// It cou... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/cmd/superuser.go | cmd/superuser.go | package cmd
import (
"errors"
"fmt"
"github.com/fatih/color"
"github.com/go-ozzo/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/security"
"github.com/spf13/cobra"
)
// NewSuperuserCommand creates and returns new command for managing
// superuser accounts... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/cmd/superuser_test.go | cmd/superuser_test.go | package cmd_test
import (
"testing"
"github.com/pocketbase/pocketbase/cmd"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tests"
)
func TestSuperuserUpsertCommand(t *testing.T) {
t.Parallel()
app, _ := tests.NewTestApp()
defer app.Cleanup()
scenarios := []struct {
name s... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/cmd/serve.go | cmd/serve.go | package cmd
import (
"errors"
"net/http"
"github.com/pocketbase/pocketbase/apis"
"github.com/pocketbase/pocketbase/core"
"github.com/spf13/cobra"
)
// NewServeCommand creates and returns new command responsible for
// starting the default PocketBase web server.
func NewServeCommand(app core.App, showStartBanner... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/osutils/dir_test.go | tools/osutils/dir_test.go | package osutils_test
import (
"io/fs"
"os"
"path/filepath"
"testing"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/pocketbase/pocketbase/tools/osutils"
"github.com/pocketbase/pocketbase/tools/security"
)
func TestMoveDirContent(t *testing.T) {
testDir := createTestDir(t)
defer os.RemoveAll(testD... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/osutils/cmd_test.go | tools/osutils/cmd_test.go | package osutils_test
import (
"fmt"
"os"
"strings"
"testing"
"github.com/pocketbase/pocketbase/tools/osutils"
)
func TestYesNoPrompt(t *testing.T) {
scenarios := []struct {
stdin string
fallback bool
expected bool
}{
{"", false, false},
{"", true, true},
// yes
{"y", false, true},
{"Y", fa... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/osutils/cmd.go | tools/osutils/cmd.go | package osutils
import (
"bufio"
"fmt"
"os"
"os/exec"
"runtime"
"strings"
"github.com/go-ozzo/ozzo-validation/v4/is"
)
// LaunchURL attempts to open the provided url in the user's default browser.
//
// It is platform dependent and it uses:
// - "open" on macOS
// - "rundll32" on Windows
// - "xdg-open"... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/osutils/run_test.go | tools/osutils/run_test.go | package osutils
import (
"os"
"strconv"
"testing"
)
func TestIsProbablyGoRun(t *testing.T) {
scenarios := []struct {
arg0 string
runDirs []string
expected bool
}{
{"", nil, false},
{"/a/b", nil, false},
{"/a/b", []string{""}, false},
{"/a/b", []string{"/b/"}, false},
{"/a/b", []string{"/a/"}... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/osutils/run.go | tools/osutils/run.go | package osutils
import (
"os"
"strings"
)
var runDirs = []string{os.TempDir(), cacheDir()}
// IsProbablyGoRun loosely checks if the current program was started with "go run".
func IsProbablyGoRun() bool {
for _, dir := range runDirs {
if dir != "" && strings.HasPrefix(os.Args[0], dir) {
return true
}
}
... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/osutils/dir.go | tools/osutils/dir.go | package osutils
import (
"errors"
"os"
"path/filepath"
"github.com/pocketbase/pocketbase/tools/list"
)
// MoveDirContent moves the src dir content, that is not listed in the exclude list,
// to dest dir (it will be created if missing).
//
// The rootExclude argument is used to specify a list of src root entries ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/gitea.go | tools/auth/gitea.go | package auth
import (
"context"
"encoding/json"
"strconv"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameGitea] = wrapFactory(NewGiteaProvider)
}
var _ Provider = (*Gitea)(nil)
// NameGitea is the unique name of the Gitea provider.
const NameGitea string = ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/patreon.go | tools/auth/patreon.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)
func init() {
Providers[NamePatreon] = wrapFactory(NewPatreonProvider)
}
var _ Provider = (*Patreon)(nil)
// NamePatreon is the unique name of the Patreon pro... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/bitbucket.go | tools/auth/bitbucket.go | package auth
import (
"context"
"encoding/json"
"errors"
"io"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameBitbucket] = wrapFactory(NewBitbucketProvider)
}
var _ Provider = (*Bitbucket)(nil)
// NameBitbucket is the unique name of the Bitbucket provider.
... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/facebook.go | tools/auth/facebook.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/facebook"
)
func init() {
Providers[NameFacebook] = wrapFactory(NewFacebookProvider)
}
var _ Provider = (*Facebook)(nil)
// NameFacebook is the unique name of the Facebook... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/notion.go | tools/auth/notion.go | package auth
import (
"context"
"encoding/json"
"net/http"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameNotion] = wrapFactory(NewNotionProvider)
}
var _ Provider = (*Notion)(nil)
// NameNotion is the unique name of the Notion provider.
const NameNotion st... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/yandex.go | tools/auth/yandex.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/yandex"
)
func init() {
Providers[NameYandex] = wrapFactory(NewYandexProvider)
}
var _ Provider = (*Yandex)(nil)
// NameYandex is the unique name of the Yandex provider.
c... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/spotify.go | tools/auth/spotify.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/spotify"
)
func init() {
Providers[NameSpotify] = wrapFactory(NewSpotifyProvider)
}
var _ Provider = (*Spotify)(nil)
// NameSpotify is the unique name of the Spotify provi... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/microsoft.go | tools/auth/microsoft.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/microsoft"
)
func init() {
Providers[NameMicrosoft] = wrapFactory(NewMicrosoftProvider)
}
var _ Provider = (*Microsoft)(nil)
// NameMicrosoft is the unique name of the Mic... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/twitter.go | tools/auth/twitter.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameTwitter] = wrapFactory(NewTwitterProvider)
}
var _ Provider = (*Twitter)(nil)
// NameTwitter is the unique name of the Twitter provider.
const NameTwitter string =... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/gitee.go | tools/auth/gitee.go | package auth
import (
"context"
"encoding/json"
"io"
"strconv"
"github.com/go-ozzo/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameGitee] = wrapFactory(NewGiteeProvider)
}
var _ Provider = (*Gitee)(nil)
// NameGitee is the unique nam... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/box.go | tools/auth/box.go | package auth
import (
"context"
"encoding/json"
"fmt"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameBox] = wrapFactory(NewBoxProvider)
}
var _ Provider = (*Box)(nil)
// NameBox is the unique name of the Box provider.
const NameBox = "box"
// Box is an aut... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/oidc.go | tools/auth/oidc.go | package auth
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"strconv"
"time"
"github.com/golang-jwt/jwt/v5"
"github.com/pocketbase/pocketbase/tools/auth/internal/jwk"
"github.com/pocketbase/pocketbase/tools/security"
"github.com/pocketbase/pocketbase/tools/types"
"github.com/spf13/cast"
"golang.o... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/base_provider.go | tools/auth/base_provider.go | package auth
import (
"context"
"fmt"
"io"
"maps"
"net/http"
"golang.org/x/oauth2"
)
// BaseProvider defines common fields and methods used by OAuth2 client providers.
type BaseProvider struct {
ctx context.Context
clientId string
clientSecret string
displayName string
redirectURL string
a... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/wakatime.go | tools/auth/wakatime.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameWakatime] = wrapFactory(NewWakatimeProvider)
}
var _ Provider = (*Wakatime)(nil)
// NameWakatime is the unique name of the Wakatime provider.
const NameWakatime = ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/google.go | tools/auth/google.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameGoogle] = wrapFactory(NewGoogleProvider)
}
var _ Provider = (*Google)(nil)
// NameGoogle is the unique name of the Google provider.
const NameGoogle string = "goog... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/livechat.go | tools/auth/livechat.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameLivechat] = wrapFactory(NewLivechatProvider)
}
var _ Provider = (*Livechat)(nil)
// NameLivechat is the unique name of the Livechat provider.
const NameLivechat = ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/linear.go | tools/auth/linear.go | package auth
import (
"bytes"
"context"
"encoding/json"
"errors"
"net/http"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameLinear] = wrapFactory(NewLinearProvider)
}
var _ Provider = (*Linear)(nil)
// NameLinear is the unique name of the Linear provider.
... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/instagram.go | tools/auth/instagram.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameInstagram] = wrapFactory(NewInstagramProvider)
}
var _ Provider = (*Instagram)(nil)
// NameInstagram is the unique name of the Instagram provider.
const NameInstag... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/monday.go | tools/auth/monday.go | package auth
import (
"bytes"
"context"
"encoding/json"
"errors"
"net/http"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameMonday] = wrapFactory(NewMondayProvider)
}
var _ Provider = (*Monday)(nil)
// NameMonday is the unique name of the Monday provider.
... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/kakao.go | tools/auth/kakao.go | package auth
import (
"context"
"encoding/json"
"strconv"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/kakao"
)
func init() {
Providers[NameKakao] = wrapFactory(NewKakaoProvider)
}
var _ Provider = (*Kakao)(nil)
// NameKakao is the unique name of the Kakao provid... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/planningcenter.go | tools/auth/planningcenter.go | package auth
import (
"context"
"encoding/json"
"errors"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NamePlanningcenter] = wrapFactory(NewPlanningcenterProvider)
}
var _ Provider = (*Planningcenter)(nil)
// NamePlanningcenter is the unique name of the Planni... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/trakt.go | tools/auth/trakt.go | package auth
import (
"context"
"encoding/json"
"net/http"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameTrakt] = wrapFactory(NewTraktProvider)
}
var _ Provider = (*Trakt)(nil)
// NameTrakt is the unique name of the Trakt provider.
const NameTrakt string =... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/vk.go | tools/auth/vk.go | package auth
import (
"context"
"encoding/json"
"errors"
"fmt"
"strconv"
"strings"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/vk"
)
func init() {
Providers[NameVK] = wrapFactory(NewVKProvider)
}
var _ Provider = (*VK)(nil)
// NameVK is the unique name of the... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/twitch.go | tools/auth/twitch.go | package auth
import (
"context"
"encoding/json"
"errors"
"net/http"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/twitch"
)
func init() {
Providers[NameTwitch] = wrapFactory(NewTwitchProvider)
}
var _ Provider = (*Twitch)(nil)
// NameTwitch is the unique name of ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/discord.go | tools/auth/discord.go | package auth
import (
"context"
"encoding/json"
"fmt"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameDiscord] = wrapFactory(NewDiscordProvider)
}
var _ Provider = (*Discord)(nil)
// NameDiscord is the unique name of the Discord provider.
const NameDiscord s... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/auth.go | tools/auth/auth.go | package auth
import (
"context"
"encoding/json"
"errors"
"net/http"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
// ProviderFactoryFunc defines a function for initializing a new OAuth2 provider.
type ProviderFactoryFunc func() Provider
// Providers defines a map with all of the avail... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/lark.go | tools/auth/lark.go | package auth
import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameLark] = wrapFactory(NewLarkProvider)
}
var _ Provider = (*Lark)(nil)
// NameLark is the unique name of the Lark provider.
const NameLark string = "lark"
// Lark a... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/mailcow.go | tools/auth/mailcow.go | package auth
import (
"context"
"encoding/json"
"errors"
"strings"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameMailcow] = wrapFactory(NewMailcowProvider)
}
var _ Provider = (*Mailcow)(nil)
// NameMailcow is the unique name of the mailcow provider.
const... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/apple.go | tools/auth/apple.go | package auth
import (
"context"
"encoding/json"
"errors"
"fmt"
"github.com/golang-jwt/jwt/v5"
"github.com/pocketbase/pocketbase/tools/auth/internal/jwk"
"github.com/pocketbase/pocketbase/tools/types"
"github.com/spf13/cast"
"golang.org/x/oauth2"
)
func init() {
Providers[NameApple] = wrapFactory(NewApplePr... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/strava.go | tools/auth/strava.go | package auth
import (
"context"
"encoding/json"
"strconv"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameStrava] = wrapFactory(NewStravaProvider)
}
var _ Provider = (*Strava)(nil)
// NameStrava is the unique name of the Strava provider.
const NameStrava str... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/gitlab.go | tools/auth/gitlab.go | package auth
import (
"context"
"encoding/json"
"strconv"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
)
func init() {
Providers[NameGitlab] = wrapFactory(NewGitlabProvider)
}
var _ Provider = (*Gitlab)(nil)
// NameGitlab is the unique name of the Gitlab provider.
const NameGitlab str... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/github.go | tools/auth/github.go | package auth
import (
"context"
"encoding/json"
"io"
"strconv"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/github"
)
func init() {
Providers[NameGithub] = wrapFactory(NewGithubProvider)
}
var _ Provider = (*Github)(nil)
// NameGithub is the unique name of the G... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/auth_test.go | tools/auth/auth_test.go | package auth_test
import (
"testing"
"github.com/pocketbase/pocketbase/tools/auth"
)
func TestProvidersCount(t *testing.T) {
expected := 32
if total := len(auth.Providers); total != expected {
t.Fatalf("Expected %d providers, got %d", expected, total)
}
}
func TestNewProviderByName(t *testing.T) {
var err ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/base_provider_test.go | tools/auth/base_provider_test.go | package auth
import (
"bytes"
"context"
"encoding/json"
"testing"
"golang.org/x/oauth2"
)
func TestContext(t *testing.T) {
b := BaseProvider{}
before := b.Scopes()
if before != nil {
t.Errorf("Expected nil context, got %v", before)
}
b.SetContext(context.Background())
after := b.Scopes()
if after !=... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/internal/jwk/jwk.go | tools/auth/internal/jwk/jwk.go | // Package jwk implements some common utilities for interacting with JWKs
// (mostly used with OIDC providers).
package jwk
import (
"context"
"crypto/ed25519"
"crypto/rsa"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"math/big"
"net/http"
"strings"
"github.com/golang-jwt/jwt/v5"
)
type JWK stru... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/auth/internal/jwk/jwk_test.go | tools/auth/internal/jwk/jwk_test.go | package jwk_test
import (
"context"
"crypto"
"crypto/ed25519"
"crypto/rand"
"crypto/rsa"
"encoding/base64"
"encoding/json"
"fmt"
"math/big"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/golang-jwt/jwt/v5"
"github.com/pocketbase/pocketbase/tools/auth/internal/jwk"
)
type publicKey inte... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/logger/batch_handler_test.go | tools/logger/batch_handler_test.go | package logger
import (
"context"
"errors"
"fmt"
"log/slog"
"testing"
"time"
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func TestNewBatchHandlerPanic(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("Expected to panic.")
}
}()
NewBatchHandler(BatchOptions{})
}
func T... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/logger/log.go | tools/logger/log.go | package logger
import (
"log/slog"
"time"
"github.com/pocketbase/pocketbase/tools/types"
)
// Log is similar to [slog.Record] bit contains the log attributes as
// preformatted JSON map.
type Log struct {
Time time.Time
Data types.JSONMap[any]
Message string
Level slog.Level
}
| go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/logger/batch_handler.go | tools/logger/batch_handler.go | package logger
import (
"context"
"encoding/json"
"errors"
"log/slog"
"sync"
validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/tools/types"
)
var _ slog.Handler = (*BatchHandler)(nil)
// BatchOptions are options for the BatchHandler.
type BatchOptions struct {
// WriteFunc... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/mailer/html2text.go | tools/mailer/html2text.go | package mailer
import (
"regexp"
"strings"
"github.com/pocketbase/pocketbase/tools/list"
"golang.org/x/net/html"
)
var whitespaceRegex = regexp.MustCompile(`\s+`)
var tagsToSkip = []string{
"style", "script", "iframe", "applet", "object", "svg", "img",
"button", "form", "textarea", "input", "select", "option"... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/mailer/html2text_test.go | tools/mailer/html2text_test.go | package mailer
import (
"testing"
)
func TestHTML2Text(t *testing.T) {
scenarios := []struct {
html string
expected string
}{
{
"",
"",
},
{
"ab c",
"ab c",
},
{
"<!-- test html comment -->",
"",
},
{
"<!-- test html comment --> a ",
"a",
},
{
"<span>a</spa... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/mailer/mailer_test.go | tools/mailer/mailer_test.go | package mailer
import (
"fmt"
"io"
"net/mail"
"strings"
"testing"
)
func TestAddressesToStrings(t *testing.T) {
t.Parallel()
scenarios := []struct {
withName bool
addresses []mail.Address
expected []string
}{
{
true,
[]mail.Address{{Name: "John Doe", Address: "test1@example.com"}, {Name: "Jan... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/mailer/smtp_test.go | tools/mailer/smtp_test.go | package mailer
import (
"net/smtp"
"testing"
)
func TestLoginAuthStart(t *testing.T) {
auth := smtpLoginAuth{username: "test", password: "123456"}
scenarios := []struct {
name string
serverInfo *smtp.ServerInfo
expectError bool
}{
{
"localhost without tls",
&smtp.ServerInfo{TLS: false, Nam... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/mailer/smtp.go | tools/mailer/smtp.go | package mailer
import (
"errors"
"fmt"
"net/smtp"
"strings"
"github.com/domodwyer/mailyak/v3"
"github.com/pocketbase/pocketbase/tools/hook"
"github.com/pocketbase/pocketbase/tools/security"
)
var _ Mailer = (*SMTPClient)(nil)
const (
SMTPAuthPlain = "PLAIN"
SMTPAuthLogin = "LOGIN"
)
// SMTPClient defines ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/mailer/mailer.go | tools/mailer/mailer.go | package mailer
import (
"bytes"
"io"
"net/mail"
"github.com/gabriel-vasile/mimetype"
"github.com/pocketbase/pocketbase/tools/hook"
)
// Message defines a generic email message struct.
type Message struct {
From mail.Address `json:"from"`
To []mail.Address `json:"to"`
... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/mailer/sendmail.go | tools/mailer/sendmail.go | package mailer
import (
"bytes"
"errors"
"mime"
"net/http"
"os/exec"
"strings"
"github.com/pocketbase/pocketbase/tools/hook"
)
var _ Mailer = (*Sendmail)(nil)
// Sendmail implements [mailer.Mailer] interface and defines a mail
// client that sends emails via the "sendmail" *nix command.
//
// This client is ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/subscriptions/broker.go | tools/subscriptions/broker.go | package subscriptions
import (
"fmt"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/pocketbase/pocketbase/tools/store"
)
// Broker defines a struct for managing subscriptions clients.
type Broker struct {
store *store.Store[string, Client]
}
// NewBroker initializes and returns a new Broker instance.... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/subscriptions/client.go | tools/subscriptions/client.go | package subscriptions
import (
"encoding/json"
"net/url"
"strings"
"sync"
"github.com/pocketbase/pocketbase/tools/inflector"
"github.com/pocketbase/pocketbase/tools/security"
"github.com/spf13/cast"
)
const optionsParam = "options"
// SubscriptionOptions defines the request options (query params, headers, et... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/subscriptions/client_test.go | tools/subscriptions/client_test.go | package subscriptions_test
import (
"encoding/json"
"strings"
"testing"
"time"
"github.com/pocketbase/pocketbase/tools/subscriptions"
)
func TestNewDefaultClient(t *testing.T) {
c := subscriptions.NewDefaultClient()
if c.Channel() == nil {
t.Errorf("Expected channel to be initialized")
}
if c.Subscripti... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/subscriptions/message.go | tools/subscriptions/message.go | package subscriptions
import (
"io"
)
// Message defines a client's channel data.
type Message struct {
Name string `json:"name"`
Data []byte `json:"data"`
}
// WriteSSE writes the current message in a SSE format into the provided writer.
//
// For example, writing to a router.Event:
//
// m := Message{Name: "use... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/subscriptions/broker_test.go | tools/subscriptions/broker_test.go | package subscriptions_test
import (
"testing"
"github.com/pocketbase/pocketbase/tools/subscriptions"
)
func TestNewBroker(t *testing.T) {
b := subscriptions.NewBroker()
if b.Clients() == nil {
t.Fatal("Expected clients map to be initialized")
}
}
func TestClients(t *testing.T) {
b := subscriptions.NewBroke... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/subscriptions/message_test.go | tools/subscriptions/message_test.go | package subscriptions_test
import (
"strings"
"testing"
"github.com/pocketbase/pocketbase/tools/subscriptions"
)
func TestMessageWrite(t *testing.T) {
m := subscriptions.Message{
Name: "test_name",
Data: []byte("test_data"),
}
var sb strings.Builder
m.WriteSSE(&sb, "test_id")
expected := "id:test_id\n... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/routine/routine_test.go | tools/routine/routine_test.go | package routine_test
import (
"sync"
"testing"
"github.com/pocketbase/pocketbase/tools/routine"
)
func TestFireAndForget(t *testing.T) {
called := false
fn := func() {
called = true
panic("test")
}
wg := &sync.WaitGroup{}
routine.FireAndForget(fn, wg)
wg.Wait()
if !called {
t.Error("Expected fn ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/routine/routine.go | tools/routine/routine.go | package routine
import (
"log"
"runtime/debug"
"sync"
)
// FireAndForget executes f() in a new go routine and auto recovers if panic.
//
// **Note:** Use this only if you are not interested in the result of f()
// and don't want to block the parent go routine.
func FireAndForget(f func(), wg ...*sync.WaitGroup) {
... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/hook/hook.go | tools/hook/hook.go | package hook
import (
"sort"
"sync"
"github.com/pocketbase/pocketbase/tools/security"
)
// Handler defines a single Hook handler.
// Multiple handlers can share the same id.
// If Id is not explicitly set it will be autogenerated by Hook.Add and Hook.AddHandler.
type Handler[T Resolver] struct {
// Func defines ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/hook/hook_test.go | tools/hook/hook_test.go | package hook
import (
"errors"
"testing"
)
func TestHookAddHandlerAndAdd(t *testing.T) {
calls := ""
h := Hook[*Event]{}
h.BindFunc(func(e *Event) error { calls += "1"; return e.Next() })
h.BindFunc(func(e *Event) error { calls += "2"; return e.Next() })
h3Id := h.BindFunc(func(e *Event) error { calls += "3"... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/hook/event_test.go | tools/hook/event_test.go | package hook
import "testing"
func TestEventNext(t *testing.T) {
calls := 0
e := Event{}
if e.nextFunc() != nil {
t.Fatalf("Expected nextFunc to be nil")
}
e.setNextFunc(func() error {
calls++
return nil
})
if e.nextFunc() == nil {
t.Fatalf("Expected nextFunc to be non-nil")
}
e.Next()
e.Next()... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/hook/tagged_test.go | tools/hook/tagged_test.go | package hook
import (
"strings"
"testing"
)
type mockTagsEvent struct {
Event
tags []string
}
func (m mockTagsEvent) Tags() []string {
return m.tags
}
func TestTaggedHook(t *testing.T) {
calls := ""
base := &Hook[*mockTagsEvent]{}
base.BindFunc(func(e *mockTagsEvent) error { calls += "f0"; return e.Next() ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/hook/event.go | tools/hook/event.go | package hook
// Resolver defines a common interface for a Hook event (see [Event]).
type Resolver interface {
// Next triggers the next handler in the hook's chain (if any).
Next() error
// note: kept only for the generic interface; may get removed in the future
nextFunc() func() error
setNextFunc(f func() error... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/hook/tagged.go | tools/hook/tagged.go | package hook
import (
"github.com/pocketbase/pocketbase/tools/list"
)
// Tagger defines an interface for event data structs that support tags/groups/categories/etc.
// Usually used together with TaggedHook.
type Tagger interface {
Resolver
Tags() []string
}
// wrapped local Hook embedded struct to limit the publ... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/store/store_test.go | tools/store/store_test.go | package store_test
import (
"bytes"
"encoding/json"
"slices"
"strconv"
"testing"
"github.com/pocketbase/pocketbase/tools/store"
)
func TestNew(t *testing.T) {
data := map[string]int{"test1": 1, "test2": 2}
originalRawData, err := json.Marshal(data)
if err != nil {
t.Fatal(err)
}
s := store.New(data)
s... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/store/store.go | tools/store/store.go | package store
import (
"encoding/json"
"sync"
)
// @todo remove after https://github.com/golang/go/issues/20135
const ShrinkThreshold = 200 // the number is arbitrary chosen
// Store defines a concurrent safe in memory key-value data store.
type Store[K comparable, T any] struct {
data map[K]T
mu sync.RW... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/picker/pick_test.go | tools/picker/pick_test.go | package picker_test
import (
"encoding/json"
"testing"
"github.com/pocketbase/pocketbase/tools/picker"
"github.com/pocketbase/pocketbase/tools/search"
)
func TestPickFields(t *testing.T) {
scenarios := []struct {
name string
data any
fields string
expectError bool
result string... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/picker/excerpt_modifier.go | tools/picker/excerpt_modifier.go | package picker
import (
"errors"
"regexp"
"strings"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/spf13/cast"
"golang.org/x/net/html"
)
func init() {
Modifiers["excerpt"] = func(args ...string) (Modifier, error) {
return newExcerptModifier(args...)
}
}
var whitespaceRegex = regexp.MustCompile(... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/picker/modifiers.go | tools/picker/modifiers.go | package picker
import (
"fmt"
"github.com/pocketbase/pocketbase/tools/tokenizer"
)
var Modifiers = map[string]ModifierFactoryFunc{}
type ModifierFactoryFunc func(args ...string) (Modifier, error)
type Modifier interface {
// Modify executes the modifier and returns a new modified value.
Modify(value any) (any,... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/picker/pick.go | tools/picker/pick.go | package picker
import (
"encoding/json"
"strings"
"github.com/pocketbase/pocketbase/tools/search"
"github.com/pocketbase/pocketbase/tools/tokenizer"
)
// Pick converts data into a []any, map[string]any, etc. (using json marshal->unmarshal)
// containing only the fields from the parsed rawFields expression.
//
//... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/picker/excerpt_modifier_test.go | tools/picker/excerpt_modifier_test.go | package picker
import (
"fmt"
"testing"
"github.com/spf13/cast"
)
func TestNewExcerptModifier(t *testing.T) {
scenarios := []struct {
name string
args []string
expectError bool
}{
{
"no arguments",
nil,
true,
},
{
"too many arguments",
[]string{"12", "false", "something"... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/list/list_test.go | tools/list/list_test.go | package list_test
import (
"encoding/json"
"fmt"
"testing"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/pocketbase/pocketbase/tools/types"
)
func TestSubtractSliceString(t *testing.T) {
scenarios := []struct {
base []string
subtract []string
expected string
}{
{
[]string{},
[]st... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
pocketbase/pocketbase | https://github.com/pocketbase/pocketbase/blob/b1da83e5165f938453fbb21e748bca317b08239d/tools/list/list.go | tools/list/list.go | package list
import (
"encoding/json"
"regexp"
"strings"
"github.com/pocketbase/pocketbase/tools/store"
"github.com/spf13/cast"
)
var cachedPatterns = store.New[string, *regexp.Regexp](nil)
// SubtractSlice returns a new slice with only the "base" elements
// that don't exist in "subtract".
func SubtractSlice[... | go | MIT | b1da83e5165f938453fbb21e748bca317b08239d | 2026-01-07T08:35:43.517402Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.