Compare commits
58
Commits
v0.2.0
...
d85c9cb53c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d85c9cb53c
|
||
|
|
2b44a60ee7
|
||
|
|
218e0bf667
|
||
|
|
006eb6e72a
|
||
|
|
5eae5595e9
|
||
|
|
0f47434f60
|
||
|
|
383233202e
|
||
|
|
968d945205
|
||
|
|
6ea6e2e144
|
||
|
|
3265c5a4b2
|
||
|
|
1210ecb510
|
||
|
|
dec022e460
|
||
|
|
79791ef228
|
||
|
|
a0f896dc53
|
||
|
|
fa7a79310d
|
||
|
|
ce962ddd00
|
||
|
|
164a37d41f
|
||
|
|
3ebff29113
|
||
|
|
7f04a9a7bb
|
||
|
|
a2a21482e2
|
||
|
|
ffb42f43eb | ||
|
|
3f9801b1bd | ||
|
|
825fd724ff | ||
|
|
5f58741159 | ||
|
|
47672c586d | ||
|
|
11897d0e1a | ||
|
|
02cea49fc4 | ||
|
|
a52b18ffe4 | ||
|
|
da4bc379d8 | ||
|
|
9c9f0c1f68 | ||
|
|
6a787e7e23 | ||
|
|
cdc8ecf49b | ||
|
|
bd981023da | ||
|
|
a982e07faf | ||
|
|
0bbb415852 | ||
|
|
6207229e9b | ||
|
|
2159aadfcb | ||
|
|
3ebf9b653e | ||
|
|
4d60a9b1b6 | ||
|
|
e042c4414f | ||
|
|
333fc1d12a | ||
|
|
7f2174a33e | ||
|
|
e26a466efc | ||
|
|
d9a46aa5b3 | ||
|
|
dbf82e213b | ||
|
|
4f01e2f5ce | ||
|
|
7281b9be65 | ||
|
|
19b5ef3d9f | ||
|
|
3fe51fc6c5 | ||
|
|
19a3a5004c | ||
|
|
0bf20cd2c9 | ||
|
|
35c217fe46 | ||
|
|
849c72b238 | ||
|
|
c565ec8f21 | ||
|
|
aa5e11329f | ||
|
|
b6556d6e90 | ||
|
|
400ce0db0c | ||
|
|
fc8f4e9d8b |
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build
|
||||
|
||||
steps:
|
||||
- name: lint
|
||||
image: golangci/golangci-lint:v1.46.2
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- golangci-lint run
|
||||
|
||||
- name: test
|
||||
image: golang:1.18.3-alpine
|
||||
environment:
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go test ./...
|
||||
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
when:
|
||||
branch: ["master"]
|
||||
event: ["tag"]
|
||||
settings:
|
||||
registry: code.pztrn.name
|
||||
username: drone
|
||||
password:
|
||||
from_secret: drone_secret
|
||||
repo: code.pztrn.name/pztrn/fastpastebin
|
||||
auto_tag: true
|
||||
@@ -1 +1,7 @@
|
||||
examples/fastpastebin.yaml
|
||||
dist/
|
||||
data/
|
||||
vendor/
|
||||
.idea
|
||||
.vscode
|
||||
*DS_Store*
|
||||
@@ -0,0 +1,38 @@
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375/
|
||||
DOCKER_DRIVER: overlay2
|
||||
DOCKER_TCP_PORT: 2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
CONTAINER_NAME: registry.gitlab.pztrn.name/fastpastebin/fastpastebin
|
||||
DIND_IMAGE: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:dind
|
||||
GOLANGCILINT_IMAGE: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golangci/golangci-lint:v1.40.1-alpine
|
||||
|
||||
services:
|
||||
- name: ${DIND_IMAGE}
|
||||
alias: docker
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
|
||||
lint:
|
||||
stage: test
|
||||
image: ${GOLANGCILINT_IMAGE}
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
- golangci-lint run ./...
|
||||
|
||||
build:
|
||||
stage: build
|
||||
image: $DIND_IMAGE
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||
- source docker/set_docker_tag.sh
|
||||
- docker build -t $CONTAINER_NAME:$DOCKER_TAG .
|
||||
- docker push $CONTAINER_NAME:$DOCKER_TAG
|
||||
only:
|
||||
- tags
|
||||
- master
|
||||
@@ -0,0 +1,33 @@
|
||||
run:
|
||||
deadline: 5m
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
# Because globals might exist, but according to our codestyle they
|
||||
# should be lowercased and considered as unexported.
|
||||
- gochecknoglobals
|
||||
# While it might be useful it'll create more problems that will solve.
|
||||
- gocritic
|
||||
# Complains about main() lengths, which isn't an issue.
|
||||
- funlen
|
||||
# Magic numbers everywhere and we can't get rid of them.
|
||||
- gomnd
|
||||
# This linter MIGHT BE good, but who decided that I want keepFor in
|
||||
# JSON instead of keep_for for KeepFor field?
|
||||
- tagliatelle
|
||||
linters-settings:
|
||||
lll:
|
||||
line-length: 420
|
||||
gocognit:
|
||||
min-complexity: 50
|
||||
gocyclo:
|
||||
min-complexity: 40
|
||||
cyclop:
|
||||
max-complexity: 40
|
||||
|
||||
issues:
|
||||
exclude-rules:
|
||||
# There will be some ToDos.
|
||||
- linters:
|
||||
- godox
|
||||
text: "TODO"
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
FROM golang:1.16.5-alpine AS build
|
||||
|
||||
WORKDIR /fastpastebin
|
||||
COPY . .
|
||||
|
||||
WORKDIR /fastpastebin/cmd/fastpastebin
|
||||
|
||||
RUN CGO_ENABLED=0 go build -tags netgo
|
||||
|
||||
FROM alpine:3.13
|
||||
LABEL maintainer "Stanislav N. <pztrn@pztrn.name>"
|
||||
|
||||
COPY --from=build /fastpastebin/cmd/fastpastebin/fastpastebin /app/fastpastebin
|
||||
COPY docker/fastpastebin.docker.yaml /app/fastpastebin.yaml
|
||||
|
||||
EXPOSE 25544
|
||||
ENTRYPOINT [ "/app/fastpastebin", "-config", "/app/fastpastebin.yaml" ]
|
||||
Generated
-187
@@ -1,187 +0,0 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/alecthomas/chroma"
|
||||
packages = [
|
||||
".",
|
||||
"formatters",
|
||||
"formatters/html",
|
||||
"lexers",
|
||||
"lexers/a",
|
||||
"lexers/b",
|
||||
"lexers/c",
|
||||
"lexers/d",
|
||||
"lexers/e",
|
||||
"lexers/f",
|
||||
"lexers/g",
|
||||
"lexers/h",
|
||||
"lexers/i",
|
||||
"lexers/internal",
|
||||
"lexers/j",
|
||||
"lexers/k",
|
||||
"lexers/l",
|
||||
"lexers/m",
|
||||
"lexers/n",
|
||||
"lexers/o",
|
||||
"lexers/p",
|
||||
"lexers/q",
|
||||
"lexers/r",
|
||||
"lexers/s",
|
||||
"lexers/t",
|
||||
"lexers/v",
|
||||
"lexers/w",
|
||||
"lexers/x",
|
||||
"lexers/y",
|
||||
"styles"
|
||||
]
|
||||
revision = "3020e2ea8c6b1a9c2336022d847c4392c3997f02"
|
||||
version = "v0.4.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/danwakefield/fnmatch"
|
||||
packages = ["."]
|
||||
revision = "cbb64ac3d964b81592e64f957ad53df015803288"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/dchest/captcha"
|
||||
packages = ["."]
|
||||
revision = "6a29415a8364ec2971fdc62d9e415ed53fc20410"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/dgrijalva/jwt-go"
|
||||
packages = ["."]
|
||||
revision = "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e"
|
||||
version = "v3.2.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/dlclark/regexp2"
|
||||
packages = [
|
||||
".",
|
||||
"syntax"
|
||||
]
|
||||
revision = "487489b64fb796de2e55f4e8a4ad1e145f80e957"
|
||||
version = "v1.1.6"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/go-sql-driver/mysql"
|
||||
packages = ["."]
|
||||
revision = "a0583e0143b1624142adab07e0e97fe106d99561"
|
||||
version = "v1.3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/jmoiron/sqlx"
|
||||
packages = [
|
||||
".",
|
||||
"reflectx"
|
||||
]
|
||||
revision = "2aeb6a910c2b94f2d5eb53d9895d80e27264ec41"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/labstack/echo"
|
||||
packages = [
|
||||
".",
|
||||
"middleware"
|
||||
]
|
||||
revision = "6d227dfea4d2e52cb76856120b3c17f758139b4e"
|
||||
version = "3.3.5"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/labstack/gommon"
|
||||
packages = [
|
||||
"bytes",
|
||||
"color",
|
||||
"log",
|
||||
"random"
|
||||
]
|
||||
revision = "588f4e8bddc6cb45c27b448e925c7fd6a5545434"
|
||||
version = "0.2.5"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-colorable"
|
||||
packages = ["."]
|
||||
revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
|
||||
version = "v0.0.9"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-isatty"
|
||||
packages = ["."]
|
||||
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
|
||||
version = "v0.0.3"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pressly/goose"
|
||||
packages = ["."]
|
||||
revision = "056a4d47dcc4d67fa3947a4f13945a5c690e568b"
|
||||
version = "v2.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/pztrn/flagger"
|
||||
packages = ["."]
|
||||
revision = "1330c5f1b64f253b0505ee4a2417fb8be856b87d"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/rs/zerolog"
|
||||
packages = [
|
||||
".",
|
||||
"internal/cbor",
|
||||
"internal/json"
|
||||
]
|
||||
revision = "05eafee0eb17d0150591a8f30f0fa592cc9b7471"
|
||||
version = "v1.6.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/valyala/bytebufferpool"
|
||||
packages = ["."]
|
||||
revision = "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/valyala/fasttemplate"
|
||||
packages = ["."]
|
||||
revision = "dcecefd839c4193db0d35b88ec65b4c12d360ab0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = [
|
||||
"acme",
|
||||
"acme/autocert",
|
||||
"pbkdf2",
|
||||
"scrypt"
|
||||
]
|
||||
revision = "b49d69b5da943f7ef3c9cf91c8777c1f78a0cc3c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
"webdav",
|
||||
"webdav/internal/xml"
|
||||
]
|
||||
revision = "5f9ae10d9af5b1c89ae6904293b14b064d4ada23"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "cbbc999da32df943dac6cd71eb3ee39e1d7838b9"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
|
||||
version = "v2.2.1"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "aea0cd48405b88f2c799a3d994b952758f29e06ada92b4bbe6cc4ff105d95d59"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
#
|
||||
# [prune]
|
||||
# non-go = false
|
||||
# go-tests = true
|
||||
# unused-packages = true
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/rs/zerolog"
|
||||
version = "1.6.0"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
||||
@@ -1,79 +1,60 @@
|
||||
[Chat on Keybase.io](https://keybase.io/team/fastpastebin)
|
||||
|
||||
# Fast Pastebin
|
||||
|
||||
Easy-to-use-and-install pastebin software written in Go. No bells or
|
||||
whistles, no websockets and even NO JAVASCRIPT!
|
||||
[](https://github-ci.pztrn.name/pztrn/fastpastebin) 
|
||||
|
||||
# Current functionality.
|
||||
Easy-to-use-and-install pastebin software written in Go. No bells or whistles, no websockets and even NO JAVASCRIPT!
|
||||
|
||||
## Current functionality
|
||||
|
||||
* Create and view public and private pastes.
|
||||
* Syntax highlighting.
|
||||
* Pastes expiration.
|
||||
* Passwords for pastes.
|
||||
* Multiple storage backends. Currently: ``flatfiles`` and ``mysql``.
|
||||
* Multiple storage backends. Currently: ``flatfiles``, ``mysql`` and ``postgresql``.
|
||||
|
||||
# Caveats.
|
||||
## Caveats
|
||||
|
||||
* No links at lines numbers. See https://github.com/alecthomas/chroma/issues/132
|
||||
* No links at lines numbers. See [this Chroma bug](https://github.com/alecthomas/chroma/issues/132)
|
||||
|
||||
# Installation and updating
|
||||
## Installation and updating
|
||||
|
||||
Just issue:
|
||||
|
||||
```
|
||||
go get -u -v github.com/pztrn/fastpastebin/cmd/fastpastebin
|
||||
```bash
|
||||
CGO_ENABLED=0 go get -u -v go.dev.pztrn.name/fastpastebin/cmd/fastpastebin
|
||||
```
|
||||
|
||||
This command can be used to update Fast Paste Bin.
|
||||
|
||||
**WARNING:** installation by compiling Fast Paste Bin from sources **require**
|
||||
at least 300 megabytes of free RAM! Eventually it'll run even on 64MB-powered
|
||||
VM, it's only a compilation issue.
|
||||
## Configuration
|
||||
|
||||
# Configuration.
|
||||
Take a look at [example configuration file](examples/fastpastebin.yaml.dist) which contains all supported options and their descriptions.
|
||||
|
||||
Take a look at [example configuration file](examples/fastpastebin.yaml.dist)
|
||||
which contains all supported options and their descriptions.
|
||||
Configuration file position is irrelevant, there is no hardcoded paths where Fast Paste Bin looking for it's configuration. Use ``-config`` CLI parameter or ``FASTPASTEBIN_CONFIG`` environment variable to specify path.
|
||||
|
||||
Configuration file position is irrelevant, there is no hardcoded paths where
|
||||
Fast Paste Bin looking for it's configuration. Use ``-config`` CLI parameter
|
||||
or ``FASTPASTEBIN_CONFIG`` environment variable to specify path.
|
||||
## Developing
|
||||
|
||||
# Developing
|
||||
Developers should install [fileb0x](https://github.com/UnnoTed/fileb0x/) which is used as replacement to go-bindata for embedding assets into binary. After changing assets they should be recompiled into Go code. At repository root execute this command and you'll be fine:
|
||||
|
||||
Developers should install https://github.com/UnnoTed/fileb0x/ which is used
|
||||
as replacement to go-bindata for embedding assets into binary. After changing
|
||||
assets they should be recompiled into Go code. At repository root execute
|
||||
this command and you'll be fine:
|
||||
|
||||
```
|
||||
```bash
|
||||
fileb0x fileb0x.yml
|
||||
```
|
||||
|
||||
Also if you're changed list of assets (by creating or deleting them) be sure
|
||||
to fix files list in ``fileb0x.yml`` file!
|
||||
Also if you're changed list of assets (by creating or deleting them) be sure to fix files list in ``fileb0x.yml`` file!
|
||||
|
||||
The rest is default - use linters, formatters, etc. VSCode with Go plugin is
|
||||
recommended for developing as it will perform most of linting-formatting
|
||||
actions automagically. Try to follow https://github.com/golang/go/wiki/CodeReviewComments
|
||||
with few exceptions:
|
||||
The rest is default - use linters, formatters, etc. VSCode with Go plugin is recommended for developing as it will perform most of linting-formatting
|
||||
actions automagically. Try to follow [Go's code review comments](https://github.com/golang/go/wiki/CodeReviewComments) with few exceptions:
|
||||
|
||||
* Imports should be organized in 3 groups: stdlib, local, other. See
|
||||
https://github.com/pztrn/fastpastebin/blob/master/pastes/api_http.go for
|
||||
example.
|
||||
* Imports should be organized in 3 groups: stdlib, local, other. See [this file](https://sources.dev.pztrn.name/fastpastebin/fastpastebin/src/branch/master/domains/pastes/paste_get.go) for example.
|
||||
* We're not forcing any limits on line length for code, only for comments, they should be 72-76 chars long.
|
||||
|
||||
* We're not forcing any limits on line length for code, only for comments,
|
||||
they should be 72-76 chars long.
|
||||
## ToDo
|
||||
|
||||
# ToDo
|
||||
|
||||
This is a ToDo list which isn't sorted by any parameter at all. Just a list
|
||||
of tasks you can help with.
|
||||
This is a ToDo list which isn't sorted by any parameter at all. Just a list of tasks you can help with.
|
||||
|
||||
* User CP.
|
||||
* Files uploading.
|
||||
* Passwords for files.
|
||||
* Pastes forking and revisioning (like git or github gists).
|
||||
* Possibility to copy-paste-edit WISYWIG content.
|
||||
* Possibility to copy-paste-edit WYSIWYG content.
|
||||
* CLI client for pastes and files uploading.
|
||||
@@ -1,182 +0,0 @@
|
||||
// Code generated by fileb0x at "2018-05-26 13:58:30.612342807 +0500 +05 m=+0.013490397" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modification hash(e9e210106a4d77680942064c40d06a3e.522a9cc525fa984df98098d4c3992752)
|
||||
|
||||
package static
|
||||
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
|
||||
"golang.org/x/net/webdav"
|
||||
"context"
|
||||
|
||||
|
||||
)
|
||||
|
||||
var (
|
||||
// CTX is a context for webdav vfs
|
||||
CTX = context.Background()
|
||||
|
||||
|
||||
// FS is a virtual memory file system
|
||||
FS = webdav.NewMemFS()
|
||||
|
||||
|
||||
// Handler is used to server files through a http handler
|
||||
Handler *webdav.Handler
|
||||
|
||||
// HTTP is the http file system
|
||||
HTTP http.FileSystem = new(HTTPFS)
|
||||
)
|
||||
|
||||
// HTTPFS implements http.FileSystem
|
||||
type HTTPFS struct {}
|
||||
|
||||
|
||||
|
||||
func init() {
|
||||
if CTX.Err() != nil {
|
||||
panic(CTX.Err())
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var err error
|
||||
|
||||
|
||||
|
||||
|
||||
err = FS.Mkdir(CTX, "static/", 0777)
|
||||
if err != nil && err != os.ErrExist {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
|
||||
err = FS.Mkdir(CTX, "static/css/", 0777)
|
||||
if err != nil && err != os.ErrExist {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
|
||||
err = FS.Mkdir(CTX, "static/js/", 0777)
|
||||
if err != nil && err != os.ErrExist {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Handler = &webdav.Handler{
|
||||
FileSystem: FS,
|
||||
LockSystem: webdav.NewMemLS(),
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Open a file
|
||||
func (hfs *HTTPFS) Open(path string) (http.File, error) {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return f, nil
|
||||
}
|
||||
|
||||
// ReadFile is adapTed from ioutil
|
||||
func ReadFile(path string) ([]byte, error) {
|
||||
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
buf := bytes.NewBuffer(make([]byte, 0, bytes.MinRead))
|
||||
|
||||
// If the buffer overflows, we will get bytes.ErrTooLarge.
|
||||
// Return that as an error. Any other panic remains.
|
||||
defer func() {
|
||||
e := recover()
|
||||
if e == nil {
|
||||
return
|
||||
}
|
||||
if panicErr, ok := e.(error); ok && panicErr == bytes.ErrTooLarge {
|
||||
err = panicErr
|
||||
} else {
|
||||
panic(e)
|
||||
}
|
||||
}()
|
||||
_, err = buf.ReadFrom(f)
|
||||
return buf.Bytes(), err
|
||||
}
|
||||
|
||||
// WriteFile is adapTed from ioutil
|
||||
func WriteFile(filename string, data []byte, perm os.FileMode) error {
|
||||
f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n, err := f.Write(data)
|
||||
if err == nil && n < len(data) {
|
||||
err = io.ErrShortWrite
|
||||
}
|
||||
if err1 := f.Close(); err == nil {
|
||||
err = err1
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// WalkDirs looks for files in the given dir and returns a list of files in it
|
||||
// usage for all files in the b0x: WalkDirs("", false)
|
||||
func WalkDirs(name string, includeDirsInList bool, files ...string) ([]string, error) {
|
||||
f, err := FS.OpenFile(CTX, name, os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fileInfos, err := f.Readdir(0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, info := range fileInfos {
|
||||
filename := path.Join(name, info.Name())
|
||||
|
||||
if includeDirsInList || !info.IsDir() {
|
||||
files = append(files, filename)
|
||||
}
|
||||
|
||||
if info.IsDir() {
|
||||
files, err = WalkDirs(filename, includeDirsInList, files...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return files, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 13:29:06.05698436 +0500 +05 m=+0.013970976" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 13:29:04.002355958 +0500 +05)
|
||||
// original path: assets/error.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileErrorHTML is "/error.html"
|
||||
var FileErrorHTML = []byte("\x3c\x73\x65\x63\x74\x69\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x73\x65\x63\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x6f\x78\x20\x68\x61\x73\x2d\x62\x61\x63\x6b\x67\x72\x6f\x75\x6e\x64\x2d\x77\x61\x72\x6e\x69\x6e\x67\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e\x7b\x65\x72\x72\x6f\x72\x7d\x3c\x2f\x70\x3e\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x73\x65\x63\x74\x69\x6f\x6e\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/error.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileErrorHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 12:55:42.087956217 +0500 +05 m=+0.009637095" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 12:54:22.9990735 +0500 +05)
|
||||
// original path: assets/footer.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileFooterHTML is "/footer.html"
|
||||
var FileFooterHTML = []byte("\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x61\x69\x6e\x65\x72\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x65\x6e\x74\x20\x68\x61\x73\x2d\x74\x65\x78\x74\x2d\x63\x65\x6e\x74\x65\x72\x65\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x73\x74\x72\x6f\x6e\x67\x3e\x46\x61\x73\x74\x20\x70\x61\x73\x74\x65\x20\x62\x69\x6e\x3c\x2f\x73\x74\x72\x6f\x6e\x67\x3e\x20\x76\x65\x72\x73\x69\x6f\x6e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x73\x74\x72\x6f\x6e\x67\x3e\x7b\x76\x65\x72\x73\x69\x6f\x6e\x7d\x3c\x2f\x73\x74\x72\x6f\x6e\x67\x3e\x20\x62\x79\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x70\x7a\x74\x72\x6e\x2e\x6e\x61\x6d\x65\x22\x3e\x53\x74\x61\x6e\x69\x73\x6c\x61\x76\x20\x4e\x2e\x20\x61\x6b\x61\x20\x70\x7a\x74\x72\x6e\x3c\x2f\x61\x3e\x2e\x20\x54\x68\x65\x20\x73\x6f\x75\x72\x63\x65\x20\x63\x6f\x64\x65\x20\x69\x73\x20\x6c\x69\x63\x65\x6e\x73\x65\x64\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x6f\x70\x65\x6e\x73\x6f\x75\x72\x63\x65\x2e\x6f\x72\x67\x2f\x6c\x69\x63\x65\x6e\x73\x65\x73\x2f\x6d\x69\x74\x2d\x6c\x69\x63\x65\x6e\x73\x65\x2e\x70\x68\x70\x22\x3e\x4d\x49\x54\x3c\x2f\x61\x3e\x2e\x20\x47\x65\x74\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x70\x7a\x74\x72\x6e\x2f\x66\x61\x73\x74\x70\x61\x73\x74\x65\x62\x69\x6e\x22\x3e\x73\x6f\x75\x72\x63\x65\x20\x6f\x72\x20\x62\x69\x6e\x61\x72\x79\x20\x72\x65\x6c\x65\x61\x73\x65\x73\x20\x68\x65\x72\x65\x3c\x2f\x61\x3e\x21\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x70\x3e\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x64\x69\x76\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/footer.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileFooterHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 12:42:22.452480227 +0500 +05 m=+0.054334600" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 12:41:48.075758624 +0500 +05)
|
||||
// original path: assets/index.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileIndexHTML is "/index.html"
|
||||
var FileIndexHTML = []byte("\x3c\x73\x65\x63\x74\x69\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x73\x65\x63\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x66\x6f\x72\x6d\x20\x61\x63\x74\x69\x6f\x6e\x3d\x22\x2f\x70\x61\x73\x74\x65\x2f\x22\x20\x6d\x65\x74\x68\x6f\x64\x3d\x22\x50\x4f\x53\x54\x22\x20\x61\x75\x74\x6f\x63\x6f\x6d\x70\x6c\x65\x74\x65\x3d\x22\x6f\x66\x66\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6c\x75\x6d\x6e\x73\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6c\x75\x6d\x6e\x20\x69\x73\x2d\x38\x20\x66\x69\x65\x6c\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x72\x6f\x6c\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x65\x78\x74\x61\x72\x65\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x74\x65\x78\x74\x61\x72\x65\x61\x22\x20\x70\x6c\x61\x63\x65\x68\x6f\x6c\x64\x65\x72\x3d\x22\x50\x61\x73\x74\x65\x20\x63\x6f\x6e\x74\x65\x6e\x74\x73\x22\x20\x6e\x61\x6d\x65\x3d\x22\x70\x61\x73\x74\x65\x2d\x63\x6f\x6e\x74\x65\x6e\x74\x73\x22\x20\x69\x64\x3d\x22\x70\x61\x73\x74\x65\x2d\x63\x6f\x6e\x74\x65\x6e\x74\x73\x22\x3e\x3c\x2f\x74\x65\x78\x74\x61\x72\x65\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6c\x75\x6d\x6e\x20\x69\x73\x2d\x34\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x66\x69\x65\x6c\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x72\x6f\x6c\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x69\x6e\x70\x75\x74\x20\x63\x6c\x61\x73\x73\x3d\x22\x69\x6e\x70\x75\x74\x22\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x22\x20\x70\x6c\x61\x63\x65\x68\x6f\x6c\x64\x65\x72\x3d\x22\x50\x61\x73\x74\x65\x20\x74\x69\x74\x6c\x65\x22\x20\x6e\x61\x6d\x65\x3d\x22\x70\x61\x73\x74\x65\x2d\x74\x69\x74\x6c\x65\x22\x20\x69\x64\x3d\x22\x70\x61\x73\x74\x65\x2d\x74\x69\x74\x6c\x65\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x66\x69\x65\x6c\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x6c\x61\x62\x65\x6c\x20\x66\x6f\x72\x3d\x22\x70\x61\x73\x74\x65\x2d\x6b\x65\x65\x70\x2d\x66\x6f\x72\x22\x3e\x50\x61\x73\x74\x65\x20\x73\x68\x6f\x75\x6c\x64\x20\x62\x65\x20\x61\x76\x61\x69\x6c\x61\x62\x6c\x65\x20\x66\x6f\x72\x3a\x3c\x2f\x6c\x61\x62\x65\x6c\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x72\x6f\x6c\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x73\x65\x6c\x65\x63\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x73\x65\x6c\x65\x63\x74\x20\x69\x64\x3d\x22\x70\x61\x73\x74\x65\x2d\x6b\x65\x65\x70\x2d\x66\x6f\x72\x22\x20\x6e\x61\x6d\x65\x3d\x22\x70\x61\x73\x74\x65\x2d\x6b\x65\x65\x70\x2d\x66\x6f\x72\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x6f\x70\x74\x69\x6f\x6e\x20\x76\x61\x6c\x75\x65\x3d\x22\x33\x30\x4d\x22\x3e\x33\x30\x20\x6d\x69\x6e\x75\x74\x65\x73\x3c\x2f\x6f\x70\x74\x69\x6f\x6e\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x6f\x70\x74\x69\x6f\x6e\x20\x76\x61\x6c\x75\x65\x3d\x22\x31\x68\x22\x3e\x31\x20\x68\x6f\x75\x72\x3c\x2f\x6f\x70\x74\x69\x6f\x6e\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x6f\x70\x74\x69\x6f\x6e\x20\x76\x61\x6c\x75\x65\x3d\x22\x33\x68\x22\x3e\x33\x20\x68\x6f\x75\x72\x73\x3c\x2f\x6f\x70\x74\x69\x6f\x6e\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x6f\x70\x74\x69\x6f\x6e\x20\x76\x61\x6c\x75\x65\x3d\x22\x36\x68\x22\x3e\x36\x20\x68\x6f\x75\x72\x73\x3c\x2f\x6f\x70\x74\x69\x6f\x6e\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2Line truncated
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/index.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileIndexHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 12:42:22.452857215 +0500 +05 m=+0.054711585" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 12:41:36.015758918 +0500 +05)
|
||||
// original path: assets/main.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileMainHTML is "/main.html"
|
||||
var FileMainHTML = []byte("\x3c\x21\x44\x4f\x43\x54\x59\x50\x45\x20\x68\x74\x6d\x6c\x3e\x0a\x3c\x68\x74\x6d\x6c\x3e\x0a\x0a\x3c\x68\x65\x61\x64\x3e\x0a\x20\x20\x20\x20\x3c\x6d\x65\x74\x61\x20\x63\x68\x61\x72\x73\x65\x74\x3d\x22\x75\x74\x66\x2d\x38\x22\x3e\x0a\x20\x20\x20\x20\x3c\x6d\x65\x74\x61\x20\x6e\x61\x6d\x65\x3d\x22\x76\x69\x65\x77\x70\x6f\x72\x74\x22\x20\x63\x6f\x6e\x74\x65\x6e\x74\x3d\x22\x77\x69\x64\x74\x68\x3d\x64\x65\x76\x69\x63\x65\x2d\x77\x69\x64\x74\x68\x2c\x20\x69\x6e\x69\x74\x69\x61\x6c\x2d\x73\x63\x61\x6c\x65\x3d\x31\x22\x3e\x0a\x20\x20\x20\x20\x3c\x74\x69\x74\x6c\x65\x3e\x46\x61\x73\x74\x20\x50\x61\x73\x74\x65\x20\x42\x69\x6e\x3c\x2f\x74\x69\x74\x6c\x65\x3e\x0a\x20\x20\x20\x20\x3c\x6c\x69\x6e\x6b\x20\x72\x65\x6c\x3d\x22\x73\x74\x79\x6c\x65\x73\x68\x65\x65\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x73\x74\x61\x74\x69\x63\x2f\x63\x73\x73\x2f\x62\x75\x6c\x6d\x61\x2d\x30\x2e\x37\x2e\x30\x2e\x6d\x69\x6e\x2e\x63\x73\x73\x22\x3e\x0a\x20\x20\x20\x20\x3c\x6c\x69\x6e\x6b\x20\x72\x65\x6c\x3d\x22\x73\x74\x79\x6c\x65\x73\x68\x65\x65\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x73\x74\x61\x74\x69\x63\x2f\x63\x73\x73\x2f\x62\x75\x6c\x6d\x61\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x31\x2e\x30\x2e\x34\x2e\x6d\x69\x6e\x2e\x63\x73\x73\x22\x3e\x0a\x20\x20\x20\x20\x3c\x6c\x69\x6e\x6b\x20\x72\x65\x6c\x3d\x22\x73\x74\x79\x6c\x65\x73\x68\x65\x65\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x73\x74\x61\x74\x69\x63\x2f\x63\x73\x73\x2f\x73\x74\x79\x6c\x65\x2e\x63\x73\x73\x22\x3e\x0a\x3c\x2f\x68\x65\x61\x64\x3e\x0a\x0a\x3c\x62\x6f\x64\x79\x3e\x0a\x20\x20\x20\x20\x7b\x6e\x61\x76\x69\x67\x61\x74\x69\x6f\x6e\x7d\x20\x7b\x64\x6f\x63\x75\x6d\x65\x6e\x74\x42\x6f\x64\x79\x7d\x0a\x3c\x2f\x62\x6f\x64\x79\x3e\x0a\x3c\x66\x6f\x6f\x74\x65\x72\x20\x63\x6c\x61\x73\x73\x3d\x22\x66\x6f\x6f\x74\x65\x72\x22\x3e\x0a\x20\x20\x20\x20\x7b\x66\x6f\x6f\x74\x65\x72\x7d\x0a\x3c\x2f\x66\x6f\x6f\x74\x65\x72\x3e\x0a\x0a\x3c\x2f\x68\x74\x6d\x6c\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/main.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileMainHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 13:58:30.613412852 +0500 +05 m=+0.014560424" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 13:57:14.88231462 +0500 +05)
|
||||
// original path: assets/navigation.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileNavigationHTML is "/navigation.html"
|
||||
var FileNavigationHTML = []byte("\x3c\x6e\x61\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x20\x69\x73\x2d\x64\x61\x72\x6b\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x62\x72\x61\x6e\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x22\x3e\x46\x61\x73\x74\x20\x50\x61\x73\x74\x65\x20\x42\x69\x6e\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x69\x74\x65\x6d\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x70\x61\x73\x74\x65\x73\x2f\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x50\x61\x73\x74\x65\x73\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x69\x64\x3d\x22\x6e\x61\x76\x62\x61\x72\x49\x74\x65\x6d\x73\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x6d\x65\x6e\x75\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x73\x74\x61\x72\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x6e\x61\x76\x62\x61\x72\x2d\x65\x6e\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x6e\x61\x76\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/navigation.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileNavigationHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-01 00:41:18.339400139 +0500 +05 m=+0.041230393" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-01 00:32:51 +0500 +05)
|
||||
// original path: assets/pagination.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePaginationHTML is "/pagination.html"
|
||||
var FilePaginationHTML = []byte("\x3c\x73\x65\x63\x74\x69\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x73\x65\x63\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x6e\x61\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x20\x69\x73\x2d\x63\x65\x6e\x74\x65\x72\x65\x64\x22\x20\x72\x6f\x6c\x65\x3d\x22\x6e\x61\x76\x69\x67\x61\x74\x69\x6f\x6e\x22\x20\x61\x72\x69\x61\x2d\x6c\x61\x62\x65\x6c\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x70\x72\x65\x76\x69\x6f\x75\x73\x22\x20\x68\x72\x65\x66\x3d\x22\x7b\x70\x72\x65\x76\x69\x6f\x75\x73\x50\x61\x67\x65\x4c\x69\x6e\x6b\x7d\x22\x3e\x50\x72\x65\x76\x69\x6f\x75\x73\x20\x70\x61\x67\x65\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x75\x6c\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x6c\x69\x73\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x4c\x69\x6e\x6b\x73\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x75\x6c\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x6e\x65\x78\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x7b\x6e\x65\x78\x74\x50\x61\x67\x65\x4c\x69\x6e\x6b\x7d\x22\x3e\x4e\x65\x78\x74\x20\x70\x61\x67\x65\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x3c\x2f\x6e\x61\x76\x3e\x0a\x3c\x2f\x73\x65\x63\x74\x69\x6f\x6e\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/pagination.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePaginationHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-04-30 23:41:29.363654393 +0500 +05 m=+0.033742092" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-04-30 23:39:44.086392054 +0500 +05)
|
||||
// original path: assets/pagination_ellipsis.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePaginationEllipsisHTML is "/pagination_ellipsis.html"
|
||||
var FilePaginationEllipsisHTML = []byte("\x3c\x6c\x69\x3e\x0a\x20\x20\x20\x20\x3c\x73\x70\x61\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x65\x6c\x6c\x69\x70\x73\x69\x73\x22\x3e\x26\x68\x65\x6c\x6c\x69\x70\x3b\x3c\x2f\x73\x70\x61\x6e\x3e\x0a\x3c\x2f\x6c\x69\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/pagination_ellipsis.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePaginationEllipsisHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-01 00:26:24.973087795 +0500 +05 m=+0.032533011" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-04-30 23:54:11 +0500 +05)
|
||||
// original path: assets/pagination_link.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePaginationLinkHTML is "/pagination_link.html"
|
||||
var FilePaginationLinkHTML = []byte("\x3c\x6c\x69\x3e\x0a\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x6c\x69\x6e\x6b\x22\x20\x61\x72\x69\x61\x2d\x6c\x61\x62\x65\x6c\x3d\x22\x47\x6f\x20\x74\x6f\x20\x70\x61\x67\x65\x20\x7b\x70\x61\x67\x65\x4e\x75\x6d\x7d\x22\x20\x68\x72\x65\x66\x3d\x22\x7b\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x4c\x69\x6e\x6b\x7d\x22\x3e\x7b\x70\x61\x67\x65\x4e\x75\x6d\x7d\x3c\x2f\x61\x3e\x0a\x3c\x2f\x6c\x69\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/pagination_link.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePaginationLinkHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-01 00:26:24.971847954 +0500 +05 m=+0.031293214" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-04-30 23:54:14 +0500 +05)
|
||||
// original path: assets/pagination_link_current.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePaginationLinkCurrentHTML is "/pagination_link_current.html"
|
||||
var FilePaginationLinkCurrentHTML = []byte("\x3c\x6c\x69\x3e\x0a\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x6c\x69\x6e\x6b\x20\x69\x73\x2d\x63\x75\x72\x72\x65\x6e\x74\x22\x20\x61\x72\x69\x61\x2d\x6c\x61\x62\x65\x6c\x3d\x22\x50\x61\x67\x65\x20\x7b\x70\x61\x67\x65\x4e\x75\x6d\x7d\x22\x20\x61\x72\x69\x61\x2d\x63\x75\x72\x72\x65\x6e\x74\x3d\x22\x70\x61\x67\x65\x22\x3e\x7b\x70\x61\x67\x65\x4e\x75\x6d\x7d\x3c\x2f\x61\x3e\x0a\x3c\x2f\x6c\x69\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/pagination_link_current.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePaginationLinkCurrentHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 13:49:35.048457009 +0500 +05 m=+0.011636574" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 13:49:28.988992677 +0500 +05)
|
||||
// original path: assets/passworded_paste_verify.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePasswordedPasteVerifyHTML is "/passworded_paste_verify.html"
|
||||
var FilePasswordedPasteVerifyHTML = []byte("\x3c\x73\x65\x63\x74\x69\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x73\x65\x63\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x65\x6e\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6c\x75\x6d\x6e\x73\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6c\x75\x6d\x6e\x20\x69\x73\x2d\x34\x20\x69\x73\x2d\x6f\x66\x66\x73\x65\x74\x2d\x34\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x66\x6f\x72\x6d\x20\x61\x63\x74\x69\x6f\x6e\x3d\x22\x2f\x70\x61\x73\x74\x65\x2f\x7b\x70\x61\x73\x74\x65\x49\x44\x7d\x2f\x7b\x70\x61\x73\x74\x65\x54\x69\x6d\x65\x73\x74\x61\x6d\x70\x7d\x2f\x76\x65\x72\x69\x66\x79\x22\x20\x6d\x65\x74\x68\x6f\x64\x3d\x22\x50\x4f\x53\x54\x22\x20\x61\x75\x74\x6f\x63\x6f\x6d\x70\x6c\x65\x74\x65\x3d\x22\x6f\x66\x66\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x68\x65\x61\x64\x65\x72\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x68\x65\x61\x64\x65\x72\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x68\x65\x61\x64\x65\x72\x2d\x74\x69\x74\x6c\x65\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x54\x68\x69\x73\x20\x70\x61\x73\x74\x65\x20\x69\x73\x20\x70\x72\x6f\x74\x65\x63\x74\x65\x64\x20\x77\x69\x74\x68\x20\x70\x61\x73\x73\x77\x6f\x72\x64\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x70\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x68\x65\x61\x64\x65\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x63\x6f\x6e\x74\x65\x6e\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x65\x6e\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x66\x69\x65\x6c\x64\x20\x74\x6f\x6f\x6c\x74\x69\x70\x20\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x62\x6f\x74\x74\x6f\x6d\x20\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x6d\x75\x6c\x74\x69\x6c\x69\x6e\x65\x22\x20\x64\x61\x74\x61\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x3d\x22\x49\x66\x20\x79\x6f\x75\x27\x6c\x6c\x20\x65\x6e\x74\x65\x72\x20\x70\x61\x73\x73\x77\x6f\x72\x64\x20\x68\x65\x72\x65\x20\x2d\x20\x27\x50\x72\x69\x76\x61\x74\x65\x20\x70\x61\x73\x74\x65\x20\x77\x69\x74\x68\x20\x75\x6e\x69\x71\x75\x65\x20\x55\x52\x4c\x27\x20\x63\x68\x65\x63\x6b\x62\x6f\x78\x20\x77\x69\x6c\x6c\x20\x62\x65\x20\x61\x73\x73\x75\x6d\x65\x64\x20\x61\x73\x20\x63\x68\x65\x63\x6b\x65\x64\x2e\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x6c\x61\x62\x65\x6c\x20\x66\x6f\x72\x3d\x22\x70\x61\x73\x74\x65\x2d\x70\x61\x73\x73\x77\x6f\x72\x64\x22\x3e\x50\x61\x73\x73\x77\x6f\x72\x64\x20\x66\x6f\x72\x20\x70\x61\x73\x74\x65\x3a\x3c\x2f\x6c\x61\x62\x65\x6c\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x72\x6f\x6c\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x69\x6e\x70\x75\x74\x20\x63\x6c\x61\x73\x73\x3d\x22\x69\x6e\x70\x75\x74\x22\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x22\x20\x70\x6c\x61\x63\x65\x68\x6f\x6c\x64\x65\x72\x3d\x22\x45\x6e\x74\x65\x72\x20\x70\x61\x73\x73\x77\x6f\x72\x64\x2e\x22\x20\x6e\x61\x6d\x65\x3d\x22\x70\x61\x73\x74\x65\x2d\x70\x61\x73\x73\x77\x6f\x72\x64\x22\x20\x69\x64\x3d\x22\x70\x61\x73\x74\x65\x2d\x70\x61\x73\x73\x77\x6f\x72\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2Line truncated
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/passworded_paste_verify.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePasswordedPasteVerifyHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 13:24:21.508025661 +0500 +05 m=+0.014883772" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 13:24:18.605696269 +0500 +05)
|
||||
// original path: assets/paste.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePasteHTML is "/paste.html"
|
||||
var FilePasteHTML = []byte("\x3c\x73\x65\x63\x74\x69\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x73\x65\x63\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x65\x6e\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x61\x62\x6c\x65\x20\x63\x6c\x61\x73\x73\x3d\x22\x74\x61\x62\x6c\x65\x20\x69\x73\x2d\x62\x6f\x72\x64\x65\x72\x65\x64\x20\x69\x73\x2d\x73\x74\x72\x69\x70\x65\x64\x20\x69\x73\x2d\x6e\x61\x72\x72\x6f\x77\x20\x69\x73\x2d\x68\x6f\x76\x65\x72\x61\x62\x6c\x65\x20\x69\x73\x2d\x66\x75\x6c\x6c\x77\x69\x64\x74\x68\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x68\x65\x61\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x68\x3e\x23\x3c\x2f\x74\x68\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x68\x3e\x54\x69\x74\x6c\x65\x3c\x2f\x74\x68\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x68\x3e\x4c\x61\x6e\x67\x75\x61\x67\x65\x3c\x2f\x74\x68\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x68\x3e\x50\x61\x73\x74\x65\x64\x20\x6f\x6e\x3c\x2f\x74\x68\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x68\x3e\x57\x69\x6c\x6c\x20\x65\x78\x70\x69\x72\x65\x20\x6f\x6e\x3c\x2f\x74\x68\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x68\x3e\x50\x61\x73\x74\x65\x20\x74\x79\x70\x65\x3c\x2f\x74\x68\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x74\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x74\x68\x65\x61\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x62\x6f\x64\x79\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x64\x3e\x7b\x70\x61\x73\x74\x65\x49\x44\x7d\x3c\x2f\x74\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x64\x3e\x7b\x70\x61\x73\x74\x65\x54\x69\x74\x6c\x65\x7d\x3c\x2f\x74\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x64\x3e\x7b\x70\x61\x73\x74\x65\x4c\x61\x6e\x67\x75\x61\x67\x65\x7d\x3c\x2f\x74\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x64\x3e\x7b\x70\x61\x73\x74\x65\x44\x61\x74\x65\x7d\x3c\x2f\x74\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x64\x3e\x7b\x70\x61\x73\x74\x65\x45\x78\x70\x69\x72\x61\x74\x69\x6f\x6e\x7d\x3c\x2f\x74\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x64\x3e\x7b\x70\x61\x73\x74\x65\x54\x79\x70\x65\x7d\x3c\x2f\x74\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x74\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x64\x20\x63\x6f\x6c\x73\x70\x61\x6e\x3d\x22\x36\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x63\x6c\x61\x73\x73\x3d\x22\x62\x75\x74\x74\x6f\x6e\x22\x20\x68\x72\x65\x66\x3d\x22\x2f\x70\x61\x73\x74\x65\x2f\x7b\x70\x61\x73\x74\x65\x49\x44\x7d\x2f\x7b\x70\x61\x73\x74\x65\x54\x73\x7d\x72\x61\x77\x22\x3e\x56\x69\x65\x77\x20\x72\x61\x77\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x74\x64\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x74\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x74\x62\x6f\x64\x79\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x74\x61\x62\x6c\x65\x3e\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x73\x65\x63\x74\x69\x6f\x6e\x3e\x0a\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x70\x61\x73\x74\x65\x2d\x64\x61\x74\x61\x22\x3e\x0a\x20\x20\x20\x20\x7b\x70\x61\x73\x74\x65\x64\x61\x74\x61\x7d\x0a\x3c\x2f\x64\x69\x76\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/paste.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePasteHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-26 13:47:21.417964779 +0500 +05 m=+0.019030606" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-26 13:41:01.75233841 +0500 +05)
|
||||
// original path: assets/pastelist_list.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePastelistListHTML is "/pastelist_list.html"
|
||||
var FilePastelistListHTML = []byte("\x3c\x73\x65\x63\x74\x69\x6f\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x73\x65\x63\x74\x69\x6f\x6e\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x7d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x70\x61\x73\x74\x65\x73\x7d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7b\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x7d\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x73\x65\x63\x74\x69\x6f\x6e\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/pastelist_list.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePastelistListHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-01 18:35:23.706057355 +0500 +05 m=+0.051352478" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-01 18:35:21 +0500 +05)
|
||||
// original path: assets/pastelist_paste.html
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FilePastelistPasteHTML is "/pastelist_paste.html"
|
||||
var FilePastelistPasteHTML = []byte("\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x65\x6e\x74\x22\x3e\x0a\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x68\x65\x61\x64\x65\x72\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x68\x65\x61\x64\x65\x72\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x68\x65\x61\x64\x65\x72\x2d\x74\x69\x74\x6c\x65\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x50\x61\x73\x74\x65\x20\x23\x7b\x70\x61\x73\x74\x65\x49\x44\x7d\x2c\x20\x70\x6f\x73\x74\x65\x64\x20\x6f\x6e\x20\x7b\x70\x61\x73\x74\x65\x44\x61\x74\x65\x7d\x20\x61\x6e\x64\x20\x74\x69\x74\x6c\x65\x64\x20\x61\x73\x20\x22\x7b\x70\x61\x73\x74\x65\x54\x69\x74\x6c\x65\x7d\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x70\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x68\x65\x61\x64\x65\x72\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x63\x6f\x6e\x74\x65\x6e\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x64\x69\x76\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x6f\x6e\x74\x65\x6e\x74\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x72\x65\x3e\x7b\x70\x61\x73\x74\x65\x44\x61\x74\x61\x7d\x3c\x2f\x70\x72\x65\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x66\x6f\x6f\x74\x65\x72\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x66\x6f\x6f\x74\x65\x72\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x2f\x70\x61\x73\x74\x65\x2f\x7b\x70\x61\x73\x74\x65\x49\x44\x7d\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x63\x61\x72\x64\x2d\x66\x6f\x6f\x74\x65\x72\x2d\x69\x74\x65\x6d\x20\x62\x75\x74\x74\x6f\x6e\x20\x69\x73\x2d\x73\x75\x63\x63\x65\x73\x73\x20\x69\x73\x2d\x72\x61\x64\x69\x75\x73\x6c\x65\x73\x73\x22\x3e\x56\x69\x65\x77\x3c\x2f\x61\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x2f\x66\x6f\x6f\x74\x65\x72\x3e\x0a\x20\x20\x20\x20\x3c\x2f\x64\x69\x76\x3e\x0a\x3c\x2f\x64\x69\x76\x3e")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "/pastelist_paste.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FilePastelistPasteHTML)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-04-30 12:09:21.565973562 +0500 +05 m=+0.005172338" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-04-13 16:30:20 +0500 +05)
|
||||
// original path: assets/css/bulma-0.7.0.min.css
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileStaticCSSBulma070MinCSS is "static/css/bulma-0.7.0.min.css"
|
||||
var FileStaticCSSBulma070MinCSS = []byte("\x2f\x2a\x21\x20\x62\x75\x6c\x6d\x61\x2e\x69\x6f\x20\x76\x30\x2e\x37\x2e\x30\x20\x7c\x20\x4d\x49\x54\x20\x4c\x69\x63\x65\x6e\x73\x65\x20\x7c\x20\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x6a\x67\x74\x68\x6d\x73\x2f\x62\x75\x6c\x6d\x61\x20\x2a\x2f\x40\x2d\x77\x65\x62\x6b\x69\x74\x2d\x6b\x65\x79\x66\x72\x61\x6d\x65\x73\x20\x73\x70\x69\x6e\x41\x72\x6f\x75\x6e\x64\x7b\x66\x72\x6f\x6d\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x7d\x74\x6f\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x7d\x7d\x40\x6b\x65\x79\x66\x72\x61\x6d\x65\x73\x20\x73\x70\x69\x6e\x41\x72\x6f\x75\x6e\x64\x7b\x66\x72\x6f\x6d\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x7d\x74\x6f\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x7d\x7d\x2e\x62\x72\x65\x61\x64\x63\x72\x75\x6d\x62\x2c\x2e\x62\x75\x74\x74\x6f\x6e\x2c\x2e\x64\x65\x6c\x65\x74\x65\x2c\x2e\x66\x69\x6c\x65\x2c\x2e\x69\x73\x2d\x75\x6e\x73\x65\x6c\x65\x63\x74\x61\x62\x6c\x65\x2c\x2e\x6d\x6f\x64\x61\x6c\x2d\x63\x6c\x6f\x73\x65\x2c\x2e\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x65\x6c\x6c\x69\x70\x73\x69\x73\x2c\x2e\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x6c\x69\x6e\x6b\x2c\x2e\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x6e\x65\x78\x74\x2c\x2e\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2d\x70\x72\x65\x76\x69\x6f\x75\x73\x2c\x2e\x74\x61\x62\x73\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x6f\x75\x63\x68\x2d\x63\x61\x6c\x6c\x6f\x75\x74\x3a\x6e\x6f\x6e\x65\x3b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x75\x73\x65\x72\x2d\x73\x65\x6c\x65\x63\x74\x3a\x6e\x6f\x6e\x65\x3b\x2d\x6d\x6f\x7a\x2d\x75\x73\x65\x72\x2d\x73\x65\x6c\x65\x63\x74\x3a\x6e\x6f\x6e\x65\x3b\x2d\x6d\x73\x2d\x75\x73\x65\x72\x2d\x73\x65\x6c\x65\x63\x74\x3a\x6e\x6f\x6e\x65\x3b\x75\x73\x65\x72\x2d\x73\x65\x6c\x65\x63\x74\x3a\x6e\x6f\x6e\x65\x7d\x2e\x6e\x61\x76\x62\x61\x72\x2d\x6c\x69\x6e\x6b\x3a\x3a\x61\x66\x74\x65\x72\x2c\x2e\x73\x65\x6c\x65\x63\x74\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6d\x75\x6c\x74\x69\x70\x6c\x65\x29\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x7b\x62\x6f\x72\x64\x65\x72\x3a\x33\x70\x78\x20\x73\x6f\x6c\x69\x64\x20\x74\x72\x61\x6e\x73\x70\x61\x72\x65\x6e\x74\x3b\x62\x6f\x72\x64\x65\x72\x2d\x72\x61\x64\x69\x75\x73\x3a\x32\x70\x78\x3b\x62\x6f\x72\x64\x65\x72\x2d\x72\x69\x67\x68\x74\x3a\x30\x3b\x62\x6f\x72\x64\x65\x72\x2d\x74\x6f\x70\x3a\x30\x3b\x63\x6f\x6e\x74\x65\x6e\x74\x3a\x22\x20\x22\x3b\x64\x69\x73\x70\x6c\x61\x79\x3a\x62\x6c\x6f\x63\x6b\x3b\x68\x65\x69\x67\x68\x74\x3a\x2e\x36\x32\x35\x65\x6d\x3b\x6d\x61\x72\x67\x69\x6e\x2d\x74\x6f\x70\x3a\x2d\x2e\x34\x33\x37\x35\x65\x6d\x3b\x70\x6f\x69\x6e\x74\x65\x72\x2d\x65\x76\x65\x6e\x74\x73\x3a\x6e\x6f\x6e\x65\x3b\x70\x6f\x73\x69\x74\x69\x6f\x6e\x3a\x61\x62\x73\x6f\x6c\x75\x74\x65\x3b\x74\x6f\x70\x3a\x35\x30\x25\x3b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x2d\x34\x35\x64\x65\x67\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x2d\x34\x35\x64\x65\x67\x29\x3b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x2d\x6f\x72\x69\x67\x69\x6e\x3a\x63\x65\x6e\x74\x65\x72\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x2d\x6f\x72\x69\x67\x69\x6e\x3a\x63\x65\x6e\x74\x65\x72\x3b\x77\x69\x64\x74\x68\x3a\x2e\x36\x32\x35\x65\x6d\x7d\x2e\x62\x6c\x6f\x63\x6b\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x62\x6f\x78\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x62\x72\x65\x61\x64\x63\x72\x75\x6d\x62\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x63\x6f\x6e\x74\x65\x6e\x74\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x68\x69\x67\x68\x6c\x69\x67\x68\x74\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x6c\x65\x76\x65\x6c\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x6d\x65\x73\x73\x61\x67\x65\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x6e\x6f\x74\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x70\x72\x6f\x67\x72\x65\x73\x73\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\x69\x6c\x64\x29\x2c\x2e\x73\x75\x62\x74\x69\x74\x6c\x65\x3a\x6e\x6f\x74\x28\x3a\x6c\x61\x73\x74\x2d\x63\x68\Line truncated
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "static/css/bulma-0.7.0.min.css", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileStaticCSSBulma070MinCSS)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-01 22:23:47.987084213 +0500 +05 m=+0.026842954" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-01 22:20:22.447729513 +0500 +05)
|
||||
// original path: assets/css/bulma-tooltip-1.0.4.min.css
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileStaticCSSBulmaTooltip104MinCSS is "static/css/bulma-tooltip-1.0.4.min.css"
|
||||
var FileStaticCSSBulmaTooltip104MinCSS = []byte("\x40\x2d\x77\x65\x62\x6b\x69\x74\x2d\x6b\x65\x79\x66\x72\x61\x6d\x65\x73\x20\x73\x70\x69\x6e\x41\x72\x6f\x75\x6e\x64\x7b\x66\x72\x6f\x6d\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x7d\x74\x6f\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x7d\x7d\x40\x6b\x65\x79\x66\x72\x61\x6d\x65\x73\x20\x73\x70\x69\x6e\x41\x72\x6f\x75\x6e\x64\x7b\x66\x72\x6f\x6d\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x30\x29\x7d\x74\x6f\x7b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x72\x6f\x74\x61\x74\x65\x28\x33\x35\x39\x64\x65\x67\x29\x7d\x7d\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x7b\x70\x6f\x73\x69\x74\x69\x6f\x6e\x3a\x72\x65\x6c\x61\x74\x69\x76\x65\x7d\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x2e\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x61\x63\x74\x69\x76\x65\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x2c\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x3a\x68\x6f\x76\x65\x72\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x7b\x7a\x2d\x69\x6e\x64\x65\x78\x3a\x39\x39\x39\x39\x39\x3b\x70\x6f\x73\x69\x74\x69\x6f\x6e\x3a\x61\x62\x73\x6f\x6c\x75\x74\x65\x3b\x64\x69\x73\x70\x6c\x61\x79\x3a\x69\x6e\x6c\x69\x6e\x65\x2d\x62\x6c\x6f\x63\x6b\x3b\x70\x6f\x69\x6e\x74\x65\x72\x2d\x65\x76\x65\x6e\x74\x73\x3a\x6e\x6f\x6e\x65\x7d\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x2e\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x61\x63\x74\x69\x76\x65\x3a\x3a\x62\x65\x66\x6f\x72\x65\x2c\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x3a\x68\x6f\x76\x65\x72\x3a\x3a\x62\x65\x66\x6f\x72\x65\x7b\x7a\x2d\x69\x6e\x64\x65\x78\x3a\x39\x39\x39\x39\x39\x3b\x70\x6f\x73\x69\x74\x69\x6f\x6e\x3a\x61\x62\x73\x6f\x6c\x75\x74\x65\x3b\x64\x69\x73\x70\x6c\x61\x79\x3a\x69\x6e\x6c\x69\x6e\x65\x2d\x62\x6c\x6f\x63\x6b\x3b\x70\x6f\x69\x6e\x74\x65\x72\x2d\x65\x76\x65\x6e\x74\x73\x3a\x6e\x6f\x6e\x65\x7d\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x2e\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x61\x63\x74\x69\x76\x65\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x2c\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x3a\x68\x6f\x76\x65\x72\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x7b\x63\x6f\x6e\x74\x65\x6e\x74\x3a\x22\x22\x3b\x62\x6f\x72\x64\x65\x72\x2d\x73\x74\x79\x6c\x65\x3a\x73\x6f\x6c\x69\x64\x3b\x62\x6f\x72\x64\x65\x72\x2d\x77\x69\x64\x74\x68\x3a\x2e\x35\x72\x65\x6d\x7d\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x2e\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x61\x63\x74\x69\x76\x65\x3a\x3a\x62\x65\x66\x6f\x72\x65\x2c\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x3a\x68\x6f\x76\x65\x72\x3a\x3a\x62\x65\x66\x6f\x72\x65\x7b\x6f\x70\x61\x63\x69\x74\x79\x3a\x30\x3b\x63\x6f\x6e\x74\x65\x6e\x74\x3a\x61\x74\x74\x72\x28\x64\x61\x74\x61\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x29\x3b\x6f\x76\x65\x72\x66\x6c\x6f\x77\x3a\x68\x69\x64\x64\x65\x6e\x3b\x77\x68\x69\x74\x65\x2d\x73\x70\x61\x63\x65\x3a\x6e\x6f\x77\x72\x61\x70\x3b\x74\x65\x78\x74\x2d\x6f\x76\x65\x72\x66\x6c\x6f\x77\x3a\x65\x6c\x6c\x69\x70\x73\x69\x73\x3b\x66\x6f\x6e\x74\x2d\x73\x69\x7a\x65\x3a\x2e\x37\x35\x72\x65\x6d\x3b\x70\x61\x64\x64\x69\x6e\x67\x3a\x2e\x34\x72\x65\x6d\x20\x2e\x38\x72\x65\x6d\x3b\x2d\x77\x65\x62\x6b\x69\x74\x2d\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x74\x72\x61\x6e\x73\x6c\x61\x74\x65\x28\x2d\x35\x30\x25\x2c\x31\x72\x65\x6d\x29\x3b\x74\x72\x61\x6e\x73\x66\x6f\x72\x6d\x3a\x74\x72\x61\x6e\x73\x6c\x61\x74\x65\x28\x2d\x35\x30\x25\x2c\x31\x72\x65\x6d\x29\x3b\x62\x61\x63\x6b\x67\x72\x6f\x75\x6e\x64\x3a\x72\x67\x62\x61\x28\x37\x34\x2c\x37\x34\x2c\x37\x34\x2c\x2e\x39\x29\x3b\x62\x6f\x72\x64\x65\x72\x2d\x72\x61\x64\x69\x75\x73\x3a\x33\x70\x78\x3b\x63\x6f\x6c\x6f\x72\x3a\x23\x66\x66\x66\x3b\x6d\x61\x78\x2d\x77\x69\x64\x74\x68\x3a\x32\x34\x72\x65\x6d\x7d\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x2e\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x61\x63\x74\x69\x76\x65\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x2c\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x3a\x66\x6f\x63\x75\x73\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x2c\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x3a\x68\x6f\x76\x65\x72\x3a\x6e\x6f\x74\x28\x2e\x69\x73\x2d\x6c\x6f\x61\x64\x69\x6e\x67\x29\x3a\x3a\x61\x66\x74\x65\x72\x7b\x74\x6f\x70\x3a\x30\x3b\x62\x6f\x74\x74\x6f\x6d\x3a\x61\x75\x74\x6f\x3b\x6c\x65\x66\x74\x3a\x35\x30\x25\x3b\x6f\x70\x61\x63\x69\xLine truncated
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "static/css/bulma-tooltip-1.0.4.min.css", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileStaticCSSBulmaTooltip104MinCSS)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-04-30 12:09:21.567814626 +0500 +05 m=+0.007013386" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-04-13 16:30:20 +0500 +05)
|
||||
// original path: assets/css/bulma.css.map
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileStaticCSSBulmaCSSMap is "static/css/bulma.css.map"
|
||||
var FileStaticCSSBulmaCSSMap = []byte("\x7b\x22\x76\x65\x72\x73\x69\x6f\x6e\x22\x3a\x33\x2c\x22\x73\x6f\x75\x72\x63\x65\x73\x22\x3a\x5b\x22\x2e\x2e\x2f\x62\x75\x6c\x6d\x61\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x75\x74\x69\x6c\x69\x74\x69\x65\x73\x2f\x61\x6e\x69\x6d\x61\x74\x69\x6f\x6e\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x62\x75\x6c\x6d\x61\x2e\x63\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x75\x74\x69\x6c\x69\x74\x69\x65\x73\x2f\x6d\x69\x78\x69\x6e\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x75\x74\x69\x6c\x69\x74\x69\x65\x73\x2f\x69\x6e\x69\x74\x69\x61\x6c\x2d\x76\x61\x72\x69\x61\x62\x6c\x65\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x75\x74\x69\x6c\x69\x74\x69\x65\x73\x2f\x63\x6f\x6e\x74\x72\x6f\x6c\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x62\x61\x73\x65\x2f\x6d\x69\x6e\x69\x72\x65\x73\x65\x74\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x62\x61\x73\x65\x2f\x67\x65\x6e\x65\x72\x69\x63\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x62\x61\x73\x65\x2f\x68\x65\x6c\x70\x65\x72\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x62\x6f\x78\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x62\x75\x74\x74\x6f\x6e\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x75\x74\x69\x6c\x69\x74\x69\x65\x73\x2f\x66\x75\x6e\x63\x74\x69\x6f\x6e\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x63\x6f\x6e\x74\x61\x69\x6e\x65\x72\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x63\x6f\x6e\x74\x65\x6e\x74\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x66\x6f\x72\x6d\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x69\x63\x6f\x6e\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x69\x6d\x61\x67\x65\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x6e\x6f\x74\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x70\x72\x6f\x67\x72\x65\x73\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x74\x61\x62\x6c\x65\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x74\x61\x67\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x74\x69\x74\x6c\x65\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x65\x6c\x65\x6d\x65\x6e\x74\x73\x2f\x6f\x74\x68\x65\x72\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x62\x72\x65\x61\x64\x63\x72\x75\x6d\x62\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x63\x61\x72\x64\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x64\x72\x6f\x70\x64\x6f\x77\x6e\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x6c\x65\x76\x65\x6c\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x6d\x65\x64\x69\x61\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x6d\x65\x6e\x75\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x6d\x65\x73\x73\x61\x67\x65\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x6d\x6f\x64\x61\x6c\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x6e\x61\x76\x62\x61\x72\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x70\x61\x67\x69\x6e\x61\x74\x69\x6f\x6e\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x70\x61\x6e\x65\x6c\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x63\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x73\x2f\x74\x61\x62\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x67\x72\x69\x64\x2f\x63\x6f\x6c\x75\x6d\x6e\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x67\x72\x69\x64\x2f\x74\x69\x6c\x65\x73\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x6c\x61\x79\x6f\x75\x74\x2f\x68\x65\x72\x6f\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x6c\x61\x79\x6f\x75\x74\x2f\x73\x65\x63\x74\x69\x6f\x6e\x2e\x73\x61\x73\x73\x22\x2c\x22\x2e\x2e\x2f\x73\x61\x73\x73\x2f\x6c\x61\x79\x6fLine truncated
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "static/css/bulma.css.map", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileStaticCSSBulmaCSSMap)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-05-01 17:43:41.903107504 +0500 +05 m=+0.039828393" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-05-01 17:43:40.11480207 +0500 +05)
|
||||
// original path: assets/css/style.css
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileStaticCSSStyleCSS is "static/css/style.css"
|
||||
var FileStaticCSSStyleCSS = []byte("\x23\x70\x61\x73\x74\x65\x2d\x63\x6f\x6e\x74\x65\x6e\x74\x73\x20\x7b\x0a\x20\x20\x20\x20\x66\x6f\x6e\x74\x2d\x66\x61\x6d\x69\x6c\x79\x3a\x20\x6d\x6f\x6e\x6f\x73\x70\x61\x63\x65\x3b\x0a\x20\x20\x20\x20\x66\x6f\x6e\x74\x2d\x73\x69\x7a\x65\x3a\x20\x30\x2e\x39\x72\x65\x6d\x3b\x0a\x20\x20\x20\x20\x68\x65\x69\x67\x68\x74\x3a\x20\x39\x30\x76\x68\x3b\x0a\x7d\x0a\x0a\x2e\x70\x61\x73\x74\x65\x2d\x64\x61\x74\x61\x20\x7b\x0a\x20\x20\x20\x20\x66\x6f\x6e\x74\x2d\x73\x69\x7a\x65\x3a\x20\x30\x2e\x39\x72\x65\x6d\x3b\x0a\x7d")
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "static/css/style.css", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileStaticCSSStyleCSS)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Code generaTed by fileb0x at "2018-04-30 12:11:40.314331472 +0500 +05 m=+0.031685082" from config file "fileb0x.yml" DO NOT EDIT.
|
||||
// modified(2018-02-27 01:53:44 +0500 +05)
|
||||
// original path: assets/js/fontawesome-5.0.7.js
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
// FileStaticJsFontawesome507Js is "static/js/fontawesome-5.0.7.js"
|
||||
var FileStaticJsFontawesome507Js = []byte("\x2f\x2a\x21\x0a\x20\x2a\x20\x46\x6f\x6e\x74\x20\x41\x77\x65\x73\x6f\x6d\x65\x20\x46\x72\x65\x65\x20\x35\x2e\x30\x2e\x37\x20\x62\x79\x20\x40\x66\x6f\x6e\x74\x61\x77\x65\x73\x6f\x6d\x65\x20\x2d\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x66\x6f\x6e\x74\x61\x77\x65\x73\x6f\x6d\x65\x2e\x63\x6f\x6d\x0a\x20\x2a\x20\x4c\x69\x63\x65\x6e\x73\x65\x20\x2d\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x66\x6f\x6e\x74\x61\x77\x65\x73\x6f\x6d\x65\x2e\x63\x6f\x6d\x2f\x6c\x69\x63\x65\x6e\x73\x65\x20\x28\x49\x63\x6f\x6e\x73\x3a\x20\x43\x43\x20\x42\x59\x20\x34\x2e\x30\x2c\x20\x46\x6f\x6e\x74\x73\x3a\x20\x53\x49\x4c\x20\x4f\x46\x4c\x20\x31\x2e\x31\x2c\x20\x43\x6f\x64\x65\x3a\x20\x4d\x49\x54\x20\x4c\x69\x63\x65\x6e\x73\x65\x29\x0a\x20\x2a\x2f\x0a\x21\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x29\x7b\x22\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74\x22\x3b\x76\x61\x72\x20\x63\x3d\x7b\x7d\x3b\x74\x72\x79\x7b\x22\x75\x6e\x64\x65\x66\x69\x6e\x65\x64\x22\x21\x3d\x74\x79\x70\x65\x6f\x66\x20\x77\x69\x6e\x64\x6f\x77\x26\x26\x28\x63\x3d\x77\x69\x6e\x64\x6f\x77\x29\x7d\x63\x61\x74\x63\x68\x28\x63\x29\x7b\x7d\x76\x61\x72\x20\x6c\x3d\x28\x63\x2e\x6e\x61\x76\x69\x67\x61\x74\x6f\x72\x7c\x7c\x7b\x7d\x29\x2e\x75\x73\x65\x72\x41\x67\x65\x6e\x74\x2c\x68\x3d\x76\x6f\x69\x64\x20\x30\x3d\x3d\x3d\x6c\x3f\x22\x22\x3a\x6c\x2c\x76\x3d\x63\x2c\x7a\x3d\x28\x7e\x68\x2e\x69\x6e\x64\x65\x78\x4f\x66\x28\x22\x4d\x53\x49\x45\x22\x29\x7c\x7c\x68\x2e\x69\x6e\x64\x65\x78\x4f\x66\x28\x22\x54\x72\x69\x64\x65\x6e\x74\x2f\x22\x29\x2c\x22\x5f\x5f\x5f\x46\x4f\x4e\x54\x5f\x41\x57\x45\x53\x4f\x4d\x45\x5f\x5f\x5f\x22\x29\x2c\x65\x3d\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x29\x7b\x74\x72\x79\x7b\x72\x65\x74\x75\x72\x6e\x21\x30\x7d\x63\x61\x74\x63\x68\x28\x63\x29\x7b\x72\x65\x74\x75\x72\x6e\x21\x31\x7d\x7d\x28\x29\x2c\x61\x3d\x5b\x31\x2c\x32\x2c\x33\x2c\x34\x2c\x35\x2c\x36\x2c\x37\x2c\x38\x2c\x39\x2c\x31\x30\x5d\x2c\x6d\x3d\x61\x2e\x63\x6f\x6e\x63\x61\x74\x28\x5b\x31\x31\x2c\x31\x32\x2c\x31\x33\x2c\x31\x34\x2c\x31\x35\x2c\x31\x36\x2c\x31\x37\x2c\x31\x38\x2c\x31\x39\x2c\x32\x30\x5d\x29\x3b\x5b\x22\x78\x73\x22\x2c\x22\x73\x6d\x22\x2c\x22\x6c\x67\x22\x2c\x22\x66\x77\x22\x2c\x22\x75\x6c\x22\x2c\x22\x6c\x69\x22\x2c\x22\x62\x6f\x72\x64\x65\x72\x22\x2c\x22\x70\x75\x6c\x6c\x2d\x6c\x65\x66\x74\x22\x2c\x22\x70\x75\x6c\x6c\x2d\x72\x69\x67\x68\x74\x22\x2c\x22\x73\x70\x69\x6e\x22\x2c\x22\x70\x75\x6c\x73\x65\x22\x2c\x22\x72\x6f\x74\x61\x74\x65\x2d\x39\x30\x22\x2c\x22\x72\x6f\x74\x61\x74\x65\x2d\x31\x38\x30\x22\x2c\x22\x72\x6f\x74\x61\x74\x65\x2d\x32\x37\x30\x22\x2c\x22\x66\x6c\x69\x70\x2d\x68\x6f\x72\x69\x7a\x6f\x6e\x74\x61\x6c\x22\x2c\x22\x66\x6c\x69\x70\x2d\x76\x65\x72\x74\x69\x63\x61\x6c\x22\x2c\x22\x73\x74\x61\x63\x6b\x22\x2c\x22\x73\x74\x61\x63\x6b\x2d\x31\x78\x22\x2c\x22\x73\x74\x61\x63\x6b\x2d\x32\x78\x22\x2c\x22\x69\x6e\x76\x65\x72\x73\x65\x22\x2c\x22\x6c\x61\x79\x65\x72\x73\x22\x2c\x22\x6c\x61\x79\x65\x72\x73\x2d\x74\x65\x78\x74\x22\x2c\x22\x6c\x61\x79\x65\x72\x73\x2d\x63\x6f\x75\x6e\x74\x65\x72\x22\x5d\x2e\x63\x6f\x6e\x63\x61\x74\x28\x61\x2e\x6d\x61\x70\x28\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x63\x29\x7b\x72\x65\x74\x75\x72\x6e\x20\x63\x2b\x22\x78\x22\x7d\x29\x29\x2e\x63\x6f\x6e\x63\x61\x74\x28\x6d\x2e\x6d\x61\x70\x28\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x63\x29\x7b\x72\x65\x74\x75\x72\x6e\x22\x77\x2d\x22\x2b\x63\x7d\x29\x29\x3b\x76\x61\x72\x20\x74\x3d\x76\x7c\x7c\x7b\x7d\x3b\x74\x5b\x7a\x5d\x7c\x7c\x28\x74\x5b\x7a\x5d\x3d\x7b\x7d\x29\x2c\x74\x5b\x7a\x5d\x2e\x73\x74\x79\x6c\x65\x73\x7c\x7c\x28\x74\x5b\x7a\x5d\x2e\x73\x74\x79\x6c\x65\x73\x3d\x7b\x7d\x29\x2c\x74\x5b\x7a\x5d\x2e\x68\x6f\x6f\x6b\x73\x7c\x7c\x28\x74\x5b\x7a\x5d\x2e\x68\x6f\x6f\x6b\x73\x3d\x7b\x7d\x29\x2c\x74\x5b\x7a\x5d\x2e\x73\x68\x69\x6d\x73\x7c\x7c\x28\x74\x5b\x7a\x5d\x2e\x73\x68\x69\x6d\x73\x3d\x5b\x5d\x29\x3b\x76\x61\x72\x20\x73\x3d\x74\x5b\x7a\x5d\x2c\x72\x3d\x4f\x62\x6a\x65\x63\x74\x2e\x61\x73\x73\x69\x67\x6e\x7c\x7c\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x63\x29\x7b\x66\x6f\x72\x28\x76\x61\x72\x20\x6c\x3d\x31\x3b\x6c\x3c\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x2e\x6c\x65\x6e\x67\x74\x68\x3b\x6c\x2b\x2b\x29\x7b\x76\x61\x72\x20\x68\x3d\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x5b\x6c\x5d\x3b\x66\x6f\x72\x28\x76\x61\x72\x20\x76\x20\x69\x6e\x20\x68\x29\x4f\x62\x6a\x65\x63\x74\x2e\x70\x72\x6f\x74\x6f\x74\x79\x70\x65\x2e\x68\x61\x73\x4f\x77\x6e\x50\x72\x6f\x70\x65\x72\x74\x79\x2e\x63\x61\x6c\x6c\x28\x68\x2c\x76\x29\x26\x26\x28\x63\x5b\x76\x5d\x3d\x68\x5b\x76\x5d\x29\x7d\x72\x65\x74\x75\x72\x6e\x20\x63\x7d\x3b\x76\x61\x72\x20\x66\x3d\x7b\x22\x35\x30\x30\x70\x78\x22\x3a\x5b\x34\x34\x38\x2c\x35\x31\x32\x2c\x5b\x5d\x2c\x22\x66\x32\x36\x65\x22\x2c\x22\x4d\x31\x30\x33\x2e\x33\x20\x33\x34\x34\x2e\x33\x63\x2d\x36\x2e\x35\x2d\x31\x34\x2e\x32\x2d\x36\x2e\x39\x2d\x31\x38\x2e\x33\x20\x37\x2e\x34\x2d\x32\x33\x2e\x31\x20\x32\x35\x2e\x36\x2d\x38\x20\x38\x20\x39\x2e\x32\x20\x34\x33\x2e\x32\x20\x34\x39\x2e\x32\x68\x2e\x33\x76\x2d\x39\x33\x2e\x39\x63\x31\x2e\x32\x2d\x35\x30\x2e\x32\x20\x34\x34\x2d\x39\x32\x2e\x32\x20\x39\x37\x2eLine truncated
|
||||
|
||||
func init() {
|
||||
|
||||
|
||||
f, err := FS.OpenFile(CTX, "static/js/fontawesome-5.0.7.js", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
_, err = f.Write(FileStaticJsFontawesome507Js)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package assets
|
||||
|
||||
import "embed"
|
||||
|
||||
// Data is an embedded assets data.
|
||||
//go:embed *
|
||||
var Data embed.FS
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
/*! bulma.io v0.7.0 | MIT License | github.com/jgthms/bulma */@-webkit-keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.breadcrumb,.button,.delete,.file,.is-unselectable,.modal-close,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.tabs{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.navbar-link::after,.select:not(.is-multiple):not(.is-loading)::after{border:3px solid transparent;border-radius:2px;border-right:0;border-top:0;content:" ";display:block;height:.625em;margin-top:-.4375em;pointer-events:none;position:absolute;top:50%;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:center;transform-origin:center;width:.625em}.block:not(:last-child),.box:not(:last-child),.breadcrumb:not(:last-child),.content:not(:last-child),.highlight:not(:last-child),.level:not(:last-child),.message:not(:last-child),.notification:not(:last-child),.progress:not(:last-child),.subtitle:not(:last-child),.table-container:not(:last-child),.table:not(:last-child),.tabs:not(:last-child),.title:not(:last-child){margin-bottom:1.5rem}.delete,.modal-close{-moz-appearance:none;-webkit-appearance:none;background-color:rgba(10,10,10,.2);border:none;border-radius:290486px;cursor:pointer;display:inline-block;flex-grow:0;flex-shrink:0;font-size:0;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;outline:0;position:relative;vertical-align:top;width:20px}.delete::after,.delete::before,.modal-close::after,.modal-close::before{background-color:#fff;content:"";display:block;left:50%;position:absolute;top:50%;-webkit-transform:translateX(-50%) translateY(-50%) rotate(45deg);transform:translateX(-50%) translateY(-50%) rotate(45deg);-webkit-transform-origin:center center;transform-origin:center center}.delete::before,.modal-close::before{height:2px;width:50%}.delete::after,.modal-close::after{height:50%;width:2px}.delete:focus,.delete:hover,.modal-close:focus,.modal-close:hover{background-color:rgba(10,10,10,.3)}.delete:active,.modal-close:active{background-color:rgba(10,10,10,.4)}.is-small.delete,.is-small.modal-close{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.is-medium.delete,.is-medium.modal-close{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.is-large.delete,.is-large.modal-close{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.button.is-loading::after,.control.is-loading::after,.loader,.select.is-loading::after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em}.hero-video,.image.is-16by9 img,.image.is-1by1 img,.image.is-1by2 img,.image.is-1by3 img,.image.is-2by1 img,.image.is-2by3 img,.image.is-3by1 img,.image.is-3by2 img,.image.is-3by4 img,.image.is-3by5 img,.image.is-4by3 img,.image.is-4by5 img,.image.is-5by3 img,.image.is-5by4 img,.image.is-9by16 img,.image.is-square img,.is-overlay,.modal,.modal-background{bottom:0;left:0;position:absolute;right:0;top:0}.button,.file-cta,.file-name,.input,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.select select,.textarea{-moz-appearance:none;-webkit-appearance:none;align-items:center;border:1px solid transparent;border-radius:4px;box-shadow:none;display:inline-flex;font-size:1rem;height:2.25em;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.375em - 1px);padding-left:calc(.625em - 1px);padding-right:calc(.625em - 1px);padding-top:calc(.375em - 1px);position:relative;vertical-align:top}.button:active,.button:focus,.file-cta:active,.file-cta:focus,.file-name:active,.file-name:focus,.input:active,.input:focus,.is-active.button,.is-active.file-cta,.is-active.file-name,.is-active.input,.is-active.pagination-ellipsis,.is-active.pagination-link,.is-active.pagination-next,.is-active.pagination-previous,.is-active.textarea,.is-focused.button,.is-focused.file-cta,.is-focused.file-name,.is-focused.input,.is-focused.pagination-ellipsis,.is-focused.pagination-link,.is-focused.pagination-next,.is-focused.pagination-previous,.is-focused.textarea,.pagination-ellipsis:active,.pagination-ellipsis:focus,.pagination-link:active,.pagination-link:focus,.pagination-next:active,.pagination-next:focus,.pagination-previous:active,.pagination-previous:focus,.select select.is-active,.select select.is-focused,.select select:active,.select select:focus,.textarea:active,.textarea:focus{outline:0}.button[disabled],.file-cta[disabled],.file-name[disabled],.input[disabled],.pagination-ellipsis[disabledLine truncated
|
||||
-1
@@ -1 +0,0 @@
|
||||
@-webkit-keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.tooltip{position:relative}.tooltip.is-tooltip-active:not(.is-loading)::after,.tooltip:hover:not(.is-loading)::after{z-index:99999;position:absolute;display:inline-block;pointer-events:none}.tooltip.is-tooltip-active::before,.tooltip:hover::before{z-index:99999;position:absolute;display:inline-block;pointer-events:none}.tooltip.is-tooltip-active:not(.is-loading)::after,.tooltip:hover:not(.is-loading)::after{content:"";border-style:solid;border-width:.5rem}.tooltip.is-tooltip-active::before,.tooltip:hover::before{opacity:0;content:attr(data-tooltip);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:.75rem;padding:.4rem .8rem;-webkit-transform:translate(-50%,1rem);transform:translate(-50%,1rem);background:rgba(74,74,74,.9);border-radius:3px;color:#fff;max-width:24rem}.tooltip.is-tooltip-active:not(.is-loading)::after,.tooltip:focus:not(.is-loading)::after,.tooltip:hover:not(.is-loading)::after{top:0;bottom:auto;left:50%;opacity:1;margin-left:-.5rem;margin-top:-.5rem;border-color:rgba(74,74,74,.9) transparent transparent transparent}.tooltip.is-tooltip-active::before,.tooltip:focus::before,.tooltip:hover::before{top:auto;bottom:100%;left:50%;opacity:1;-webkit-transform:translate(-50%,-.5rem);transform:translate(-50%,-.5rem)}.tooltip.is-tooltip-right::before{top:auto;bottom:50%;left:100%;right:auto;-webkit-transform:translate(-1rem,50%);transform:translate(-1rem,50%)}.tooltip.is-tooltip-right.is-tooltip-active:not(.is-loading)::after,.tooltip.is-tooltip-right:focus:not(.is-loading)::after,.tooltip.is-tooltip-right:hover:not(.is-loading)::after{top:50%;left:100%;right:auto;border-color:transparent rgba(74,74,74,.9) transparent transparent}.tooltip.is-tooltip-right.is-tooltip-active::before,.tooltip.is-tooltip-right:focus::before,.tooltip.is-tooltip-right:hover::before{-webkit-transform:translate(.5rem,50%);transform:translate(.5rem,50%)}.tooltip.is-tooltip-bottom::before{top:100%;bottom:auto;left:50%;right:auto;-webkit-transform:translate(-50%,-1rem);transform:translate(-50%,-1rem)}.tooltip.is-tooltip-bottom.is-tooltip-active:not(.is-loading)::after,.tooltip.is-tooltip-bottom:focus:not(.is-loading)::after,.tooltip.is-tooltip-bottom:hover:not(.is-loading)::after{top:100%;bottom:auto;left:50%;right:auto;border-color:transparent transparent rgba(74,74,74,.9) transparent}.tooltip.is-tooltip-bottom.is-tooltip-active::before,.tooltip.is-tooltip-bottom:focus::before,.tooltip.is-tooltip-bottom:hover::before{-webkit-transform:translate(-50%,.5rem);transform:translate(-50%,.5rem)}.tooltip.is-tooltip-left::before{top:auto;bottom:50%;left:auto;right:100%;-webkit-transform:translate(1rem,50%);transform:translate(1rem,50%)}.tooltip.is-tooltip-left.is-tooltip-active:not(.is-loading)::after,.tooltip.is-tooltip-left:focus:not(.is-loading)::after,.tooltip.is-tooltip-left:hover:not(.is-loading)::after{top:50%;left:auto;right:calc(100% - .5rem);border-color:transparent transparent transparent rgba(74,74,74,.9)}.tooltip.is-tooltip-left.is-tooltip-active::before,.tooltip.is-tooltip-left:focus::before,.tooltip.is-tooltip-left:hover::before{-webkit-transform:translate(-.5rem,50%);transform:translate(-.5rem,50%)}.tooltip.is-tooltip-multiline::before{min-width:24rem;text-overflow:clip;white-space:normal;word-break:break-word}.tooltip.is-tooltip-white:not(.is-loading)::after{border-color:rgba(255,255,255,.9) transparent transparent transparent}.tooltip.is-tooltip-white.is-tooltip-right:not(.is-loading)::after{border-color:transparent rgba(255,255,255,.9) transparent transparent}.tooltip.is-tooltip-white.is-tooltip-bottom:not(.is-loading)::after{border-color:transparent transparent rgba(255,255,255,.9) transparent}.tooltip.is-tooltip-white.is-tooltip-left:not(.is-loading)::after{border-color:transparent transparent transparent rgba(255,255,255,.9)}.tooltip.is-tooltip-white::before{background:rgba(255,255,255,.9);color:#0a0a0a}.tooltip.is-tooltip-black:not(.is-loading)::after{border-color:rgba(10,10,10,.9) transparent transparent transparent}.tooltip.is-tooltip-black.is-tooltip-right:not(.is-loading)::after{border-color:transparent rgba(10,10,10,.9) transparent transparent}.tooltip.is-tooltip-black.is-tooltip-bottom:not(.is-loading)::after{border-color:transparent transparent rgba(10,10,10,.9) transparent}.tooltip.is-tooltip-black.is-tooltip-left:not(.is-loading)::after{border-color:transparent transparent transparent rgba(10,10,10,.9)}.tooltip.is-tooltip-black::before{background:rgba(10,10,10,.9);color:#fff}.tooltip.is-tooltip-light:not(.is-loading)::after{border-color:rgba(245,245,245,.9) transparent transparent transparent}.tooltip.is-tooltip-light.is-tooltip-right:not(.is-loading)::after{border-color:transparent rgba(245,245,245,.9) transparLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../bulma.sass","../sass/utilities/animations.sass","bulma.css","../sass/utilities/mixins.sass","../sass/utilities/initial-variables.sass","../sass/utilities/controls.sass","../sass/base/minireset.sass","../sass/base/generic.sass","../sass/base/helpers.sass","../sass/elements/box.sass","../sass/elements/button.sass","../sass/utilities/functions.sass","../sass/elements/container.sass","../sass/elements/content.sass","../sass/elements/form.sass","../sass/elements/icon.sass","../sass/elements/image.sass","../sass/elements/notification.sass","../sass/elements/progress.sass","../sass/elements/table.sass","../sass/elements/tag.sass","../sass/elements/title.sass","../sass/elements/other.sass","../sass/components/breadcrumb.sass","../sass/components/card.sass","../sass/components/dropdown.sass","../sass/components/level.sass","../sass/components/media.sass","../sass/components/menu.sass","../sass/components/message.sass","../sass/components/modal.sass","../sass/components/navbar.sass","../sass/components/pagination.sass","../sass/components/panel.sass","../sass/components/tabs.sass","../sass/grid/columns.sass","../sass/grid/tiles.sass","../sass/layout/hero.sass","../sass/layout/section.sass","../sass/layout/footer.sass"],"names":[],"mappings":"AACA,8DAA8D;ACD9D;EACE;IACE,gCAAuB;YAAvB,wBAAuB;GCExB;EDDD;IACE,kCAAyB;YAAzB,0BAAyB;GCG1B;CACF;ADRD;EACE;IACE,gCAAuB;YAAvB,wBAAuB;GCExB;EDDD;IACE,kCAAyB;YAAzB,0BAAyB;GCG1B;CACF;;AC4HD;;;;EACE,4BAA2B;EAC3B,0BAAyB;EACzB,uBAAsB;EACtB,sBAAqB;EACrB,kBAAiB;CAAG;;AAKtB;EACE,8BAA6B;EAC7B,mBAAkB;EAClB,gBAAe;EACf,cAAa;EACb,aAAY;EACZ,eAAc;EACd,gBAAe;EACf,sBAAqB;EACrB,qBAAoB;EACpB,mBAAkB;EAClB,SAAQ;EACR,kCAAyB;UAAzB,0BAAyB;EACzB,iCAAwB;UAAxB,yBAAwB;EACxB,eAAc;CAAG;;AAOjB;;EACE,sBAAqB;CAAG;;AAK5B;EAEE,sBAAqB;EACrB,yBAAwB;EACxB,wCC3K2B;ED4K3B,aAAY;EACZ,wBC7GuB;ED8GvB,gBAAe;EACf,sBAAqB;EACrB,aAAY;EACZ,eAAc;EACd,aAAY;EACZ,aAAY;EACZ,iBAAgB;EAChB,gBAAe;EACf,iBAAgB;EAChB,gBAAe;EACf,cAAa;EACb,mBAAkB;EAClB,oBAAmB;EACnB,YAAW;CA2CO;;AA1ClB;EAEE,wBClL2B;EDmL3B,YAAW;EACX,eAAc;EACd,UAAS;EACT,mBAAkB;EAClB,SAAQ;EACR,mEAA0D;UAA1D,2DAA0D;EAC1D,wCAA+B;UAA/B,gCAA+B;CAAG;;AACpC;EACE,YAAW;EACX,WAAU;CAAG;;AACf;EACE,YAAW;EACX,WAAU;CAAG;;AACf;EAEE,wCC9MyB;CD8Ma;;AACxC;EACE,wCChNyB;CDgNa;;AAExC;EACE,aAAY;EACZ,iBAAgB;EAChB,gBAAe;EACf,iBAAgB;EAChB,gBAAe;EACf,YAAW;CAAG;;AAChB;EACE,aAAY;EACZ,iBAAgB;EAChB,gBAAe;EACf,iBAAgB;EAChB,gBAAe;EACf,YAAW;CAAG;;AAChB;EACE,aAAY;EACZ,iBAAgB;EAChB,gBAAe;EACf,iBAAgB;EAChB,gBAAe;EACf,YAAW;CAAG;;AAKlB;EACE,oDAA2C;UAA3C,4CAA2C;EAC3C,0BCrO4B;EDsO5B,wBC9KuB;ED+KvB,gCAA+B;EAC/B,8BAA6B;EAC7B,YAAW;EACX,eAAc;EACd,YAAW;EACX,mBAAkB;EAClB,WAAU;CAAG;;AAKf;EACE,UAAS;EACT,QAAO;EACP,mBAAkB;EAClB,SAAQ;EACR,OAAM;CAAG;;AEzPX;;;;;;EACE,sBAAqB;EACrB,yBAAwB;EACxB,oBAAmB;EACnB,8BAA+C;EAC/C,mBDmDU;EClDV,iBAAgB;EAChB,qBAAoB;EACpB,gBDoBW;ECnBX,eAAc;EACd,4BAA2B;EAC3B,iBAAgB;EAChB,oCAfiE;EAgBjE,kCAfmE;EAgBnE,mCAhBmE;EAiBnE,iCAlBiE;EAmBjE,mBAAkB;EAClB,oBAAmB;CAQO;;AAN1B;;;;;;;;;;;;;;;;;;;;;EAIE,cAAa;CAAG;;AAClB;;;;;;EACE,oBAAmB;CAAG;;ACjC1B,2EAA2E;AAE3E;;;;;;;;;;;;;;;;;;;;;;;EAuBE,UAAS;EACT,WAAU;CAAG;;AAGf;;;;;;EAME,gBAAe;EACf,oBAAmB;CAAG;;AAGxB;EACE,iBAAgB;CAAG;;AAGrB;;;;EAIE,UAAS;CAAG;;AAGd;EACE,uBAAsB;CAAG;;AAE3B;EAII,oBAAmB;CAAG;;AAG1B;;;EAGE,aAAY;EACZ,gBAAe;CAAG;;AAGpB;EACE,UAAS;CAAG;;AAGd;EACE,0BAAyB;EACzB,kBAAiB;CAAG;;AAEtB;;EAEE,WAAU;EACV,iBAAgB;CAAG;;AA5BrB;EC7BE,wBHP6B;EGQ7B,gBArBc;EAsBd,mCAAkC;EAClC,oCAAmC;EACnC,iBAAgB;EAChB,mBAAkB;EAClB,mBAAkB;EAClB,mCA1BiC;EA2BjC,+BAAsB;KAAtB,4BAAsB;MAAtB,2BAAsB;UAAtB,uBAAsB;CAAG;;AAE3B;;;;;;;EAOE,eAAc;CAAG;;AAEnB;;;;;EAKE,qLHlByL;CGkB7J;;AAE9B;;EAEE,8BAA6B;EAC7B,6BAA4B;EAC5B,uBHvB0B;CGuBE;;AAE9B;EACE,eH/C4B;EGgD5B,gBAAe;EACf,iBHhBiB;EGiBjB,iBAnDoB;CAmDa;;AAInC;EACE,eHzCgC;EG0ChC,gBAAe;EACf,sBAAqB;CAII;;AAP3B;EAKI,oBAAmB;CAAG;;AAL1B;EAOI,eH9D0B;CG8DL;;AAEzB;EACE,6BH3D4B;EG4D5B,eHjDgC;EGkDhC,mBA9DiB;EA+DjB,oBAhEkB;EAiElB,6BAlEgC;CAkEP;;AAE3B;EACE,6BHlE4B;EGmE5B,aAAY;EACZ,eAAc;EACd,YAnEa;EAoEb,iBAnEkB;CAmEG;;AAEvB;EACE,aAAY;EACZ,gBAAe;CAAG;;AAEpB;;EAEE,yBAAwB;CAAG;;AAE7B;EACE,mBAAkB;CAAG;;AAEvB;EACE,oBAAmB;EACnB,qBAAoB;CAAG;;AAEzB;EACE,eH9F4B;EG+F5B,iBH1De;CG0De;;AAIhC;EJ3CE,kCAAiC;EI6CjC,6BH/F4B;EGgG5B,eHrG4B;EGsG5B,mBAAkB;EAClB,iBAAgB;EAChB,wBAAuB;EACvB,iBAAgB;EAChB,kBAAiB;CAKA;;AAbnB;EAUI,8BAA6B;EAC7B,oBAAmB;EACnB,eAAc;EACd,WAAU;CAAG;;AAEjB;;EAGI,iBAAgB;EAChB,oBAAmB;CAAG;;AAJ1B;EAMI,eHxH0B;CGwHJ;;AJ3HxB;EACE,YAAW;EACX,aAAY;EACZ,eAAc;CAAG;;AKDrB;EACE,uBAAsB;CAAG;;AAE3B;EACE,wBAAuB;CAAG;;AAI5B;EACE,4BAA2B;CAAG;;AAY5B;EACE,2BAA2B;CAAG;;AADhC;EACE,6BAA2B;CAAG;;AADhC;EACE,2BAA2B;CAAG;;AADhC;EACE,6BAA2B;CAAG;;AADhC;EACE,8BAA2B;CAAG;;AADhC;EACE,2BAA2B;CAAG;;AADhC;EACE,8BAA2B;CAAG;;ALsDlC;EKvDE;IACE,2BAA2B;GAAG;EADhC;IACE,6BAA2B;GAAG;EADhC;IACE,2BAA2B;GAAG;EADhC;IACE,6BAA2B;GAAG;EADhC;IACE,8BAA2B;GAAG;EADhC;IACE,2BAA2B;GAAG;EADhC;IACE,8BAA2B;GAAG;CN8bnC;;ACpYC;EK3DE;IACE,2BAA2B;GAAG;EADhC;IACE,6BAA2B;GAAG;EADhC;IACE,2BAA2B;GAAG;EADhC;IACE,6BAA2B;GAAG;EADhC;IACE,8BAA2B;GAAG;EADhC;IACE,2BAA2B;GAAG;EADhC;IACE,8BAA2B;GAAG;CNsdnC;;ACpZC;EKnEE;IACE,2BAALine truncated
|
||||
@@ -1,9 +0,0 @@
|
||||
#paste-contents {
|
||||
font-family: monospace;
|
||||
font-size: 0.9rem;
|
||||
height: 90vh;
|
||||
}
|
||||
|
||||
.paste-data {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<section class="section">
|
||||
<div class="notification is-danger">
|
||||
<h3><strong>Database not available</strong></h3>
|
||||
<p>Something went wrong while trying to connect to database. Check logs for details.</p>
|
||||
</div>
|
||||
</section>
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<strong>{version}</strong> by
|
||||
<a href="https://pztrn.name">Stanislav N. aka pztrn</a>. The source code is licensed
|
||||
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. Get
|
||||
<a href="https://github.com/pztrn/fastpastebin">source or binary releases here</a>!
|
||||
<a href="https://gitlab.pztrn.name/fastpastebin/fastpastebin">source or binary releases here</a>!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
+1
-2
@@ -44,8 +44,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div>OR</div>
|
||||
<div class="field tooltip is-tooltip-bottom is-tooltip-multiline" data-tooltip="If you'll enter password here - 'Private
|
||||
paste with unique URL' checkbox will be assumed as checked.">
|
||||
<div class="field tooltip is-tooltip-bottom is-tooltip-multiline" data-tooltip="If you'll enter password here - 'Private paste with unique URL' checkbox will be assumed as checked.">
|
||||
<label for="paste-password">Password for paste:</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" placeholder="Enter password." name="paste-password" id="paste-password">
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/*!
|
||||
* Font Awesome Free 5.0.7 by @fontawesome - https://fontawesome.com
|
||||
* License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
*/
|
||||
!function(){"use strict";var c={};try{"undefined"!=typeof window&&(c=window)}catch(c){}var l=(c.navigator||{}).userAgent,h=void 0===l?"":l,v=c,z=(~h.indexOf("MSIE")||h.indexOf("Trident/"),"___FONT_AWESOME___"),e=function(){try{return!0}catch(c){return!1}}(),a=[1,2,3,4,5,6,7,8,9,10],m=a.concat([11,12,13,14,15,16,17,18,19,20]);["xs","sm","lg","fw","ul","li","border","pull-left","pull-right","spin","pulse","rotate-90","rotate-180","rotate-270","flip-horizontal","flip-vertical","stack","stack-1x","stack-2x","inverse","layers","layers-text","layers-counter"].concat(a.map(function(c){return c+"x"})).concat(m.map(function(c){return"w-"+c}));var t=v||{};t[z]||(t[z]={}),t[z].styles||(t[z].styles={}),t[z].hooks||(t[z].hooks={}),t[z].shims||(t[z].shims=[]);var s=t[z],r=Object.assign||function(c){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var v in h)Object.prototype.hasOwnProperty.call(h,v)&&(c[v]=h[v])}return c};var f={"500px":[448,512,[],"f26e","M103.3 344.3c-6.5-14.2-6.9-18.3 7.4-23.1 25.6-8 8 9.2 43.2 49.2h.3v-93.9c1.2-50.2 44-92.2 97.7-92.2 53.9 0 97.7 43.5 97.7 96.8 0 63.4-60.8 113.2-128.5 93.3-10.5-4.2-2.1-31.7 8.5-28.6 53 0 89.4-10.1 89.4-64.4 0-61-77.1-89.6-116.9-44.6-23.5 26.4-17.6 42.1-17.6 157.6 50.7 31 118.3 22 160.4-20.1 24.8-24.8 38.5-58 38.5-93 0-35.2-13.8-68.2-38.8-93.3-24.8-24.8-57.8-38.5-93.3-38.5s-68.8 13.8-93.5 38.5c-.3.3-16 16.5-21.2 23.9l-.5.6c-3.3 4.7-6.3 9.1-20.1 6.1-6.9-1.7-14.3-5.8-14.3-11.8V20c0-5 3.9-10.5 10.5-10.5h241.3c8.3 0 8.3 11.6 8.3 15.1 0 3.9 0 15.1-8.3 15.1H130.3v132.9h.3c104.2-109.8 282.8-36 282.8 108.9 0 178.1-244.8 220.3-310.1 62.8zm63.3-260.8c-.5 4.2 4.6 24.5 14.6 20.6C306 56.6 384 144.5 390.6 144.5c4.8 0 22.8-15.3 14.3-22.8-93.2-89-234.5-57-238.3-38.2zM393 414.7C283 524.6 94 475.5 61 310.5c0-12.2-30.4-7.4-28.9 3.3 24 173.4 246 256.9 381.6 121.3 6.9-7.8-12.6-28.4-20.7-20.4zM213.6 306.6c0 4 4.3 7.3 5.5 8.5 3 3 6.1 4.4 8.5 4.4 3.8 0 2.6.2 22.3-19.5 19.6 19.3 19.1 19.5 22.3 19.5 5.4 0 18.5-10.4 10.7-18.2L265.6 284l18.2-18.2c6.3-6.8-10.1-21.8-16.2-15.7L249.7 268c-18.6-18.8-18.4-19.5-21.5-19.5-5 0-18 11.7-12.4 17.3L234 284c-18.1 17.9-20.4 19.2-20.4 22.6z"],"accessible-icon":[448,512,[],"f368","M423.9 255.8L411 413.1c-3.3 40.7-63.9 35.1-60.6-4.9l10-122.5-41.1 2.3c10.1 20.7 15.8 43.9 15.8 68.5 0 41.2-16.1 78.7-42.3 106.5l-39.3-39.3c57.9-63.7 13.1-167.2-74-167.2-25.9 0-49.5 9.9-67.2 26L73 243.2c22-20.7 50.1-35.1 81.4-40.2l75.3-85.7-42.6-24.8-51.6 46c-30 26.8-70.6-18.5-40.5-45.4l68-60.7c9.8-8.8 24.1-10.2 35.5-3.6 0 0 139.3 80.9 139.5 81.1 16.2 10.1 20.7 36 6.1 52.6L285.7 229l106.1-5.9c18.5-1.1 33.6 14.4 32.1 32.7zm-64.9-154c28.1 0 50.9-22.8 50.9-50.9C409.9 22.8 387.1 0 359 0c-28.1 0-50.9 22.8-50.9 50.9 0 28.1 22.8 50.9 50.9 50.9zM179.6 456.5c-80.6 0-127.4-90.6-82.7-156.1l-39.7-39.7C36.4 287 24 320.3 24 356.4c0 130.7 150.7 201.4 251.4 122.5l-39.7-39.7c-16 10.9-35.3 17.3-56.1 17.3z"],accusoft:[640,512,[],"f369","M482.2 372.1C476.5 365.2 250 75 242.3 65.5c-13.7-17.2 0-16.8 19.2-16.9 9.7-.1 106.3-.6 116.5-.6 24.1-.1 28.7.6 38.4 12.8 2.1 2.7 205.1 245.8 207.2 248.3 5.5 6.7 15.2 19.1 7.2 23.4-2.4 1.3-114.6 47.7-117.8 48.9-10.1 4-17.5 6.8-30.8-9.3m114.7-5.6s-115 50.4-117.5 51.6c-16 7.3-26.9-3.2-36.7-14.6l-57.1-74c-5.4-.9-60.4-9.6-65.3-9.3-3.1.2-9.6.8-14.4 2.9-4.9 2.1-145.2 52.8-150.2 54.7-5.1 2-11.4 3.6-11.1 7.6.2 2.5 2 2.6 4.6 3.5 2.7.8 300.9 67.6 308 69.1 15.6 3.3 38.5 10.5 53.6 1.7 2.1-1.2 123.8-76.4 125.8-77.8 5.4-4 4.3-6.8-1.7-8.2-2.3-.3-24.6-4.7-38-7.2m-326-181.3s-12 1.6-25 15.1c-9 9.3-242.1 239.1-243.4 240.9-7 10 1.6 6.8 15.7 1.7.8 0 114.5-36.6 114.5-36.6.5-.6-.1-.1.6-.6-.4-5.1-.8-26.2-1-27.7-.6-5.2 2.2-6.9 7-8.9l92.6-33.8c.6-.8 88.5-81.7 90.2-83.3v-1l-51.2-65.8"],adn:[496,512,[],"f170","M248 167.5l64.9 98.8H183.1l64.9-98.8zM496 256c0 136.9-111.1 248-248 248S0 392.9 0 256 111.1 8 248 8s248 111.1 248 248zm-99.8 82.7L248 115.5 99.8 338.7h30.4l33.6-51.7h168.6l33.6 51.7h30.2z"],adversal:[512,512,[],"f36a","M482.1 32H28.7C5.8 32 0 37.9 0 60.9v390.2C0 474.4 5.8 480 28.7 480h453.4c24.4 0 29.9-5.2 29.9-29.7V62.2c0-24.6-5.4-30.2-29.9-30.2zM178.4 220.3c-27.5-20.2-72.1-8.7-84.2 23.4-4.3 11.1-9.3 9.5-17.5 8.3-9.7-1.5-17.2-3.2-22.5-5.5-28.8-11.4 8.6-55.3 24.9-64.3 41.1-21.4 83.4-22.2 125.3-4.8 40.9 16.8 34.5 59.2 34.5 128.5 2.7 25.8-4.3 58.3 9.3 88.8 1.9 4.4.4 7.9-2.7 10.7-8.4 6.7-39.3 2.2-46.6-7.4-1.9-2.2-1.8-3.6-3.9-6.2-3.6-3.9-7.3-2.2-11.9 1-57.4 36.4-140.3 21.4-147-43.3-3.1-29.3 12.4-57.1 39.6-71 38.2-19.5 112.2-11.8 114-30.9 1.1-10.2-1.9-20.1-11.3-27.3zm286.7 222c0 15.1-11.1 9.9-17.8 9.9H52.4c-7.4 0-18.2 4.8-17.8-10.7.4-13.9 10.5-9.1 17.1-9.1 132.3-.4 264.5-.4 396.8 0 6.8 0 16.6-4.4 16.6 9.9zm3.8-340.5v291c0 5.7-.7 13.9-8.1 13.9-12.4-.4-27.5 7.1-36.1-5.6-5.8-8.7-7.8-4-12.4-1.2-53.4 29.7-128.1 7.1-144.4-85.2-6.1-33.4-.7-67.1 15.7-100 11.8-23.9 56.9-76.1 136.1-30.5v-71c0-26.2-.1-26.2 26-26.2 3.1 0 6.6.4 9.7 0 10.1-.8 13.6 4.4 13.6 14.3-.1.2-.1.3-.1.5zm-51.5 232.3c-19.5 47.6-72.9 43.3-90 5.2-15.1-33.3-15.5-68.2.4-101.5 16.3-34.1 59.7-35.7 81.5-4.8 20.6 28.8 14.9 84.6 8.1 101.1zm-2Line truncated
|
||||
+2
-2
@@ -5,8 +5,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Fast Paste Bin</title>
|
||||
<link rel="stylesheet" href="/static/css/bulma-0.7.0.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bulma-tooltip-1.0.4.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bulma-0.7.5.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bulma-tooltip-3.0.0.min.css">
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
</head>
|
||||
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
/*! bulma.io v0.7.5 | MIT License | github.com/jgthms/bulma */@-webkit-keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.breadcrumb,.button,.delete,.file,.is-unselectable,.modal-close,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.tabs{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.navbar-link:not(.is-arrowless)::after,.select:not(.is-multiple):not(.is-loading)::after{border:3px solid transparent;border-radius:2px;border-right:0;border-top:0;content:" ";display:block;height:.625em;margin-top:-.4375em;pointer-events:none;position:absolute;top:50%;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:center;transform-origin:center;width:.625em}.block:not(:last-child),.box:not(:last-child),.breadcrumb:not(:last-child),.content:not(:last-child),.highlight:not(:last-child),.level:not(:last-child),.list:not(:last-child),.message:not(:last-child),.notification:not(:last-child),.progress:not(:last-child),.subtitle:not(:last-child),.table-container:not(:last-child),.table:not(:last-child),.tabs:not(:last-child),.title:not(:last-child){margin-bottom:1.5rem}.delete,.modal-close{-moz-appearance:none;-webkit-appearance:none;background-color:rgba(10,10,10,.2);border:none;border-radius:290486px;cursor:pointer;pointer-events:auto;display:inline-block;flex-grow:0;flex-shrink:0;font-size:0;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;outline:0;position:relative;vertical-align:top;width:20px}.delete::after,.delete::before,.modal-close::after,.modal-close::before{background-color:#fff;content:"";display:block;left:50%;position:absolute;top:50%;-webkit-transform:translateX(-50%) translateY(-50%) rotate(45deg);transform:translateX(-50%) translateY(-50%) rotate(45deg);-webkit-transform-origin:center center;transform-origin:center center}.delete::before,.modal-close::before{height:2px;width:50%}.delete::after,.modal-close::after{height:50%;width:2px}.delete:focus,.delete:hover,.modal-close:focus,.modal-close:hover{background-color:rgba(10,10,10,.3)}.delete:active,.modal-close:active{background-color:rgba(10,10,10,.4)}.is-small.delete,.is-small.modal-close{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.is-medium.delete,.is-medium.modal-close{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.is-large.delete,.is-large.modal-close{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.button.is-loading::after,.control.is-loading::after,.loader,.select.is-loading::after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em}.hero-video,.image.is-16by9 .has-ratio,.image.is-16by9 img,.image.is-1by1 .has-ratio,.image.is-1by1 img,.image.is-1by2 .has-ratio,.image.is-1by2 img,.image.is-1by3 .has-ratio,.image.is-1by3 img,.image.is-2by1 .has-ratio,.image.is-2by1 img,.image.is-2by3 .has-ratio,.image.is-2by3 img,.image.is-3by1 .has-ratio,.image.is-3by1 img,.image.is-3by2 .has-ratio,.image.is-3by2 img,.image.is-3by4 .has-ratio,.image.is-3by4 img,.image.is-3by5 .has-ratio,.image.is-3by5 img,.image.is-4by3 .has-ratio,.image.is-4by3 img,.image.is-4by5 .has-ratio,.image.is-4by5 img,.image.is-5by3 .has-ratio,.image.is-5by3 img,.image.is-5by4 .has-ratio,.image.is-5by4 img,.image.is-9by16 .has-ratio,.image.is-9by16 img,.image.is-square .has-ratio,.image.is-square img,.is-overlay,.modal,.modal-background{bottom:0;left:0;position:absolute;right:0;top:0}.button,.file-cta,.file-name,.input,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.select select,.textarea{-moz-appearance:none;-webkit-appearance:none;align-items:center;border:1px solid transparent;border-radius:4px;box-shadow:none;display:inline-flex;font-size:1rem;height:2.25em;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.375em - 1px);padding-left:calc(.625em - 1px);padding-right:calc(.625em - 1px);padding-top:calc(.375em - 1px);position:relative;vertical-align:top}.button:active,.button:focus,.file-cta:active,.file-cta:focus,.file-name:active,.file-name:focus,.input:active,.input:focus,.is-active.button,.is-active.file-cta,.is-active.file-name,.is-active.input,.is-active.pagination-ellipsis,.is-active.pagination-link,.is-active.pagination-next,.is-active.pagination-previous,.is-active.textarea,.is-focused.button,.is-focused.file-cta,.is-focused.file-name,.is-focused.input,.is-focused.pagination-ellipsis,.is-focused.pagination-link,.is-focused.pagination-next,.is-focused.paginLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
@-webkit-keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinAround{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}[data-tooltip]:not(.is-disabled),[data-tooltip]:not(.is-loading),[data-tooltip]:not([disabled]){cursor:pointer;overflow:visible;position:relative}[data-tooltip]:not(.is-disabled)::after,[data-tooltip]:not(.is-disabled)::before,[data-tooltip]:not(.is-loading)::after,[data-tooltip]:not(.is-loading)::before,[data-tooltip]:not([disabled])::after,[data-tooltip]:not([disabled])::before{box-sizing:border-box;color:#fff;display:inline-block;font-family:BlinkMacSystemFont,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.75rem;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;opacity:0;overflow:hidden;pointer-events:none;position:absolute;visibility:hidden;z-index:1020}[data-tooltip]:not(.is-disabled)::after,[data-tooltip]:not(.is-loading)::after,[data-tooltip]:not([disabled])::after{content:'';border-style:solid;border-width:6px;border-color:rgba(74,74,74,.9) transparent transparent transparent;margin-bottom:-5px}[data-tooltip]:not(.is-disabled)::after,[data-tooltip]:not(.is-loading)::after,[data-tooltip]:not([disabled])::after{top:0;right:auto;bottom:auto;left:50%;margin-top:-5px;margin-right:auto;margin-bottom:auto;margin-left:-5px;border-color:rgba(74,74,74,.9) transparent transparent transparent}[data-tooltip]:not(.is-disabled)::before,[data-tooltip]:not(.is-loading)::before,[data-tooltip]:not([disabled])::before{background:rgba(74,74,74,.9);border-radius:2px;content:attr(data-tooltip);padding:.5rem 1rem;text-overflow:ellipsis;white-space:pre}[data-tooltip]:not(.is-disabled)::before,[data-tooltip]:not(.is-loading)::before,[data-tooltip]:not([disabled])::before{top:0;right:auto;bottom:auto;left:50%;top:0;margin-top:-5px;margin-bottom:auto;-webkit-transform:translate(-50%,-100%);transform:translate(-50%,-100%)}[data-tooltip]:not(.is-disabled).has-tooltip-bottom::after,[data-tooltip]:not(.is-loading).has-tooltip-bottom::after,[data-tooltip]:not([disabled]).has-tooltip-bottom::after{top:auto;right:auto;bottom:0;left:50%;margin-top:auto;margin-right:auto;margin-bottom:-5px;margin-left:-5px;border-color:transparent transparent rgba(74,74,74,.9) transparent}[data-tooltip]:not(.is-disabled).has-tooltip-bottom::before,[data-tooltip]:not(.is-loading).has-tooltip-bottom::before,[data-tooltip]:not([disabled]).has-tooltip-bottom::before{top:auto;right:auto;bottom:0;left:50%;margin-top:auto;margin-bottom:-5px;-webkit-transform:translate(-50%,100%);transform:translate(-50%,100%)}[data-tooltip]:not(.is-disabled).has-tooltip-left::after,[data-tooltip]:not(.is-loading).has-tooltip-left::after,[data-tooltip]:not([disabled]).has-tooltip-left::after{top:auto;right:auto;bottom:50%;left:0;margin-top:auto;margin-right:auto;margin-bottom:-6px;margin-left:-11px;border-color:transparent transparent transparent rgba(74,74,74,.9)}[data-tooltip]:not(.is-disabled).has-tooltip-left::before,[data-tooltip]:not(.is-loading).has-tooltip-left::before,[data-tooltip]:not([disabled]).has-tooltip-left::before{top:auto;right:auto;bottom:50%;left:-11px;-webkit-transform:translate(-100%,50%);transform:translate(-100%,50%)}[data-tooltip]:not(.is-disabled).has-tooltip-right::after,[data-tooltip]:not(.is-loading).has-tooltip-right::after,[data-tooltip]:not([disabled]).has-tooltip-right::after{top:auto;right:0;bottom:50%;left:auto;margin-top:auto;margin-right:-11px;margin-bottom:-6px;margin-left:auto;border-color:transparent rgba(74,74,74,.9) transparent transparent}[data-tooltip]:not(.is-disabled).has-tooltip-right::before,[data-tooltip]:not(.is-loading).has-tooltip-right::before,[data-tooltip]:not([disabled]).has-tooltip-right::before{top:auto;right:-11px;bottom:50%;left:auto;margin-top:auto;-webkit-transform:translate(100%,50%);transform:translate(100%,50%)}[data-tooltip]:not(.is-disabled).has-tooltip-multiline::before,[data-tooltip]:not(.is-loading).has-tooltip-multiline::before,[data-tooltip]:not([disabled]).has-tooltip-multiline::before{height:auto;width:15rem;max-width:15rem;text-overflow:clip;white-space:normal;word-break:keep-all}[data-tooltip]:not(.is-disabled).has-tooltip-white.has-tooltip-bottom::after,[data-tooltip]:not(.is-loading).has-tooltip-white.has-tooltip-bottom::after,[data-tooltip]:not([disabled]).has-tooltip-white.has-tooltip-bottom::after{border-color:transparent transparent rgba(255,255,255,.9) transparent}[data-tooltip]:not(.is-disabled).has-tooltip-white.has-tooltip-left::after,[data-tooltip]:not(.is-loading).has-tooltip-white.has-tooltip-left::after,[data-tooltip]:not([disabled]).has-tooltip-white.has-tooltip-left::after{border-color:transparent transparent transparent rgba(255,255,255,.9)}[data-tooltip]:not(.is-disabled).has-tooltip-white.has-tooltip-right::after,[daLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../bulma.sass","../sass/utilities/animations.sass","bulma.css","../sass/utilities/mixins.sass","../sass/utilities/initial-variables.sass","../sass/utilities/controls.sass","../sass/base/minireset.sass","../sass/base/generic.sass","../sass/base/helpers.sass","../sass/elements/box.sass","../sass/elements/button.sass","../sass/utilities/functions.sass","../sass/elements/container.sass","../sass/elements/content.sass","../sass/elements/icon.sass","../sass/elements/image.sass","../sass/elements/notification.sass","../sass/elements/progress.sass","../sass/elements/table.sass","../sass/elements/tag.sass","../sass/elements/title.sass","../sass/elements/other.sass","../sass/form/shared.sass","../sass/form/input-textarea.sass","../sass/form/checkbox-radio.sass","../sass/form/select.sass","../sass/form/file.sass","../sass/form/tools.sass","../sass/components/breadcrumb.sass","../sass/components/card.sass","../sass/components/dropdown.sass","../sass/components/level.sass","../sass/components/list.sass","../sass/components/media.sass","../sass/components/menu.sass","../sass/components/message.sass","../sass/components/modal.sass","../sass/components/navbar.sass","../sass/components/pagination.sass","../sass/components/panel.sass","../sass/components/tabs.sass","../sass/grid/columns.sass","../sass/grid/tiles.sass","../sass/layout/hero.sass","../sass/layout/section.sass","../sass/layout/footer.sass"],"names":[],"mappings":"AACA,6DAAA;ACDA;EACE;IACE,+BAAuB;YAAvB,uBAAuB;ECEzB;EDDA;IACE,iCAAyB;YAAzB,yBAAyB;ECG3B;AACF;ADRA;EACE;IACE,+BAAuB;YAAvB,uBAAuB;ECEzB;EDDA;IACE,iCAAyB;YAAzB,yBAAyB;ECG3B;AACF;;ACmIA;;;;EANE,2BAA2B;EAC3B,yBAAyB;EACzB,sBAAsB;EACtB,qBAAqB;EACrB,iBAAiB;ADtHnB;;AC2IA;EAfE,6BAD8B;EAE9B,kBAAkB;EAClB,eAAe;EACf,aAAa;EACb,YAAY;EACZ,cAAc;EACd,eAAe;EACf,qBAAqB;EACrB,oBAAoB;EACpB,kBAAkB;EAClB,QAAQ;EACR,iCAAyB;UAAzB,yBAAyB;EACzB,gCAAwB;UAAxB,wBAAwB;EACxB,cAAc;ADxHhB;;AC8HE;;EACE,qBCpHkB;AFNtB;;ACiMA;EAhEE,qBAAqB;EACrB,wBAAwB;EACxB,uCC1K2B;ED2K3B,YAAY;EACZ,uBCxGuB;EDyGvB,eAAe;EACf,oBAAoB;EACpB,qBAAqB;EACrB,YAAY;EACZ,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,eAAe;EACf,aAAa;EACb,kBAAkB;EAClB,mBAAmB;EACnB,WAAW;AD7Hb;;AC8HE;EAEE,uBClL2B;EDmL3B,WAAW;EACX,cAAc;EACd,SAAS;EACT,kBAAkB;EAClB,QAAQ;EACR,kEAA0D;UAA1D,0DAA0D;EAC1D,uCAA+B;UAA/B,+BAA+B;AD5HnC;;AC6HE;EACE,WAAW;EACX,UAAU;AD1Hd;;AC2HE;EACE,WAAW;EACX,UAAU;ADxHd;;ACyHE;EAEE,uCC9MyB;AFuF7B;;ACwHE;EACE,uCChNyB;AF2F7B;;ACuHE;EACE,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,eAAe;EACf,WAAW;ADpHf;;ACqHE;EACE,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,eAAe;EACf,WAAW;ADlHf;;ACmHE;EACE,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,eAAe;EACf,WAAW;ADhHf;;ACiIA;EAXE,mDAA2C;UAA3C,2CAA2C;EAC3C,yBCrO4B;EDsO5B,uBC1KuB;ED2KvB,+BAA+B;EAC/B,6BAA6B;EAC7B,WAAW;EACX,cAAc;EACd,WAAW;EACX,kBAAkB;EAClB,UAAU;ADlHZ;;AC8HA;;;;;;;;;;;;;;;;;EANE,SADuB;EAEvB,OAFuB;EAGvB,kBAAkB;EAClB,QAJuB;EAKvB,MALuB;AD/FzB;;AGtHA;;;;;EA3BE,qBAAqB;EACrB,wBAAwB;EACxB,mBAAmB;EACnB,6BAA+C;EAC/C,kBDoDU;ECnDV,gBAAgB;EAChB,oBAAoB;EACpB,eDiBW;EChBX,cAfqB;EAgBrB,2BAA2B;EAC3B,gBAhBuB;EAiBvB,mCAfiE;EAgBjE,iCAfmE;EAgBnE,kCAhBmE;EAiBnE,gCAlBiE;EAmBjE,kBAAkB;EAClB,mBAAmB;AHyJrB;;AGvJE;;;;;;;;;;;;;;;;;EAIE,aAAa;AHuKjB;;AGtKE;;;;;;;;;;;;;;;;EAEE,mBAAmB;AHuLvB;;AI5NA,0EAAA;AAEA;;;;;;;;;;;;;;;;;;;;;;;EAuBE,SAAS;EACT,UAAU;AJ8NZ;;AI3NA;;;;;;EAME,eAAe;EACf,mBAAmB;AJ8NrB;;AI3NA;EACE,gBAAgB;AJ8NlB;;AI3NA;;;;EAIE,SAAS;AJ8NX;;AI3NA;EACE,sBAAsB;AJ8NxB;;AI5NA;EAII,mBAAmB;AJ4NvB;;AIzNA;;;;;EAKE,YAAY;EACZ,eAAe;AJ4NjB;;AI1NA;EACE,eAAe;AJ6NjB;;AI1NA;EACE,SAAS;AJ6NX;;AI1NA;EACE,yBAAyB;EACzB,iBAAiB;AJ6NnB;;AI3NA;;EAEE,UAAU;AJ8NZ;;AIhOA;;EAII,gBAAgB;AJiOpB;;AInQA;EClBE,uBHlB6B;EGmB7B,eAhCc;EAiCd,kCAAkC;EAClC,mCAAmC;EACnC,gBAlCoB;EAmCpB,kBAhCsB;EAiCtB,kBAhCsB;EAiCtB,kCApCiC;EAqCjC,8BAAsB;KAAtB,2BAAsB;MAAtB,0BAAsB;UAAtB,sBAAsB;ALyRxB;;AKvRA;;;;;;;EAOE,cAAc;AL0RhB;;AKxRA;;;;;EAKE,oLH7ByL;AFwT3L;;AKzRA;;EAEE,6BAA6B;EAC7B,4BAA4B;EAC5B,sBHlC0B;AF8T5B;;AK1RA;EACE,cH1D4B;EG2D5B,cAzDkB;EA0DlB,gBH3BiB;EG4BjB,gBAzDoB;ALsVtB;;AKzRA;EACE,cHpDgC;EGqDhC,eAAe;EACf,qBAAqB;AL4RvB;;AK/RA;EAKI,mBAAmB;AL8RvB;;AKnSA;EAOI,cHzE0B;AFyW9B;;AK9RA;EACE,4BHtE4B;EGuE5B,cH5DgC;EG6DhC,kBApEiB;EAqEjB,mBAtEkB;EAuElB,4BAxEgC;ALyWlC;;AK/RA;EACE,4BH7E4B;EG8E5B,YAAY;EACZ,cAAc;EACd,WAvEa;EAwEb,gBAvEkB;ALyWpB;;AKhSA;EACE,YAAY;EACZ,eAAe;ALmSjB;;AKjSA;;EAEE,wBAAwB;ALoS1B;;AKlSA;EACE,kBAtFuB;AL2XzB;;AKnSA;EACE,mBAAmB;EACnB,oBAAoB;ALsStB;;AKpSA;EACE,cHzG4B;EG0G5B,gBHrEe;AF4WjB;;AKnSA;EACE,YAAY;ALsSd;;AKpSA;EJzDE,iCAAiC;EI2DjC,4BH7G4B;EG8G5B,cHnH4B;EGoH5B,kBAhGqB;EAiGrB,gBAAgB;EAChB,uBAjG0B;EAkG1B,gBAAgB;EAChB,iBAAiB;ALuSnB;;AK/SA;EAUI,6BAA6B;EAC7B,mBAAmB;EACnB,cAtGoB;EAuGpB,UAAU;ALySd;;AKvSA;;EAGI,mBAAmB;ALySvB;;AK5SA;;EAKM,gBAAgB;AL4StB;;AKjTA;EAOI,cHvI0B;AFqb9B;;ACxbE;EACE,WAAW;EACX,YAAY;EACZ,cAAc;AD2blB;;AM5bA;EACE,sBAAsB;AN+bxB;;AM7bA;EACE,uBAAuB;ANgczB;;AM5bA;EACE,2BAA2B;AN+b7B;;AMnbI;EACE,0BAA2B;ANsbjC;;AMvbI;EACE,4BAA2B;AN0bjC;;AM3bI;EACE,0BAA2B;AN8bjC;;AM/bI;EACE,4BAA2B;ANkcjC;;AMncI;EACE,6BAA2B;ANscjC;;AMvcI;EACE,0BAA2B;AN0cjC;;AM3cLine truncated
|
||||
@@ -0,0 +1,14 @@
|
||||
#paste-contents {
|
||||
font-family: monospace;
|
||||
font-size: 0.9rem;
|
||||
height: 90vh;
|
||||
}
|
||||
|
||||
.paste-data {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* This is a special case for multiline tooltips. See https://github.com/Wikiki/bulma-tooltip/issues/34 */
|
||||
.tooltip.is-tooltip-multiline::before {
|
||||
white-space:pre-line
|
||||
}
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=$1
|
||||
if [ "${VERSION}" == "" ]; then
|
||||
echo "Specify version as first parameter!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OS_LIST=("darwin/amd64" "dragonfly/amd64" "freebsd/386" "freebsd/amd64" "freebsd/arm" "linux/386" "linux/amd64" "linux/arm" "linux/arm64" "linux/ppc64" "linux/ppc64le" "linux/mips" "linux/mipsle" "linux/mips64" "linux/mips64le" "linux/s390x" "netbsd/386" "netbsd/amd64" "netbsd/arm" "openbsd/386" "openbsd/amd64" "openbsd/arm" "solaris/amd64" "windows/386" "windows/amd64")
|
||||
|
||||
if [ ! -d ./dist ]; then
|
||||
mkdir -p ./dist
|
||||
fi
|
||||
|
||||
for os in ${OS_LIST[@]}; do
|
||||
mkdir -p ./dist/${os}
|
||||
goos=$(echo ${os} | awk -F"/" '{ print $1 }')
|
||||
goarch=$(echo ${os} | awk -F"/" '{ print $2 }')
|
||||
echo "Building for ${goos} ${goarch}..."
|
||||
GOOS=${goos} GOARCH=${goarch} GOFLAGS="-mod=vendor" go build -o ./dist/${os}/fastpastebin ./cmd/fastpastebin/
|
||||
cp ./examples/fastpastebin.yaml.dist ./dist/${os}/fastpastebin.yaml
|
||||
cd ./dist/${os}/
|
||||
tar -czf fastpastebin-${VERSION}-${goos}-${goarch}.tar.gz fastpastebin fastpastebin.yaml
|
||||
mv fastpastebin-${VERSION}-${goos}-${goarch}.tar.gz ../../
|
||||
cd - &>/dev/null
|
||||
done
|
||||
@@ -25,53 +25,53 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/api"
|
||||
"github.com/pztrn/fastpastebin/captcha"
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
"github.com/pztrn/fastpastebin/database"
|
||||
"github.com/pztrn/fastpastebin/database/migrations"
|
||||
"github.com/pztrn/fastpastebin/pastes"
|
||||
"github.com/pztrn/fastpastebin/templater"
|
||||
"go.dev.pztrn.name/fastpastebin/domains/dbnotavailable"
|
||||
"go.dev.pztrn.name/fastpastebin/domains/indexpage"
|
||||
"go.dev.pztrn.name/fastpastebin/domains/pastes"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/captcha"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/templater"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c := context.New()
|
||||
c.Initialize()
|
||||
appCtx := context.New()
|
||||
appCtx.Initialize()
|
||||
|
||||
c.Logger.Info().Msg("Starting Fast Pastebin...")
|
||||
appCtx.Logger.Info().Msg("Starting Fast Pastebin...")
|
||||
|
||||
// Here goes initial initialization for packages that want CLI flags
|
||||
// to be added.
|
||||
|
||||
// Parse flags.
|
||||
c.Flagger.Parse()
|
||||
appCtx.Flagger.Parse()
|
||||
|
||||
// Continue loading.
|
||||
c.LoadConfiguration()
|
||||
database.New(c)
|
||||
c.Database.Initialize()
|
||||
migrations.New(c)
|
||||
migrations.Migrate()
|
||||
templater.Initialize(c)
|
||||
api.New(c)
|
||||
api.InitializeAPI()
|
||||
appCtx.LoadConfiguration()
|
||||
appCtx.InitializePost()
|
||||
database.New(appCtx)
|
||||
appCtx.Database.Initialize()
|
||||
templater.Initialize(appCtx)
|
||||
|
||||
captcha.New(c)
|
||||
pastes.New(c)
|
||||
captcha.New(appCtx)
|
||||
|
||||
dbnotavailable.New(appCtx)
|
||||
indexpage.New(appCtx)
|
||||
pastes.New(appCtx)
|
||||
|
||||
// CTRL+C handler.
|
||||
signalHandler := make(chan os.Signal, 1)
|
||||
shutdownDone := make(chan bool, 1)
|
||||
|
||||
signal.Notify(signalHandler, os.Interrupt, syscall.SIGTERM)
|
||||
|
||||
go func() {
|
||||
<-signalHandler
|
||||
c.Shutdown()
|
||||
appCtx.Shutdown()
|
||||
shutdownDone <- true
|
||||
}()
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
version: "3"
|
||||
|
||||
volumes:
|
||||
mysql:
|
||||
|
||||
services:
|
||||
database:
|
||||
image: mariadb:10.5
|
||||
container_name: database
|
||||
restart: always
|
||||
volumes:
|
||||
- fastpastebin_mysql:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_RANDOM_ROOT_PASSWORD=yes
|
||||
- MYSQL_DATABASE=fastpastebin
|
||||
- MYSQL_USER=fastpastebin
|
||||
- MYSQL_PASSWORD=fastpastebin
|
||||
fastpastebin:
|
||||
build: .
|
||||
image: fastpastebin
|
||||
container_name: fastpastebin
|
||||
restart: always
|
||||
depends_on:
|
||||
- database
|
||||
volumes:
|
||||
- ./docker/fastpastebin.docker.yaml:/app/fastpastebin.yaml:ro
|
||||
# ports:
|
||||
# - 25544:25544
|
||||
web:
|
||||
image: nginx:1.16-alpine
|
||||
container_name: nginx
|
||||
volumes:
|
||||
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
ports:
|
||||
- 8080:80
|
||||
depends_on:
|
||||
- fastpastebin
|
||||
@@ -0,0 +1,22 @@
|
||||
database:
|
||||
type: "mysql"
|
||||
path: "./data"
|
||||
address: "database"
|
||||
port: "3306"
|
||||
username: "fastpastebin"
|
||||
password: "fastpastebin"
|
||||
database: "fastpastebin"
|
||||
|
||||
logging:
|
||||
log_to_file: false
|
||||
filename: ""
|
||||
# Log level. Acceptable parameters: DEBUG, INFO, WARN, ERROR, FATAL, PANIC.
|
||||
loglevel: "DEBUG"
|
||||
|
||||
http:
|
||||
address: "0.0.0.0"
|
||||
port: "25544"
|
||||
allow_insecure: true
|
||||
|
||||
pastes:
|
||||
pagination: 10
|
||||
@@ -0,0 +1,10 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
location / {
|
||||
proxy_pass http://fastpastebin:25544;
|
||||
proxy_set_header Host $Host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $CI_BUILD_REF_NAME == "master" ]]; then
|
||||
export DOCKER_TAG=latest;
|
||||
else
|
||||
export DOCKER_TAG="${CI_BUILD_REF_NAME}";
|
||||
fi
|
||||
@@ -22,32 +22,24 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package api
|
||||
package dbnotavailable
|
||||
|
||||
import (
|
||||
// other
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/templater"
|
||||
)
|
||||
|
||||
// Logs Echo requests.
|
||||
func echoReqLog(ec echo.Context, next echo.HandlerFunc) error {
|
||||
c.Logger.Info().
|
||||
Str("IP", ec.RealIP()).
|
||||
Str("Host", ec.Request().Host).
|
||||
Str("Method", ec.Request().Method).
|
||||
Str("Path", ec.Request().URL.Path).
|
||||
Str("UA", ec.Request().UserAgent()).
|
||||
Msg("HTTP request")
|
||||
// Database not available error page.
|
||||
func dbNotAvailableGet(ec echo.Context) error {
|
||||
htmlData := templater.GetTemplate(ec, "database_not_available.html", nil)
|
||||
|
||||
next(ec)
|
||||
return nil
|
||||
// nolint:wrapcheck
|
||||
return ec.HTML(http.StatusInternalServerError, htmlData)
|
||||
}
|
||||
|
||||
// Wrapper around previous function.
|
||||
func echoReqLogger() echo.MiddlewareFunc {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
return echoReqLog(c, next)
|
||||
}
|
||||
}
|
||||
func dbNotAvailableRawGet(ec echo.Context) error {
|
||||
// nolint:wrapcheck
|
||||
return ec.String(http.StatusInternalServerError, "Database not available\nSomething went wrong while trying to connect to database. Check logs for details.")
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package dbnotavailable
|
||||
|
||||
import (
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
)
|
||||
|
||||
var c *context.Context
|
||||
|
||||
// New initializes pastes package and adds necessary HTTP and API
|
||||
// endpoints.
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
|
||||
c.Echo.GET("/database_not_available", dbNotAvailableGet)
|
||||
c.Echo.GET("/database_not_available/raw", dbNotAvailableRawGet)
|
||||
}
|
||||
@@ -22,19 +22,18 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package json
|
||||
package indexpage
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
)
|
||||
var c *context.Context
|
||||
|
||||
// New initializes basic JSON API.
|
||||
// New initializes pastes package and adds necessary HTTP and API
|
||||
// endpoints.
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
c.Logger.Info().Msg("Initializing JSON API...")
|
||||
|
||||
c.Echo.GET("/", indexGet)
|
||||
}
|
||||
@@ -22,27 +22,31 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package http
|
||||
package indexpage
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"net/http"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/captcha"
|
||||
"github.com/pztrn/fastpastebin/templater"
|
||||
|
||||
// other
|
||||
"github.com/alecthomas/chroma/lexers"
|
||||
"github.com/labstack/echo"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/captcha"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/flatfiles"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/templater"
|
||||
)
|
||||
|
||||
// Index of this site.
|
||||
func indexGet(ec echo.Context) error {
|
||||
func indexGet(ectx echo.Context) error {
|
||||
// We should check if database connection available.
|
||||
dbConn := c.Database.GetDatabaseConnection()
|
||||
if c.Config.Database.Type != flatfiles.FlatFileDialect && dbConn == nil {
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/database_not_available")
|
||||
}
|
||||
|
||||
// Generate list of available languages to highlight.
|
||||
availableLexers := lexers.Names(false)
|
||||
|
||||
var availableLexersSelectOpts = "<option value='text'>Text</option><option value='autodetect'>Auto detect</option><option disabled>-----</option>"
|
||||
availableLexersSelectOpts := "<option value='text'>Text</option><option value='autodetect'>Auto detect</option><option disabled>-----</option>"
|
||||
for i := range availableLexers {
|
||||
availableLexersSelectOpts += "<option value='" + availableLexers[i] + "'>" + availableLexers[i] + "</option>"
|
||||
}
|
||||
@@ -50,7 +54,8 @@ func indexGet(ec echo.Context) error {
|
||||
// Captcha.
|
||||
captchaString := captcha.NewCaptcha()
|
||||
|
||||
htmlData := templater.GetTemplate(ec, "index.html", map[string]string{"lexers": availableLexersSelectOpts, "captchaString": captchaString})
|
||||
htmlData := templater.GetTemplate(ectx, "index.html", map[string]string{"lexers": availableLexersSelectOpts, "captchaString": captchaString})
|
||||
|
||||
return ec.HTML(http.StatusOK, htmlData)
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusOK, htmlData)
|
||||
}
|
||||
@@ -25,35 +25,36 @@
|
||||
package pastes
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
"regexp"
|
||||
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
)
|
||||
var regexInts = regexp.MustCompile("[0-9]+")
|
||||
|
||||
// New initializes pastes package and adds neccessary HTTP and API
|
||||
var c *context.Context
|
||||
|
||||
// New initializes pastes package and adds necessary HTTP and API
|
||||
// endpoints.
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// HTTP endpoints.
|
||||
////////////////////////////////////////////////////////////
|
||||
// New paste.
|
||||
c.Echo.POST("/paste/", pastePOST)
|
||||
|
||||
c.Echo.POST("/paste/", pastePOSTWebInterface)
|
||||
// Show public paste.
|
||||
c.Echo.GET("/paste/:id", pasteGET)
|
||||
c.Echo.GET("/paste/:id", pasteGETWebInterface)
|
||||
// Show RAW representation of public paste.
|
||||
c.Echo.GET("/paste/:id/raw", pasteRawGET)
|
||||
|
||||
c.Echo.GET("/paste/:id/raw", pasteRawGETWebInterface)
|
||||
// Show private paste.
|
||||
c.Echo.GET("/paste/:id/:timestamp", pasteGET)
|
||||
c.Echo.GET("/paste/:id/:timestamp", pasteGETWebInterface)
|
||||
// Show RAW representation of private paste.
|
||||
c.Echo.GET("/paste/:id/:timestamp/raw", pasteRawGET)
|
||||
c.Echo.GET("/paste/:id/:timestamp/raw", pasteRawGETWebInterface)
|
||||
// Verify access to passworded paste.
|
||||
c.Echo.GET("/paste/:id/:timestamp/verify", pastePasswordedVerifyGet)
|
||||
c.Echo.POST("/paste/:id/:timestamp/verify", pastePasswordedVerifyPost)
|
||||
|
||||
// Pastes list.
|
||||
c.Echo.GET("/pastes/", pastesGET)
|
||||
c.Echo.GET("/pastes/:page", pastesGET)
|
||||
@@ -0,0 +1,357 @@
|
||||
package pastes
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/chroma"
|
||||
htmlfmt "github.com/alecthomas/chroma/formatters/html"
|
||||
"github.com/alecthomas/chroma/lexers"
|
||||
"github.com/alecthomas/chroma/styles"
|
||||
"github.com/labstack/echo"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/flatfiles"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/templater"
|
||||
)
|
||||
|
||||
const (
|
||||
pasteCookieInvalid = "PASTE_COOKIE_INVALID"
|
||||
pasteExpired = "PASTE_EXPIRED"
|
||||
pasteNotFound = "PASTE_NOT_FOUND"
|
||||
pasteTimestampInvalid = "PASTE_TIMESTAMP_INVALID"
|
||||
)
|
||||
|
||||
// Actual getting paste data and returns it's content without formatting.
|
||||
// This function will return paste's structure and optional error string
|
||||
// that defined in constants above.
|
||||
// Actually required only paste ID, all other parameters are optional
|
||||
// for some cases, e.g. public paste won't check for timestamp and cookie
|
||||
// value (they both will be ignored), but private will.
|
||||
func pasteGetData(pasteID int, timestamp int64, cookieValue string) (*structs.Paste, string) {
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Int("paste ID", pasteID).Msg("Failed to get paste")
|
||||
|
||||
return nil, pasteNotFound
|
||||
}
|
||||
|
||||
// Check if paste is expired.
|
||||
if paste.IsExpired() {
|
||||
c.Logger.Error().Int("paste ID", pasteID).Msg("Paste is expired")
|
||||
|
||||
return nil, pasteExpired
|
||||
}
|
||||
|
||||
// Check if we have a private paste and it's parameters are correct.
|
||||
if paste.Private {
|
||||
pasteTS := paste.CreatedAt.Unix()
|
||||
if timestamp != pasteTS {
|
||||
c.Logger.Error().Int("paste ID", pasteID).Int64("paste timestamp", pasteTS).Int64("provided timestamp", timestamp).Msg("Incorrect timestamp provided for private paste")
|
||||
|
||||
return nil, pasteTimestampInvalid
|
||||
}
|
||||
}
|
||||
|
||||
// If we have a private paste requested and password for that paste
|
||||
// was defined - check additional things that required to view this
|
||||
// paste.
|
||||
if paste.Private && paste.Password != "" {
|
||||
// Generate cookie value to check.
|
||||
pasteCookieValue := paste.GenerateCryptedCookieValue()
|
||||
|
||||
if cookieValue != pasteCookieValue {
|
||||
return nil, pasteCookieInvalid
|
||||
}
|
||||
}
|
||||
|
||||
return paste, ""
|
||||
}
|
||||
|
||||
// GET for "/paste/PASTE_ID" and "/paste/PASTE_ID/TIMESTAMP" (private pastes).
|
||||
// Web interface version.
|
||||
func pasteGETWebInterface(ectx echo.Context) error {
|
||||
pasteIDRaw := ectx.Param("id")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
pasteIDStr := strconv.Itoa(pasteID)
|
||||
c.Logger.Debug().Int("paste ID", pasteID).Msg("Trying to get paste data")
|
||||
|
||||
// Check if we have timestamp passed.
|
||||
// If passed timestamp is invalid (isn't a real UNIX timestamp) we
|
||||
// will show 404 Not Found error and spam about that in logs.
|
||||
var timestamp int64
|
||||
|
||||
tsProvidedStr := ectx.Param("timestamp")
|
||||
if tsProvidedStr != "" {
|
||||
tsProvided, err := strconv.ParseInt(tsProvidedStr, 10, 64)
|
||||
if err != nil {
|
||||
c.Logger.Error().Err(err).Int("paste ID", pasteID).Int64("provided timestamp", tsProvided).Msg("Invalid timestamp provided for getting private paste")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Paste #"+pasteIDStr+" not found")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
timestamp = tsProvided
|
||||
}
|
||||
|
||||
// Check if we have "PASTE-PASTEID" cookie defined. It is required
|
||||
// for private pastes.
|
||||
var cookieValue string
|
||||
|
||||
cookie, err1 := ectx.Cookie("PASTE-" + pasteIDStr)
|
||||
if err1 == nil {
|
||||
cookieValue = cookie.Value
|
||||
}
|
||||
|
||||
paste, err := pasteGetData(pasteID, timestamp, cookieValue)
|
||||
|
||||
// For these cases we should return 404 Not Found page.
|
||||
if err == pasteExpired || err == pasteNotFound || err == pasteTimestampInvalid {
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Paste #"+pasteIDRaw+" not found")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusNotFound, errtpl)
|
||||
}
|
||||
|
||||
// If passed cookie value was invalid - go to paste authorization
|
||||
// page.
|
||||
if err == pasteCookieInvalid {
|
||||
c.Logger.Info().Int("paste ID", pasteID).Msg("Invalid cookie, redirecting to auth page")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusMovedPermanently, "/paste/"+pasteIDStr+"/"+ectx.Param("timestamp")+"/verify")
|
||||
}
|
||||
|
||||
// Format paste data map.
|
||||
pasteData := make(map[string]string)
|
||||
pasteData["pasteTitle"] = paste.Title
|
||||
pasteData["pasteID"] = strconv.Itoa(paste.ID)
|
||||
pasteData["pasteDate"] = paste.CreatedAt.Format("2006-01-02 @ 15:04:05") + " UTC"
|
||||
pasteData["pasteLanguage"] = paste.Language
|
||||
|
||||
pasteExpirationString := "Never"
|
||||
if paste.KeepFor != 0 && paste.KeepForUnitType != 0 {
|
||||
pasteExpirationString = paste.GetExpirationTime().Format("2006-01-02 @ 15:04:05") + " UTC"
|
||||
}
|
||||
|
||||
pasteData["pasteExpiration"] = pasteExpirationString
|
||||
|
||||
if paste.Private {
|
||||
pasteData["pasteType"] = "<span class='has-text-danger'>Private</span>"
|
||||
pasteData["pasteTs"] = strconv.FormatInt(paste.CreatedAt.Unix(), 10) + "/"
|
||||
} else {
|
||||
pasteData["pasteType"] = "<span class='has-text-success'>Public</span>"
|
||||
pasteData["pasteTs"] = ""
|
||||
}
|
||||
|
||||
// Highlight.
|
||||
// Get lexer.
|
||||
lexer := lexers.Get(paste.Language)
|
||||
if lexer == nil {
|
||||
lexer = lexers.Fallback
|
||||
}
|
||||
// Tokenize paste data.
|
||||
lexered, err3 := lexer.Tokenise(nil, paste.Data)
|
||||
if err3 != nil {
|
||||
c.Logger.Error().Err(err3).Msg("Failed to tokenize paste data")
|
||||
}
|
||||
// Get style for HTML output.
|
||||
style := styles.Get("monokai")
|
||||
if style == nil {
|
||||
style = styles.Fallback
|
||||
}
|
||||
// Get HTML formatter.
|
||||
formatter := chroma.Formatter(htmlfmt.New(htmlfmt.WithLineNumbers(true), htmlfmt.LineNumbersInTable(true), htmlfmt.LinkableLineNumbers(true, "L")))
|
||||
|
||||
// Create buffer and format into it.
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
err4 := formatter.Format(buf, style, lexered)
|
||||
if err4 != nil {
|
||||
c.Logger.Error().Err(err4).Msg("Failed to format paste data")
|
||||
}
|
||||
|
||||
pasteData["pastedata"] = buf.String()
|
||||
|
||||
// Get template and format it.
|
||||
pasteHTML := templater.GetTemplate(ectx, "paste.html", pasteData)
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusOK, pasteHTML)
|
||||
}
|
||||
|
||||
// GET for "/paste/PASTE_ID/TIMESTAMP/verify" - a password verify page.
|
||||
func pastePasswordedVerifyGet(ectx echo.Context) error {
|
||||
pasteIDRaw := ectx.Param("id")
|
||||
timestampRaw := ectx.Param("timestamp")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Int("paste ID", pasteID).Msg("Failed to get paste data")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Paste #"+pasteIDRaw+" not found")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
// Check for auth cookie. If present - redirect to paste.
|
||||
cookie, err := ectx.Cookie("PASTE-" + strconv.Itoa(pasteID))
|
||||
if err == nil {
|
||||
// No cookie, redirect to auth page.
|
||||
c.Logger.Debug().Msg("Paste cookie found, checking it...")
|
||||
|
||||
// Generate cookie value to check.
|
||||
cookieValue := paste.GenerateCryptedCookieValue()
|
||||
|
||||
if cookieValue == cookie.Value {
|
||||
c.Logger.Info().Msg("Valid cookie, redirecting to paste page...")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusMovedPermanently, "/paste/"+pasteIDRaw+"/"+ectx.Param("timestamp"))
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msg("Invalid cookie, showing auth page")
|
||||
}
|
||||
|
||||
// HTML data.
|
||||
htmlData := make(map[string]string)
|
||||
htmlData["pasteID"] = strconv.Itoa(pasteID)
|
||||
htmlData["pasteTimestamp"] = timestampRaw
|
||||
|
||||
verifyHTML := templater.GetTemplate(ectx, "passworded_paste_verify.html", htmlData)
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusOK, verifyHTML)
|
||||
}
|
||||
|
||||
// POST for "/paste/PASTE_ID/TIMESTAMP/verify" - a password verify page.
|
||||
func pastePasswordedVerifyPost(ectx echo.Context) error {
|
||||
// We should check if database connection available.
|
||||
dbConn := c.Database.GetDatabaseConnection()
|
||||
|
||||
if c.Config.Database.Type != flatfiles.FlatFileDialect && dbConn == nil {
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/database_not_available")
|
||||
}
|
||||
|
||||
pasteIDRaw := ectx.Param("id")
|
||||
timestampRaw := ectx.Param("timestamp")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
c.Logger.Debug().Int("paste ID", pasteID).Msg("Requesting paste")
|
||||
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Int("paste ID", pasteID).Msg("Failed to get paste")
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
params, err2 := ectx.FormParams()
|
||||
if err2 != nil {
|
||||
c.Logger.Debug().Msg("No form parameters passed")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
if paste.VerifyPassword(params["paste-password"][0]) {
|
||||
// Set cookie that this paste's password is verified and paste
|
||||
// can be viewed.
|
||||
cookie := new(http.Cookie)
|
||||
cookie.Name = "PASTE-" + strconv.Itoa(pasteID)
|
||||
cookie.Value = paste.GenerateCryptedCookieValue()
|
||||
cookie.Expires = time.Now().Add(24 * time.Hour)
|
||||
ectx.SetCookie(cookie)
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/paste/"+strconv.Itoa(pasteID)+"/"+timestampRaw)
|
||||
}
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Invalid password. Please, try again.")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
// GET for "/pastes/:id/raw", raw paste output.
|
||||
// Web interface version.
|
||||
func pasteRawGETWebInterface(ectx echo.Context) error {
|
||||
// We should check if database connection available.
|
||||
dbConn := c.Database.GetDatabaseConnection()
|
||||
if c.Config.Database.Type != flatfiles.FlatFileDialect && dbConn == nil {
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/database_not_available/raw")
|
||||
}
|
||||
|
||||
pasteIDRaw := ectx.Param("id")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
c.Logger.Debug().Int("paste ID", pasteID).Msg("Requesting paste data")
|
||||
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Int("paste ID", pasteID).Msg("Failed to get paste from database")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, "Paste #"+pasteIDRaw+" does not exist.")
|
||||
}
|
||||
|
||||
if paste.IsExpired() {
|
||||
c.Logger.Error().Int("paste ID", pasteID).Msg("Paste is expired")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, "Paste #"+pasteIDRaw+" does not exist.")
|
||||
}
|
||||
|
||||
// Check if we have a private paste and it's parameters are correct.
|
||||
if paste.Private {
|
||||
tsProvidedStr := ectx.Param("timestamp")
|
||||
|
||||
tsProvided, err2 := strconv.ParseInt(tsProvidedStr, 10, 64)
|
||||
if err2 != nil {
|
||||
c.Logger.Error().Err(err2).Int("paste ID", pasteID).Str("provided timestamp", tsProvidedStr).Msg("Invalid timestamp provided for getting private paste")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.String(http.StatusBadRequest, "Paste #"+pasteIDRaw+" not found")
|
||||
}
|
||||
|
||||
pasteTS := paste.CreatedAt.Unix()
|
||||
if tsProvided != pasteTS {
|
||||
c.Logger.Error().Int("paste ID", pasteID).Int64("provided timestamp", tsProvided).Int64("paste timestamp", pasteTS).Msg("Incorrect timestamp provided for private paste")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.String(http.StatusBadRequest, "Paste #"+pasteIDRaw+" not found")
|
||||
}
|
||||
}
|
||||
|
||||
// nolint
|
||||
// ToDo: figure out how to handle passworded pastes here.
|
||||
// Return error for now.
|
||||
if paste.Password != "" {
|
||||
c.Logger.Error().Int("paste ID", pasteID).Msg("Cannot render paste as raw: passworded paste. Patches welcome!")
|
||||
return ectx.String(http.StatusBadRequest, "Paste #"+pasteIDRaw+" not found")
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.String(http.StatusOK, paste.Data)
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package pastes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/chroma/lexers"
|
||||
"github.com/labstack/echo"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/captcha"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/flatfiles"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/templater"
|
||||
)
|
||||
|
||||
const KeepPastesForever = "forever"
|
||||
|
||||
// POST for "/paste/" which will create new paste and redirect to
|
||||
// "/pastes/CREATED_PASTE_ID". This handler will do all the job for
|
||||
// requests comes from browsers via web interface.
|
||||
func pastePOSTWebInterface(ectx echo.Context) error {
|
||||
// We should check if database connection available.
|
||||
dbConn := c.Database.GetDatabaseConnection()
|
||||
if c.Config.Database.Type != flatfiles.FlatFileDialect && dbConn == nil {
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/database_not_available")
|
||||
}
|
||||
|
||||
params, err := ectx.FormParams()
|
||||
if err != nil {
|
||||
c.Logger.Error().Msg("Passed paste form is empty")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Cannot create empty paste")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msgf("Received parameters: %+v", params)
|
||||
|
||||
// Do nothing if paste contents is empty.
|
||||
if len(params["paste-contents"][0]) == 0 {
|
||||
c.Logger.Debug().Msg("Empty paste submitted, ignoring")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Empty pastes aren't allowed.")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
if !strings.ContainsAny(params["paste-keep-for"][0], "Mmhd") && params["paste-keep-for"][0] != KeepPastesForever {
|
||||
c.Logger.Debug().Str("field value", params["paste-keep-for"][0]).Msg("'Keep paste for' field have invalid value")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Invalid 'Paste should be available for' parameter passed. Please do not try to hack us ;).")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
// Verify captcha.
|
||||
if !captcha.Verify(params["paste-captcha-id"][0], params["paste-captcha-solution"][0]) {
|
||||
c.Logger.Debug().Str("captcha ID", params["paste-captcha-id"][0]).Str("captcha solution", params["paste-captcha-solution"][0]).Msg("Invalid captcha solution")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Invalid captcha solution.")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
// nolint:exhaustivestruct
|
||||
paste := &structs.Paste{
|
||||
Title: params["paste-title"][0],
|
||||
Data: params["paste-contents"][0],
|
||||
Language: params["paste-language"][0],
|
||||
}
|
||||
|
||||
// Paste creation time in UTC.
|
||||
createdAt := time.Now().UTC()
|
||||
paste.CreatedAt = &createdAt
|
||||
|
||||
// Parse "keep for" field.
|
||||
// Defaulting to "forever".
|
||||
keepFor := 0
|
||||
keepForUnit := 0
|
||||
|
||||
if params["paste-keep-for"][0] != KeepPastesForever {
|
||||
keepForUnitRegex := regexp.MustCompile("[Mmhd]")
|
||||
|
||||
keepForRaw := regexInts.FindAllString(params["paste-keep-for"][0], 1)[0]
|
||||
|
||||
var err error
|
||||
|
||||
keepFor, err = strconv.Atoi(keepForRaw)
|
||||
if err != nil {
|
||||
if params["paste-keep-for"][0] == KeepPastesForever {
|
||||
c.Logger.Debug().Msg("Keeping paste forever!")
|
||||
|
||||
keepFor = 0
|
||||
} else {
|
||||
c.Logger.Debug().Err(err).Msg("Failed to parse 'Keep for' integer")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Invalid 'Paste should be available for' parameter passed. Please do not try to hack us ;).")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
}
|
||||
|
||||
keepForUnitRaw := keepForUnitRegex.FindAllString(params["paste-keep-for"][0], 1)[0]
|
||||
keepForUnit = structs.PasteKeepsCorrelation[keepForUnitRaw]
|
||||
}
|
||||
|
||||
paste.KeepFor = keepFor
|
||||
paste.KeepForUnitType = keepForUnit
|
||||
|
||||
// Try to autodetect if it was selected.
|
||||
if params["paste-language"][0] == "autodetect" {
|
||||
lexer := lexers.Analyse(params["paste-language"][0])
|
||||
if lexer != nil {
|
||||
paste.Language = lexer.Config().Name
|
||||
} else {
|
||||
paste.Language = "text"
|
||||
}
|
||||
}
|
||||
|
||||
// Private paste?
|
||||
paste.Private = false
|
||||
privateCheckbox, privateCheckboxFound := params["paste-private"]
|
||||
pastePassword, pastePasswordFound := params["paste-password"]
|
||||
|
||||
if privateCheckboxFound && privateCheckbox[0] == "on" || pastePasswordFound && pastePassword[0] != "" {
|
||||
paste.Private = true
|
||||
}
|
||||
|
||||
if pastePassword[0] != "" {
|
||||
_ = paste.CreatePassword(pastePassword[0])
|
||||
}
|
||||
|
||||
pasteID, err2 := c.Database.SavePaste(paste)
|
||||
if err2 != nil {
|
||||
c.Logger.Error().Err(err2).Msg("Failed to save paste")
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ectx, "Failed to save paste. Please, try again later.")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
newPasteIDAsString := strconv.FormatInt(pasteID, 10)
|
||||
c.Logger.Debug().Msg("Paste saved, URL: /paste/" + newPasteIDAsString)
|
||||
|
||||
// Private pastes have it's timestamp in URL.
|
||||
if paste.Private {
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/paste/"+newPasteIDAsString+"/"+strconv.FormatInt(paste.CreatedAt.Unix(), 10))
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/paste/"+newPasteIDAsString)
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package pastes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/flatfiles"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/pagination"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/templater"
|
||||
)
|
||||
|
||||
// GET for "/pastes/", a list of publicly available pastes.
|
||||
// Web interface version.
|
||||
func pastesGET(ectx echo.Context) error {
|
||||
// We should check if database connection available.
|
||||
dbConn := c.Database.GetDatabaseConnection()
|
||||
if c.Config.Database.Type != flatfiles.FlatFileDialect && dbConn == nil {
|
||||
// nolint:wrapcheck
|
||||
return ectx.Redirect(http.StatusFound, "/database_not_available")
|
||||
}
|
||||
|
||||
pageFromParamRaw := ectx.Param("page")
|
||||
|
||||
page := 1
|
||||
|
||||
if pageFromParamRaw != "" {
|
||||
pageRaw := regexInts.FindAllString(pageFromParamRaw, 1)[0]
|
||||
page, _ = strconv.Atoi(pageRaw)
|
||||
}
|
||||
|
||||
c.Logger.Debug().Int("page", page).Msg("Requested page")
|
||||
|
||||
// Get pastes IDs.
|
||||
pastes, err3 := c.Database.GetPagedPastes(page)
|
||||
c.Logger.Debug().Int("count", len(pastes)).Msg("Got pastes")
|
||||
|
||||
pastesString := "No pastes to show."
|
||||
|
||||
// Show "No pastes to show" on any error for now.
|
||||
if err3 != nil {
|
||||
c.Logger.Error().Err(err3).Msg("Failed to get pastes list from database")
|
||||
|
||||
noPastesToShowTpl := templater.GetErrorTemplate(ectx, "No pastes to show.")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusOK, noPastesToShowTpl)
|
||||
}
|
||||
|
||||
if len(pastes) > 0 {
|
||||
pastesString = ""
|
||||
|
||||
for _, paste := range pastes {
|
||||
pasteDataMap := make(map[string]string)
|
||||
pasteDataMap["pasteID"] = strconv.Itoa(paste.ID)
|
||||
pasteDataMap["pasteTitle"] = paste.Title
|
||||
pasteDataMap["pasteDate"] = paste.CreatedAt.Format("2006-01-02 @ 15:04:05") + " UTC"
|
||||
|
||||
// Get max 4 lines of each paste.
|
||||
pasteDataSplitted := strings.Split(paste.Data, "\n")
|
||||
|
||||
var pasteData string
|
||||
|
||||
if len(pasteDataSplitted) < 4 {
|
||||
pasteData = paste.Data
|
||||
} else {
|
||||
pasteData = strings.Join(pasteDataSplitted[0:4], "\n")
|
||||
}
|
||||
|
||||
pasteDataMap["pasteData"] = pasteData
|
||||
pasteTpl := templater.GetRawTemplate(ectx, "pastelist_paste.html", pasteDataMap)
|
||||
|
||||
pastesString += pasteTpl
|
||||
}
|
||||
}
|
||||
|
||||
// Pagination.
|
||||
pages := c.Database.GetPastesPages()
|
||||
c.Logger.Debug().Int("total pages", pages).Int("current page", page).Msg("Paging data")
|
||||
paginationHTML := pagination.CreateHTML(page, pages, "/pastes/")
|
||||
|
||||
pasteListTpl := templater.GetTemplate(ectx, "pastelist_list.html", map[string]string{"pastes": pastesString, "pagination": paginationHTML})
|
||||
|
||||
// nolint:wrapcheck
|
||||
return ectx.HTML(http.StatusOK, pasteListTpl)
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
# Only MySQL database and flatfiles are supported for now.
|
||||
database:
|
||||
# Database type. The only supported ATM is "mysql" and "flatfiles".
|
||||
type: "mysql"
|
||||
type: "flatfiles"
|
||||
# Path for data stored with "flatfiles" database adapter.
|
||||
# Will be comletely ignored for MySQL/MariaDB.
|
||||
# Will be completely ignored for MySQL/MariaDB.
|
||||
path: "./data"
|
||||
# Next parameters are strictly for MySQL/MariaDB connections and
|
||||
# will be ignored by "flatfiles" adapter.
|
||||
@@ -25,12 +25,14 @@ logging:
|
||||
|
||||
# HTTP server configuration.
|
||||
http:
|
||||
address: "192.168.0.14"
|
||||
address: "127.0.0.1"
|
||||
port: "25544"
|
||||
# By default we're allowing only HTTPS requests. Setting this to true
|
||||
# will allow HTTP requests. Useful for developing or if you're
|
||||
# running Fast Pastebin behind reverse proxy that does SSL termination.
|
||||
allow_insecure: true
|
||||
# Maximum body size in megabytes. 1 should be enough for most use cases.
|
||||
max_body_size_megabytes: 1
|
||||
|
||||
# Pastes configuration.
|
||||
pastes:
|
||||
|
||||
+4
-3
@@ -5,7 +5,7 @@
|
||||
pkg: static
|
||||
|
||||
# destination
|
||||
dest: "./api/http/static/"
|
||||
dest: "./assets/static/"
|
||||
|
||||
# gofmt
|
||||
# type: bool
|
||||
@@ -79,8 +79,8 @@ custom:
|
||||
|
||||
# type: array of strings
|
||||
- files:
|
||||
- "assets/css/bulma-0.7.0.min.css"
|
||||
- "assets/css/bulma-tooltip-1.0.4.min.css"
|
||||
- "assets/css/bulma-0.7.5.min.css"
|
||||
- "assets/css/bulma-tooltip-3.0.0.min.css"
|
||||
- "assets/css/bulma.css.map"
|
||||
- "assets/css/style.css"
|
||||
- "assets/js/fontawesome-5.0.7.js"
|
||||
@@ -94,6 +94,7 @@ custom:
|
||||
prefix: "static/"
|
||||
# end: files
|
||||
- files:
|
||||
- "assets/database_not_available.html"
|
||||
- "assets/error.html"
|
||||
- "assets/footer.html"
|
||||
- "assets/index.html"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
module go.dev.pztrn.name/fastpastebin
|
||||
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/alecthomas/chroma v0.8.2
|
||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
|
||||
github.com/dlclark/regexp2 v1.4.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/jmoiron/sqlx v1.2.0
|
||||
github.com/labstack/echo v3.3.10+incompatible
|
||||
github.com/labstack/gommon v0.3.0 // indirect
|
||||
github.com/lib/pq v1.9.0
|
||||
github.com/pressly/goose v2.6.0+incompatible
|
||||
github.com/rs/zerolog v1.20.0
|
||||
go.dev.pztrn.name/flagger v0.0.0-20200617193309-89bc9818b76c
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
mvdan.cc/gofumpt v0.1.1 // indirect
|
||||
)
|
||||
@@ -0,0 +1,134 @@
|
||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
|
||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
|
||||
github.com/alecthomas/chroma v0.8.2 h1:x3zkuE2lUk/RIekyAJ3XRqSCP4zwWDfcw/YJCuCAACg=
|
||||
github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
|
||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
|
||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
|
||||
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
|
||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY=
|
||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f h1:q/DpyjJjZs94bziQ7YkBmIlpqbVP7yw179rnzoNVX1M=
|
||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f/go.mod h1:QGrK8vMWWHQYQ3QU9bw9Y9OPNfxccGzfb41qjvVeXtY=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk=
|
||||
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
|
||||
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
|
||||
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg=
|
||||
github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s=
|
||||
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
|
||||
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.9.0 h1:L8nSXQQzAYByakOFMTwpjRoHsMJklur4Gi59b6VivR8=
|
||||
github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4=
|
||||
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pressly/goose v2.6.0+incompatible h1:3f8zIQ8rfgP9tyI0Hmcs2YNAqUCL1c+diLe3iU8Qd/k=
|
||||
github.com/pressly/goose v2.6.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8=
|
||||
github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||
github.com/rs/zerolog v1.20.0 h1:38k9hgtUBdxFwE34yS8rTHmHBa4eN16E4DJlv177LNs=
|
||||
github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
|
||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.dev.pztrn.name/flagger v0.0.0-20200617193309-89bc9818b76c h1:+GgFefaTLsYDS0lXc8LNzTo6tcsA9qO3EkTAKduPAsI=
|
||||
go.dev.pztrn.name/flagger v0.0.0-20200617193309-89bc9818b76c/go.mod h1:ttPExQNCubgqqO5Y19LfIBKqmWtBocY7P9MXQEECuZo=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c h1:dS09fXwOFF9cXBnIzZexIuUBj95U1NyQjkEhkgidDow=
|
||||
golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
mvdan.cc/gofumpt v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
|
||||
mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
|
||||
@@ -25,22 +25,22 @@
|
||||
package captcha
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo"
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
|
||||
// other
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/labstack/echo"
|
||||
"github.com/rs/zerolog"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
c *context.Context
|
||||
log zerolog.Logger
|
||||
)
|
||||
|
||||
// New initializes captcha package and adds neccessary HTTP and API
|
||||
// New initializes captcha package and adds necessary HTTP and API
|
||||
// endpoints.
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
log = c.Logger.With().Str("type", "internal").Str("package", "captcha").Logger()
|
||||
|
||||
// New paste.
|
||||
c.Echo.GET("/captcha/:id.png", echo.WrapHandler(captcha.Server(captcha.StdWidth, captcha.StdHeight)))
|
||||
@@ -49,7 +49,8 @@ func New(cc *context.Context) {
|
||||
// NewCaptcha creates new captcha string.
|
||||
func NewCaptcha() string {
|
||||
s := captcha.New()
|
||||
c.Logger.Debug().Msgf("Created new captcha string: %s", s)
|
||||
log.Debug().Str("captcha string", s).Msg("Created new captcha string")
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
package config
|
||||
|
||||
// ConfigDatabase describes database configuration.
|
||||
type ConfigDatabase struct {
|
||||
// Database describes database configuration.
|
||||
type Database struct {
|
||||
Type string `yaml:"type"`
|
||||
Path string `yaml:"path"`
|
||||
Address string `yaml:"address"`
|
||||
@@ -24,9 +24,10 @@
|
||||
|
||||
package config
|
||||
|
||||
// ConfigHTTP describes HTTP server configuration.
|
||||
type ConfigHTTP struct {
|
||||
Address string `yaml:"address"`
|
||||
Port string `yaml:"port"`
|
||||
AllowInsecure bool `yaml:"allow_insecure"`
|
||||
// HTTP describes HTTP server configuration.
|
||||
type HTTP struct {
|
||||
Address string `yaml:"address"`
|
||||
Port string `yaml:"port"`
|
||||
MaxBodySizeMegabytes string `yaml:"max_body_size_megabytes"`
|
||||
AllowInsecure bool `yaml:"allow_insecure"`
|
||||
}
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
package config
|
||||
|
||||
// ConfigLogging describes logger configuration.
|
||||
type ConfigLogging struct {
|
||||
LogToFile bool `yaml:"log_to_file"`
|
||||
// Logging describes logger configuration.
|
||||
type Logging struct {
|
||||
FileName string `yaml:"filename"`
|
||||
LogLevel string `yaml:"loglevel"`
|
||||
LogToFile bool `yaml:"log_to_file"`
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
package config
|
||||
|
||||
// ConfigPastes describes pastes subsystem configuration.
|
||||
type ConfigPastes struct {
|
||||
// Pastes describes pastes subsystem configuration.
|
||||
type Pastes struct {
|
||||
Pagination int `yaml:"pagination"`
|
||||
}
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
package config
|
||||
|
||||
// ConfigStruct describes whole configuration.
|
||||
type ConfigStruct struct {
|
||||
Database ConfigDatabase `yaml:"database"`
|
||||
Logging ConfigLogging `yaml:"logging"`
|
||||
HTTP ConfigHTTP `yaml:"http"`
|
||||
Pastes ConfigPastes `yaml:"pastes"`
|
||||
// Struct describes whole configuration.
|
||||
type Struct struct {
|
||||
Database Database `yaml:"database"`
|
||||
Logging Logging `yaml:"logging"`
|
||||
HTTP HTTP `yaml:"http"`
|
||||
Pastes Pastes `yaml:"pastes"`
|
||||
}
|
||||
@@ -25,19 +25,15 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/config"
|
||||
"github.com/pztrn/fastpastebin/database/interface"
|
||||
|
||||
// other
|
||||
"github.com/labstack/echo"
|
||||
"github.com/pztrn/flagger"
|
||||
"github.com/rs/zerolog"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/config"
|
||||
databaseinterface "go.dev.pztrn.name/fastpastebin/internal/database/interface"
|
||||
"go.dev.pztrn.name/flagger"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
@@ -46,7 +42,7 @@ import (
|
||||
// contains everything every part of application need, like configuration
|
||||
// access, logger, etc.
|
||||
type Context struct {
|
||||
Config *config.ConfigStruct
|
||||
Config *config.Struct
|
||||
Database databaseinterface.Interface
|
||||
Echo *echo.Echo
|
||||
Flagger *flagger.Flagger
|
||||
@@ -55,12 +51,12 @@ type Context struct {
|
||||
|
||||
// Initialize initializes context.
|
||||
func (c *Context) Initialize() {
|
||||
c.Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stdout}).With().Timestamp().Logger()
|
||||
c.initializeLogger()
|
||||
|
||||
c.Flagger = flagger.New(nil)
|
||||
c.Flagger = flagger.New("fastpastebin", nil)
|
||||
c.Flagger.Initialize()
|
||||
|
||||
c.Flagger.AddFlag(&flagger.Flag{
|
||||
_ = c.Flagger.AddFlag(&flagger.Flag{
|
||||
Name: "config",
|
||||
Description: "Configuration file path. Can be overridded with FASTPASTEBIN_CONFIG environment variable (this is what used in tests).",
|
||||
Type: "string",
|
||||
@@ -68,13 +64,19 @@ func (c *Context) Initialize() {
|
||||
})
|
||||
}
|
||||
|
||||
// InitializePost initializes everything that needs a configuration.
|
||||
func (c *Context) InitializePost() {
|
||||
c.initializeLoggerPost()
|
||||
c.initializeHTTPServer()
|
||||
}
|
||||
|
||||
// LoadConfiguration loads configuration and executes right after Flagger
|
||||
// have parsed CLI flags, because it depends on "-config" defined in
|
||||
// Initialize().
|
||||
func (c *Context) LoadConfiguration() {
|
||||
c.Logger.Info().Msg("Loading configuration...")
|
||||
|
||||
var configPath = ""
|
||||
configPath := ""
|
||||
|
||||
// We're accepting configuration path from "-config" CLI parameter
|
||||
// and FASTPASTEBIN_CONFIG environment variable. Later have higher
|
||||
@@ -93,44 +95,28 @@ func (c *Context) LoadConfiguration() {
|
||||
// Normalize file path.
|
||||
normalizedConfigPath, err1 := filepath.Abs(configPath)
|
||||
if err1 != nil {
|
||||
c.Logger.Fatal().Msgf("Failed to normalize path to configuration file: %s", err1.Error())
|
||||
c.Logger.Fatal().Err(err1).Msg("Failed to normalize path to configuration file")
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msgf("Configuration file path: %s", configPath)
|
||||
c.Logger.Debug().Str("path", configPath).Msg("Configuration file path")
|
||||
|
||||
c.Config = &config.ConfigStruct{}
|
||||
// nolint:exhaustivestruct
|
||||
c.Config = &config.Struct{}
|
||||
|
||||
// Read configuration file.
|
||||
fileData, err2 := ioutil.ReadFile(normalizedConfigPath)
|
||||
if err2 != nil {
|
||||
c.Logger.Panic().Msgf("Failed to read configuration file: %s", err2.Error())
|
||||
c.Logger.Panic().Err(err2).Msg("Failed to read configuration file")
|
||||
}
|
||||
|
||||
// Parse it into structure.
|
||||
err3 := yaml.Unmarshal(fileData, c.Config)
|
||||
if err3 != nil {
|
||||
c.Logger.Panic().Msgf("Failed to parse configuration file: %s", err3.Error())
|
||||
c.Logger.Panic().Err(err3).Msg("Failed to parse configuration file")
|
||||
}
|
||||
|
||||
// Yay! See what it gets!
|
||||
c.Logger.Debug().Msgf("Parsed configuration: %+v", c.Config)
|
||||
|
||||
// Set log level.
|
||||
c.Logger.Info().Msgf("Setting logger level: %s", c.Config.Logging.LogLevel)
|
||||
switch c.Config.Logging.LogLevel {
|
||||
case "DEBUG":
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
case "INFO":
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
case "WARN":
|
||||
zerolog.SetGlobalLevel(zerolog.WarnLevel)
|
||||
case "ERROR":
|
||||
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
|
||||
case "FATAL":
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
case "PANIC":
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterDatabaseInterface registers database interface for later use.
|
||||
@@ -26,10 +26,11 @@ package context
|
||||
|
||||
const (
|
||||
// Version .
|
||||
Version = "0.2.0"
|
||||
Version = "0.4.0"
|
||||
)
|
||||
|
||||
// New creates new context.
|
||||
func New() *Context {
|
||||
// nolint:exhaustivestruct
|
||||
return &Context{}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/middleware"
|
||||
"go.dev.pztrn.name/fastpastebin/assets"
|
||||
)
|
||||
|
||||
func (c *Context) initializeHTTPServer() {
|
||||
c.Echo = echo.New()
|
||||
c.Echo.Use(c.echoReqLogger())
|
||||
c.Echo.Use(middleware.Recover())
|
||||
c.Echo.Use(middleware.BodyLimit(c.Config.HTTP.MaxBodySizeMegabytes + "M"))
|
||||
c.Echo.DisableHTTP2 = true
|
||||
c.Echo.HideBanner = true
|
||||
c.Echo.HidePort = true
|
||||
|
||||
// Static files.
|
||||
c.Echo.GET("/static/*", echo.WrapHandler(http.FileServer(http.FS(assets.Data))))
|
||||
|
||||
listenAddress := c.Config.HTTP.Address + ":" + c.Config.HTTP.Port
|
||||
|
||||
go func() {
|
||||
c.Echo.Logger.Fatal(c.Echo.Start(listenAddress))
|
||||
}()
|
||||
c.Logger.Info().Str("address", listenAddress).Msg("Started HTTP server")
|
||||
}
|
||||
|
||||
// Wrapper around previous function.
|
||||
func (c *Context) echoReqLogger() echo.MiddlewareFunc {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(ectx echo.Context) error {
|
||||
c.Logger.Info().
|
||||
Str("IP", ectx.RealIP()).
|
||||
Str("Host", ectx.Request().Host).
|
||||
Str("Method", ectx.Request().Method).
|
||||
Str("Path", ectx.Request().URL.Path).
|
||||
Str("UA", ectx.Request().UserAgent()).
|
||||
Msg("HTTP request")
|
||||
|
||||
return next(ectx)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
// Puts memory usage into log lines.
|
||||
func (c *Context) getMemoryUsage(event *zerolog.Event, level zerolog.Level, message string) {
|
||||
var m runtime.MemStats
|
||||
|
||||
runtime.ReadMemStats(&m)
|
||||
|
||||
event.Str("memalloc", fmt.Sprintf("%dMB", m.Alloc/1024/1024))
|
||||
event.Str("memsys", fmt.Sprintf("%dMB", m.Sys/1024/1024))
|
||||
event.Str("numgc", fmt.Sprintf("%d", m.NumGC))
|
||||
}
|
||||
|
||||
// Initializes logger.
|
||||
func (c *Context) initializeLogger() {
|
||||
// Устанавливаем форматирование логгера.
|
||||
// nolint:exhaustivestruct
|
||||
output := zerolog.ConsoleWriter{Out: os.Stdout, NoColor: false, TimeFormat: time.RFC3339}
|
||||
output.FormatLevel = func(lvlRaw interface{}) string {
|
||||
var v string
|
||||
|
||||
if lvl, ok := lvlRaw.(string); ok {
|
||||
lvl = strings.ToUpper(lvl)
|
||||
switch lvl {
|
||||
case "DEBUG":
|
||||
v = fmt.Sprintf("\x1b[30m%-5s\x1b[0m", lvl)
|
||||
case "ERROR":
|
||||
v = fmt.Sprintf("\x1b[31m%-5s\x1b[0m", lvl)
|
||||
case "FATAL":
|
||||
v = fmt.Sprintf("\x1b[35m%-5s\x1b[0m", lvl)
|
||||
case "INFO":
|
||||
v = fmt.Sprintf("\x1b[32m%-5s\x1b[0m", lvl)
|
||||
case "PANIC":
|
||||
v = fmt.Sprintf("\x1b[36m%-5s\x1b[0m", lvl)
|
||||
case "WARN":
|
||||
v = fmt.Sprintf("\x1b[33m%-5s\x1b[0m", lvl)
|
||||
default:
|
||||
v = lvl
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Sprintf("| %s |", v)
|
||||
}
|
||||
|
||||
c.Logger = zerolog.New(output).With().Timestamp().Logger()
|
||||
|
||||
c.Logger = c.Logger.Hook(zerolog.HookFunc(c.getMemoryUsage))
|
||||
}
|
||||
|
||||
// Initialize logger after configuration parse.
|
||||
func (c *Context) initializeLoggerPost() {
|
||||
// Set log level.
|
||||
c.Logger.Info().Msgf("Setting logger level: %s", c.Config.Logging.LogLevel)
|
||||
|
||||
switch c.Config.Logging.LogLevel {
|
||||
case "DEBUG":
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
case "INFO":
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
case "WARN":
|
||||
zerolog.SetGlobalLevel(zerolog.WarnLevel)
|
||||
case "ERROR":
|
||||
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
|
||||
case "FATAL":
|
||||
zerolog.SetGlobalLevel(zerolog.FatalLevel)
|
||||
case "PANIC":
|
||||
zerolog.SetGlobalLevel(zerolog.PanicLevel)
|
||||
}
|
||||
}
|
||||
@@ -25,17 +25,16 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/database/dialects/flatfiles"
|
||||
"github.com/pztrn/fastpastebin/database/dialects/interface"
|
||||
"github.com/pztrn/fastpastebin/database/dialects/mysql"
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
|
||||
// other
|
||||
// MySQL driver.
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/flatfiles"
|
||||
dialectinterface "go.dev.pztrn.name/fastpastebin/internal/database/dialects/interface"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/mysql"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/postgresql"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
// Database represents control structure for database connection.
|
||||
@@ -43,6 +42,47 @@ type Database struct {
|
||||
db dialectinterface.Interface
|
||||
}
|
||||
|
||||
// Database cleanup function. Executes once per hour, hardcoded for now and is
|
||||
// a subject of change in future.
|
||||
func (db *Database) cleanup() {
|
||||
for {
|
||||
c.Logger.Info().Msg("Starting pastes cleanup procedure...")
|
||||
|
||||
pages := db.db.GetPastesPages()
|
||||
|
||||
var pasteIDsToRemove []int
|
||||
|
||||
for i := 0; i < pages; i++ {
|
||||
pastes, err := db.db.GetPagedPastes(i)
|
||||
if err != nil {
|
||||
c.Logger.Error().Err(err).Int("page", i).Msg("Failed to perform database cleanup")
|
||||
}
|
||||
|
||||
for _, paste := range pastes {
|
||||
if paste.IsExpired() {
|
||||
pasteIDsToRemove = append(pasteIDsToRemove, paste.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, pasteID := range pasteIDsToRemove {
|
||||
err := db.DeletePaste(pasteID)
|
||||
if err != nil {
|
||||
c.Logger.Error().Err(err).Int("paste", pasteID).Msg("Failed to delete paste!")
|
||||
}
|
||||
}
|
||||
|
||||
c.Logger.Info().Msg("Pastes cleanup done.")
|
||||
|
||||
time.Sleep(time.Hour)
|
||||
}
|
||||
}
|
||||
|
||||
func (db *Database) DeletePaste(pasteID int) error {
|
||||
// nolint:wrapcheck
|
||||
return db.db.DeletePaste(pasteID)
|
||||
}
|
||||
|
||||
func (db *Database) GetDatabaseConnection() *sql.DB {
|
||||
if db.db != nil {
|
||||
return db.db.GetDatabaseConnection()
|
||||
@@ -51,11 +91,13 @@ func (db *Database) GetDatabaseConnection() *sql.DB {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *Database) GetPaste(pasteID int) (*pastesmodel.Paste, error) {
|
||||
func (db *Database) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
// nolint:wrapcheck
|
||||
return db.db.GetPaste(pasteID)
|
||||
}
|
||||
|
||||
func (db *Database) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
func (db *Database) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
// nolint:wrapcheck
|
||||
return db.db.GetPagedPastes(page)
|
||||
}
|
||||
|
||||
@@ -69,11 +111,15 @@ func (db *Database) Initialize() {
|
||||
|
||||
if c.Config.Database.Type == "mysql" {
|
||||
mysql.New(c)
|
||||
} else if c.Config.Database.Type == "flatfiles" {
|
||||
} else if c.Config.Database.Type == flatfiles.FlatFileDialect {
|
||||
flatfiles.New(c)
|
||||
} else if c.Config.Database.Type == "postgresql" {
|
||||
postgresql.New(c)
|
||||
} else {
|
||||
c.Logger.Fatal().Msgf("Unknown database type: %s", c.Config.Database.Type)
|
||||
c.Logger.Fatal().Str("type", c.Config.Database.Type).Msg("Unknown database type")
|
||||
}
|
||||
|
||||
go db.cleanup()
|
||||
}
|
||||
|
||||
func (db *Database) RegisterDialect(di dialectinterface.Interface) {
|
||||
@@ -81,7 +127,8 @@ func (db *Database) RegisterDialect(di dialectinterface.Interface) {
|
||||
db.db.Initialize()
|
||||
}
|
||||
|
||||
func (db *Database) SavePaste(p *pastesmodel.Paste) (int64, error) {
|
||||
func (db *Database) SavePaste(p *structs.Paste) (int64, error) {
|
||||
// nolint:wrapcheck
|
||||
return db.db.SavePaste(p)
|
||||
}
|
||||
|
||||
+6
-3
@@ -25,11 +25,12 @@
|
||||
package flatfiles
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
"github.com/pztrn/fastpastebin/database/dialects/interface"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
dialectinterface "go.dev.pztrn.name/fastpastebin/internal/database/dialects/interface"
|
||||
)
|
||||
|
||||
const FlatFileDialect = "flatfiles"
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
f *FlatFiles
|
||||
@@ -37,6 +38,8 @@ var (
|
||||
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
// nolint:exhaustivestruct
|
||||
f = &FlatFiles{}
|
||||
|
||||
c.Database.RegisterDialect(dialectinterface.Interface(Handler{}))
|
||||
}
|
||||
+113
-54
@@ -25,7 +25,6 @@
|
||||
package flatfiles
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
@@ -36,90 +35,134 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
type FlatFiles struct {
|
||||
pastesIndex []*Index
|
||||
path string
|
||||
writeMutex sync.Mutex
|
||||
path string
|
||||
pastesIndex []Index
|
||||
}
|
||||
|
||||
// DeletePaste deletes paste from disk and index.
|
||||
func (ff *FlatFiles) DeletePaste(pasteID int) error {
|
||||
// Delete from disk.
|
||||
err := os.Remove(filepath.Join(ff.path, "pastes", strconv.Itoa(pasteID)+".json"))
|
||||
if err != nil {
|
||||
c.Logger.Error().Err(err).Msg("Failed to delete paste!")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete from index.
|
||||
ff.writeMutex.Lock()
|
||||
defer ff.writeMutex.Unlock()
|
||||
|
||||
pasteIndex := -1
|
||||
|
||||
for idx, paste := range ff.pastesIndex {
|
||||
if paste.ID == pasteID {
|
||||
pasteIndex = idx
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if pasteIndex != -1 {
|
||||
ff.pastesIndex = append(ff.pastesIndex[:pasteIndex], ff.pastesIndex[pasteIndex+1:]...)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ff *FlatFiles) GetDatabaseConnection() *sql.DB {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ff *FlatFiles) GetPaste(pasteID int) (*pastesmodel.Paste, error) {
|
||||
func (ff *FlatFiles) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
ff.writeMutex.Lock()
|
||||
pastePath := filepath.Join(ff.path, "pastes", strconv.Itoa(pasteID)+".json")
|
||||
c.Logger.Debug().Msgf("Trying to load paste data from '%s'...", pastePath)
|
||||
c.Logger.Debug().Str("path", pastePath).Msg("Trying to load paste data")
|
||||
|
||||
pasteInBytes, err := ioutil.ReadFile(pastePath)
|
||||
if err != nil {
|
||||
c.Logger.Debug().Msgf("Failed to read paste from storage: %s", err.Error())
|
||||
c.Logger.Debug().Err(err).Msg("Failed to read paste from storage")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return nil, err
|
||||
}
|
||||
c.Logger.Debug().Msgf("Loaded %d bytes: %s", len(pasteInBytes), string(pasteInBytes))
|
||||
|
||||
c.Logger.Debug().Int("paste bytes", len(pasteInBytes)).Msg("Loaded paste")
|
||||
ff.writeMutex.Unlock()
|
||||
|
||||
paste := &pastesmodel.Paste{}
|
||||
err = json.Unmarshal(pasteInBytes, paste)
|
||||
if err != nil {
|
||||
c.Logger.Error().Msgf("Failed to parse paste: %s", err.Error())
|
||||
return nil, err
|
||||
// nolint:exhaustivestruct
|
||||
paste := &structs.Paste{}
|
||||
|
||||
err1 := json.Unmarshal(pasteInBytes, paste)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Msgf("Failed to parse paste")
|
||||
|
||||
// nolint:wrapcheck
|
||||
return nil, err1
|
||||
}
|
||||
|
||||
return paste, nil
|
||||
}
|
||||
|
||||
func (ff *FlatFiles) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
func (ff *FlatFiles) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
// Pagination.
|
||||
var startPagination = 0
|
||||
startPagination := 0
|
||||
if page > 1 {
|
||||
startPagination = (page - 1) * c.Config.Pastes.Pagination
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msgf("Pastes index: %+v", ff.pastesIndex)
|
||||
|
||||
// Iteration one - get only public pastes.
|
||||
var publicPastes []*Index
|
||||
var publicPastes []Index
|
||||
|
||||
for _, paste := range ff.pastesIndex {
|
||||
if !paste.Private {
|
||||
publicPastes = append(publicPastes, paste)
|
||||
}
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msgf("%+v", publicPastes)
|
||||
|
||||
// Iteration two - get paginated pastes.
|
||||
var pastesData []pastesmodel.Paste
|
||||
pastesData := make([]structs.Paste, 0)
|
||||
|
||||
for idx, paste := range publicPastes {
|
||||
if len(pastesData) == c.Config.Pastes.Pagination {
|
||||
break
|
||||
}
|
||||
|
||||
if idx < startPagination {
|
||||
c.Logger.Debug().Msgf("Paste with index %d isn't in pagination query: too low index", idx)
|
||||
c.Logger.Debug().Int("paste index", idx).Msg("Paste isn't in pagination query: too low index")
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if (idx-1 >= startPagination && page > 1 && idx > startPagination+((page-1)*c.Config.Pastes.Pagination)) || (idx-1 >= startPagination && page == 1 && idx > startPagination+(page*c.Config.Pastes.Pagination)) {
|
||||
c.Logger.Debug().Msgf("Paste with index %d isn't in pagination query: too high index", idx)
|
||||
c.Logger.Debug().Int("paste index", idx).Msg("Paste isn't in pagination query: too high index")
|
||||
|
||||
break
|
||||
}
|
||||
c.Logger.Debug().Msgf("Getting paste data (ID: %d, index: %d)", paste.ID, idx)
|
||||
|
||||
c.Logger.Debug().Int("ID", paste.ID).Int("index", idx).Msg("Getting paste data")
|
||||
|
||||
// Get paste data.
|
||||
pasteData := &pastesmodel.Paste{}
|
||||
// nolint:exhaustivestruct
|
||||
pasteData := &structs.Paste{}
|
||||
|
||||
pasteRawData, err := ioutil.ReadFile(filepath.Join(ff.path, "pastes", strconv.Itoa(paste.ID)+".json"))
|
||||
if err != nil {
|
||||
c.Logger.Error().Msgf("Failed to read paste data: %s", err.Error())
|
||||
c.Logger.Error().Err(err).Msg("Failed to read paste data")
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
err = json.Unmarshal(pasteRawData, pasteData)
|
||||
if err != nil {
|
||||
c.Logger.Error().Msgf("Failed to parse paste data: %s", err.Error())
|
||||
err1 := json.Unmarshal(pasteRawData, pasteData)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Msg("Failed to parse paste data")
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -131,7 +174,7 @@ func (ff *FlatFiles) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
|
||||
func (ff *FlatFiles) GetPastesPages() int {
|
||||
// Get public pastes count.
|
||||
var publicPastes []*Index
|
||||
var publicPastes []Index
|
||||
|
||||
ff.writeMutex.Lock()
|
||||
for _, paste := range ff.pastesIndex {
|
||||
@@ -160,33 +203,36 @@ func (ff *FlatFiles) Initialize() {
|
||||
curUser, err := user.Current()
|
||||
if err != nil {
|
||||
c.Logger.Error().Msg("Failed to get current user. Will replace '~' for '/' in storage path!")
|
||||
|
||||
path = strings.Replace(path, "~", "/", -1)
|
||||
}
|
||||
|
||||
path = strings.Replace(path, "~", curUser.HomeDir, -1)
|
||||
}
|
||||
|
||||
path, _ = filepath.Abs(path)
|
||||
ff.path = path
|
||||
|
||||
c.Logger.Debug().Msgf("Storage path is now: %s", ff.path)
|
||||
|
||||
// Create directory if neccessary.
|
||||
// Create directory if necessary.
|
||||
if _, err := os.Stat(ff.path); err != nil {
|
||||
c.Logger.Debug().Msgf("Directory '%s' does not exist, creating...", ff.path)
|
||||
os.MkdirAll(ff.path, os.ModePerm)
|
||||
c.Logger.Debug().Str("directory", ff.path).Msg("Directory does not exist, creating...")
|
||||
_ = os.MkdirAll(ff.path, os.ModePerm)
|
||||
} else {
|
||||
c.Logger.Debug().Msgf("Directory '%s' already exists", ff.path)
|
||||
c.Logger.Debug().Str("directory", ff.path).Msg("Directory already exists")
|
||||
}
|
||||
|
||||
// Create directory for pastes.
|
||||
if _, err := os.Stat(filepath.Join(ff.path, "pastes")); err != nil {
|
||||
c.Logger.Debug().Msgf("Directory '%s' does not exist, creating...", filepath.Join(ff.path, "pastes"))
|
||||
os.MkdirAll(filepath.Join(ff.path, "pastes"), os.ModePerm)
|
||||
c.Logger.Debug().Str("directory", ff.path).Msg("Directory does not exist, creating...")
|
||||
_ = os.MkdirAll(filepath.Join(ff.path, "pastes"), os.ModePerm)
|
||||
} else {
|
||||
c.Logger.Debug().Msgf("Directory '%s' already exists", filepath.Join(ff.path, "pastes"))
|
||||
c.Logger.Debug().Str("directory", ff.path).Msg("Directory already exists")
|
||||
}
|
||||
|
||||
// Load pastes index.
|
||||
ff.pastesIndex = []*Index{}
|
||||
ff.pastesIndex = []Index{}
|
||||
if _, err := os.Stat(filepath.Join(ff.path, "pastes", "index.json")); err != nil {
|
||||
c.Logger.Warn().Msg("Pastes index file does not exist, will create new one")
|
||||
} else {
|
||||
@@ -195,52 +241,65 @@ func (ff *FlatFiles) Initialize() {
|
||||
c.Logger.Fatal().Msg("Failed to read contents of index file!")
|
||||
}
|
||||
|
||||
err = json.Unmarshal(indexData, &ff.pastesIndex)
|
||||
if err != nil {
|
||||
c.Logger.Error().Msgf("Failed to parse index file contents from JSON into internal structure. Will create new index file. All of your previous pastes will became unavailable. Error was: %s", err.Error())
|
||||
err1 := json.Unmarshal(indexData, &ff.pastesIndex)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Msg("Failed to parse index file contents from JSON into internal structure. Will create new index file. All of your previous pastes will became unavailable.")
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msgf("Parsed pastes index: %+v", ff.pastesIndex)
|
||||
c.Logger.Debug().Int("pastes count", len(ff.pastesIndex)).Msg("Parsed pastes index")
|
||||
}
|
||||
}
|
||||
|
||||
func (ff *FlatFiles) SavePaste(p *pastesmodel.Paste) (int64, error) {
|
||||
func (ff *FlatFiles) SavePaste(paste *structs.Paste) (int64, error) {
|
||||
ff.writeMutex.Lock()
|
||||
// Write paste data on disk.
|
||||
filesOnDisk, _ := ioutil.ReadDir(filepath.Join(ff.path, "pastes"))
|
||||
pasteID := len(filesOnDisk) + 1
|
||||
c.Logger.Debug().Msgf("Writing paste to disk, ID will be " + strconv.Itoa(pasteID))
|
||||
p.ID = pasteID
|
||||
data, err := json.Marshal(p)
|
||||
paste.ID = pasteID
|
||||
|
||||
c.Logger.Debug().Int("new paste ID", pasteID).Msg("Writing paste to disk")
|
||||
|
||||
data, err := json.Marshal(paste)
|
||||
if err != nil {
|
||||
ff.writeMutex.Unlock()
|
||||
|
||||
// nolint:wrapcheck
|
||||
return 0, err
|
||||
}
|
||||
err = ioutil.WriteFile(filepath.Join(ff.path, "pastes", strconv.Itoa(pasteID)+".json"), data, 0644)
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(ff.path, "pastes", strconv.Itoa(pasteID)+".json"), data, 0o600)
|
||||
if err != nil {
|
||||
ff.writeMutex.Unlock()
|
||||
|
||||
// nolint:wrapcheck
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// Add it to cache.
|
||||
indexData := &Index{}
|
||||
// nolint:exhaustivestruct
|
||||
indexData := Index{}
|
||||
indexData.ID = pasteID
|
||||
indexData.Private = p.Private
|
||||
indexData.Private = paste.Private
|
||||
ff.pastesIndex = append(ff.pastesIndex, indexData)
|
||||
ff.writeMutex.Unlock()
|
||||
|
||||
return int64(pasteID), nil
|
||||
}
|
||||
|
||||
func (ff *FlatFiles) Shutdown() {
|
||||
c.Logger.Info().Msg("Saving indexes...")
|
||||
|
||||
indexData, err := json.Marshal(ff.pastesIndex)
|
||||
if err != nil {
|
||||
c.Logger.Error().Msgf("Failed to encode index data into JSON: %s", err.Error())
|
||||
c.Logger.Error().Err(err).Msg("Failed to encode index data into JSON")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(ff.path, "pastes", "index.json"), indexData, 0644)
|
||||
if err != nil {
|
||||
c.Logger.Error().Msgf("Failed to write index data to file. Pretty sure that you've lost your pastes.")
|
||||
err1 := ioutil.WriteFile(filepath.Join(ff.path, "pastes", "index.json"), indexData, 0o600)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Err(err1).Msg("Failed to write index data to file. Pretty sure that you've lost your pastes.")
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
+8
-6
@@ -25,24 +25,26 @@
|
||||
package flatfiles
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
type Handler struct{}
|
||||
|
||||
func (dbh Handler) DeletePaste(pasteID int) error {
|
||||
return f.DeletePaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetDatabaseConnection() *sql.DB {
|
||||
return f.GetDatabaseConnection()
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPaste(pasteID int) (*pastesmodel.Paste, error) {
|
||||
func (dbh Handler) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
return f.GetPaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
func (dbh Handler) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
return f.GetPagedPastes(page)
|
||||
}
|
||||
|
||||
@@ -54,7 +56,7 @@ func (dbh Handler) Initialize() {
|
||||
f.Initialize()
|
||||
}
|
||||
|
||||
func (dbh Handler) SavePaste(p *pastesmodel.Paste) (int64, error) {
|
||||
func (dbh Handler) SavePaste(p *structs.Paste) (int64, error) {
|
||||
return f.SavePaste(p)
|
||||
}
|
||||
|
||||
File renamed without changes.
+5
-6
@@ -25,19 +25,18 @@
|
||||
package dialectinterface
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
DeletePaste(int) error
|
||||
GetDatabaseConnection() *sql.DB
|
||||
GetPaste(pasteID int) (*pastesmodel.Paste, error)
|
||||
GetPagedPastes(page int) ([]pastesmodel.Paste, error)
|
||||
GetPaste(pasteID int) (*structs.Paste, error)
|
||||
GetPagedPastes(page int) ([]structs.Paste, error)
|
||||
GetPastesPages() int
|
||||
Initialize()
|
||||
SavePaste(p *pastesmodel.Paste) (int64, error)
|
||||
SavePaste(p *structs.Paste) (int64, error)
|
||||
Shutdown()
|
||||
}
|
||||
@@ -25,9 +25,8 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
"github.com/pztrn/fastpastebin/database/dialects/interface"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
dialectinterface "go.dev.pztrn.name/fastpastebin/internal/database/dialects/interface"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -37,6 +36,8 @@ var (
|
||||
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
// nolint:exhaustivestruct
|
||||
d = &Database{}
|
||||
|
||||
c.Database.RegisterDialect(dialectinterface.Interface(Handler{}))
|
||||
}
|
||||
@@ -25,24 +25,26 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
type Handler struct{}
|
||||
|
||||
func (dbh Handler) DeletePaste(pasteID int) error {
|
||||
return d.DeletePaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetDatabaseConnection() *sql.DB {
|
||||
return d.GetDatabaseConnection()
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPaste(pasteID int) (*pastesmodel.Paste, error) {
|
||||
func (dbh Handler) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
return d.GetPaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
func (dbh Handler) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
return d.GetPagedPastes(page)
|
||||
}
|
||||
|
||||
@@ -54,7 +56,7 @@ func (dbh Handler) Initialize() {
|
||||
d.Initialize()
|
||||
}
|
||||
|
||||
func (dbh Handler) SavePaste(p *pastesmodel.Paste) (int64, error) {
|
||||
func (dbh Handler) SavePaste(p *structs.Paste) (int64, error) {
|
||||
return d.SavePaste(p)
|
||||
}
|
||||
|
||||
+9
-2
@@ -25,13 +25,20 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func InitialUp(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("CREATE TABLE `pastes` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Paste ID', `title` text NOT NULL COMMENT 'Paste title', `data` longtext NOT NULL COMMENT 'Paste data', `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Paste creation timestamp', `keep_for` int(4) NOT NULL DEFAULT 1 COMMENT 'Keep for integer. 0 - forever.', `keep_for_unit_type` int(1) NOT NULL DEFAULT 1 COMMENT 'Keep for unit type. 1 - minutes, 2 - hours, 3 - days, 4 - months.', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='Pastes';")
|
||||
_, err := tx.Exec(`CREATE TABLE pastes (
|
||||
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Paste ID',
|
||||
title text NOT NULL COMMENT 'Paste title',
|
||||
data longtext NOT NULL COMMENT 'Paste data',
|
||||
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Paste creation timestamp',
|
||||
keep_for int(4) NOT NULL DEFAULT 1 COMMENT 'Keep for integer. 0 - forever.',
|
||||
keep_for_unit_type int(1) NOT NULL DEFAULT 1 COMMENT 'Keep for unit type. 1 - minutes, 2 - hours, 3 - days, 4 - months.',
|
||||
PRIMARY KEY (id), UNIQUE KEY id (id)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='Pastes';`)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
+2
-1
@@ -25,13 +25,13 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func PasteLangUp(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE `pastes` ADD `language` VARCHAR(191) NOT NULL DEFAULT 'text' COMMENT 'Paste language'")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ func PasteLangUp(tx *sql.Tx) error {
|
||||
func PasteLangDown(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE `pastes` DROP COLUMN `language`")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
+2
-1
@@ -25,13 +25,13 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func PrivatePastesUp(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE `pastes` ADD `private` BOOL NOT NULL DEFAULT false COMMENT 'Private paste? If true - additional URL parameter (UNIX TIMESTAMP) of paste will be required to access.'")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ func PrivatePastesUp(tx *sql.Tx) error {
|
||||
func PrivatePastesDown(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE `pastes` DROP COLUMN `private`")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
+10
-7
@@ -25,32 +25,35 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func PasswordedPastesUp(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE `pastes` ADD `password` varchar(64) NOT NULL DEFAULT '' COMMENT 'Password for paste (scrypted and sha256ed).'")
|
||||
func PasswordedPastesUp(txn *sql.Tx) error {
|
||||
_, err := txn.Exec("ALTER TABLE `pastes` ADD `password` varchar(64) NOT NULL DEFAULT '' COMMENT 'Password for paste (scrypted and sha256ed).'")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
_, err1 := tx.Exec("ALTER TABLE `pastes` ADD `password_salt` varchar(64) NOT NULL DEFAULT '' COMMENT 'Password salt (sha256ed).'")
|
||||
_, err1 := txn.Exec("ALTER TABLE `pastes` ADD `password_salt` varchar(64) NOT NULL DEFAULT '' COMMENT 'Password salt (sha256ed).'")
|
||||
if err1 != nil {
|
||||
// nolint:wrapcheck
|
||||
return err1
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func PasswordedPastesDown(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE `pastes` DROP COLUMN `password`")
|
||||
func PasswordedPastesDown(txn *sql.Tx) error {
|
||||
_, err := txn.Exec("ALTER TABLE `pastes` DROP COLUMN `password`")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
_, err1 := tx.Exec("ALTER TABLE `pastes` DROP COLUMN `password_salt`")
|
||||
_, err1 := txn.Exec("ALTER TABLE `pastes` DROP COLUMN `password_salt`")
|
||||
if err1 != nil {
|
||||
// nolint:wrapcheck
|
||||
return err1
|
||||
}
|
||||
|
||||
+3
-9
@@ -25,17 +25,11 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
|
||||
// other
|
||||
//"github.com/jmoiron/sqlx"
|
||||
"github.com/pressly/goose"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
)
|
||||
var c *context.Context
|
||||
|
||||
// New initializes migrations.
|
||||
func New(cc *context.Context) {
|
||||
@@ -46,7 +40,7 @@ func New(cc *context.Context) {
|
||||
func Migrate() {
|
||||
c.Logger.Info().Msg("Migrating database...")
|
||||
|
||||
goose.SetDialect("mysql")
|
||||
_ = goose.SetDialect("mysql")
|
||||
goose.AddNamedMigration("1_initial.go", InitialUp, nil)
|
||||
goose.AddNamedMigration("2_paste_lang.go", PasteLangUp, PasteLangDown)
|
||||
goose.AddNamedMigration("3_private_pastes.go", PrivatePastesUp, PrivatePastesDown)
|
||||
+83
-25
@@ -25,16 +25,14 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
|
||||
// other
|
||||
// MySQL driver.
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/jmoiron/sqlx"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/mysql/migrations"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
// Database is a MySQL/MariaDB connection controlling structure.
|
||||
@@ -42,33 +40,75 @@ type Database struct {
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
// Checks if queries can be run on known connection and reestablish it
|
||||
// if not.
|
||||
func (db *Database) check() {
|
||||
if db.db != nil {
|
||||
_, err := db.db.Exec("SELECT 1")
|
||||
if err != nil {
|
||||
db.Initialize()
|
||||
}
|
||||
} else {
|
||||
db.Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
// DeletePaste deletes paste from database.
|
||||
func (db *Database) DeletePaste(pasteID int) error {
|
||||
db.check()
|
||||
|
||||
_, err := db.db.Exec(db.db.Rebind("DELETE FROM pastes WHERE id=?"), pasteID)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *Database) GetDatabaseConnection() *sql.DB {
|
||||
return db.db.DB
|
||||
db.check()
|
||||
|
||||
if db.db != nil {
|
||||
return db.db.DB
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPaste returns a single paste by ID.
|
||||
func (db *Database) GetPaste(pasteID int) (*pastesmodel.Paste, error) {
|
||||
p := &pastesmodel.Paste{}
|
||||
err := db.db.Get(p, db.db.Rebind("SELECT * FROM `pastes` WHERE id=?"), pasteID)
|
||||
func (db *Database) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
db.check()
|
||||
|
||||
// nolint:exhaustivestruct
|
||||
paste := &structs.Paste{}
|
||||
|
||||
err := db.db.Get(paste, db.db.Rebind("SELECT * FROM `pastes` WHERE id=?"), pasteID)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return p, nil
|
||||
return paste, nil
|
||||
}
|
||||
|
||||
func (db *Database) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
var pastesRaw []pastesmodel.Paste
|
||||
var pastes []pastesmodel.Paste
|
||||
func (db *Database) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
db.check()
|
||||
|
||||
var (
|
||||
pastesRaw []structs.Paste
|
||||
pastes []structs.Paste
|
||||
)
|
||||
|
||||
// Pagination.
|
||||
var startPagination = 0
|
||||
startPagination := 0
|
||||
if page > 1 {
|
||||
startPagination = (page - 1) * c.Config.Pastes.Pagination
|
||||
}
|
||||
|
||||
err := db.db.Select(&pastesRaw, db.db.Rebind("SELECT * FROM `pastes` WHERE private != true ORDER BY id DESC LIMIT ? OFFSET ?"), c.Config.Pastes.Pagination, startPagination)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -82,8 +122,13 @@ func (db *Database) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
}
|
||||
|
||||
func (db *Database) GetPastesPages() int {
|
||||
var pastesRaw []pastesmodel.Paste
|
||||
var pastes []pastesmodel.Paste
|
||||
db.check()
|
||||
|
||||
var (
|
||||
pastesRaw []structs.Paste
|
||||
pastes []structs.Paste
|
||||
)
|
||||
|
||||
err := db.db.Get(&pastesRaw, "SELECT * FROM `pastes` WHERE private != true")
|
||||
if err != nil {
|
||||
return 1
|
||||
@@ -112,7 +157,7 @@ func (db *Database) Initialize() {
|
||||
|
||||
// There might be only user, without password. MySQL/MariaDB driver
|
||||
// in DSN wants "user" or "user:password", "user:" is invalid.
|
||||
var userpass = ""
|
||||
var userpass string
|
||||
if c.Config.Database.Password == "" {
|
||||
userpass = c.Config.Database.Username
|
||||
} else {
|
||||
@@ -120,37 +165,50 @@ func (db *Database) Initialize() {
|
||||
}
|
||||
|
||||
dbConnString := fmt.Sprintf("%s@tcp(%s:%s)/%s?parseTime=true&collation=utf8mb4_unicode_ci&charset=utf8mb4", userpass, c.Config.Database.Address, c.Config.Database.Port, c.Config.Database.Database)
|
||||
c.Logger.Debug().Msgf("Database connection string: %s", dbConnString)
|
||||
c.Logger.Debug().Str("DSN", dbConnString).Msgf("Database connection string composed")
|
||||
|
||||
dbConn, err := sqlx.Connect("mysql", dbConnString)
|
||||
if err != nil {
|
||||
c.Logger.Panic().Msgf("Failed to connect to database: %s", err.Error())
|
||||
c.Logger.Error().Err(err).Msg("Failed to connect to database")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Force UTC for current connection.
|
||||
_ = dbConn.MustExec("SET @@session.time_zone='+00:00';")
|
||||
|
||||
c.Logger.Info().Msg("Database connection established")
|
||||
|
||||
db.db = dbConn
|
||||
|
||||
// Perform migrations.
|
||||
migrations.New(c)
|
||||
migrations.Migrate()
|
||||
}
|
||||
|
||||
func (db *Database) SavePaste(p *pastesmodel.Paste) (int64, error) {
|
||||
func (db *Database) SavePaste(p *structs.Paste) (int64, error) {
|
||||
db.check()
|
||||
|
||||
result, err := db.db.NamedExec("INSERT INTO `pastes` (title, data, created_at, keep_for, keep_for_unit_type, language, private, password, password_salt) VALUES (:title, :data, :created_at, :keep_for, :keep_for_unit_type, :language, :private, :password, :password_salt)", p)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return 0, err
|
||||
}
|
||||
|
||||
ID, err1 := result.LastInsertId()
|
||||
lastInsertID, err1 := result.LastInsertId()
|
||||
if err1 != nil {
|
||||
// nolint:wrapcheck
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return ID, nil
|
||||
return lastInsertID, nil
|
||||
}
|
||||
|
||||
func (db *Database) Shutdown() {
|
||||
err := db.db.Close()
|
||||
if err != nil {
|
||||
c.Logger.Error().Msgf("Failed to close database connection: %s", err.Error())
|
||||
if db.db != nil {
|
||||
err := db.db.Close()
|
||||
if err != nil {
|
||||
c.Logger.Error().Err(err).Msg("Failed to close database connection")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package postgresql
|
||||
|
||||
import (
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
dialectinterface "go.dev.pztrn.name/fastpastebin/internal/database/dialects/interface"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
d *Database
|
||||
)
|
||||
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
// nolint:exhaustivestruct
|
||||
d = &Database{}
|
||||
|
||||
c.Database.RegisterDialect(dialectinterface.Interface(Handler{}))
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package postgresql
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
type Handler struct{}
|
||||
|
||||
func (dbh Handler) DeletePaste(pasteID int) error {
|
||||
return d.DeletePaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetDatabaseConnection() *sql.DB {
|
||||
return d.GetDatabaseConnection()
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
return d.GetPaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
return d.GetPagedPastes(page)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPastesPages() int {
|
||||
return d.GetPastesPages()
|
||||
}
|
||||
|
||||
func (dbh Handler) Initialize() {
|
||||
d.Initialize()
|
||||
}
|
||||
|
||||
func (dbh Handler) SavePaste(p *structs.Paste) (int64, error) {
|
||||
return d.SavePaste(p)
|
||||
}
|
||||
|
||||
func (dbh Handler) Shutdown() {
|
||||
d.Shutdown()
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func InitialUp(tx *sql.Tx) error {
|
||||
_, err := tx.Exec(`
|
||||
CREATE TABLE pastes
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
data TEXT NOT NULL,
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
||||
keep_for INTEGER NOT NULL DEFAULT 1,
|
||||
keep_for_unit_type SMALLINT NOT NULL DEFAULT 1
|
||||
);
|
||||
|
||||
COMMENT ON COLUMN pastes.id IS 'Paste ID';
|
||||
COMMENT ON COLUMN pastes.title IS 'Paste title';
|
||||
COMMENT ON COLUMN pastes.data IS 'Paste data';
|
||||
COMMENT ON COLUMN pastes.created_at IS 'Paste creation timestamp';
|
||||
COMMENT ON COLUMN pastes.keep_for IS 'Keep for integer. 0 - forever.';
|
||||
COMMENT ON COLUMN pastes.keep_for_unit_type IS 'Keep for unit type. 0 - forever, 1 - minutes, 2 - hours, 3 - days, 4 - months.';
|
||||
`)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func PasteLangUp(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE pastes ADD COLUMN language VARCHAR(191) NOT NULL DEFAULT 'text'; COMMENT ON COLUMN pastes.language IS 'Paste language';")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func PasteLangDown(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE pastes DROP COLUMN language")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
+17
-19
@@ -22,30 +22,28 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package http
|
||||
package migrations
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/api/http/static"
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
|
||||
// other
|
||||
"github.com/labstack/echo"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
)
|
||||
func PrivatePastesUp(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE pastes ADD COLUMN private BOOLEAN NOT NULL DEFAULT false; COMMENT ON COLUMN pastes.private IS 'Private paste? If true - additional URL parameter (UNIX TIMESTAMP) of paste will be required to access.';")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
// New initializes basic HTTP API, which shows only index page and serves
|
||||
// static files.
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
c.Logger.Info().Msg("Initializing HTTP API...")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Static files.
|
||||
c.Echo.GET("/static/*", echo.WrapHandler(static.Handler))
|
||||
func PrivatePastesDown(tx *sql.Tx) error {
|
||||
_, err := tx.Exec("ALTER TABLE pastes DROP COLUMN private")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
// Index.
|
||||
c.Echo.GET("/", indexGet)
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func PasswordedPastesUp(txn *sql.Tx) error {
|
||||
_, err := txn.Exec("ALTER TABLE pastes ADD COLUMN password VARCHAR(64) NOT NULL DEFAULT ''; COMMENT ON COLUMN pastes.password IS 'Password for paste (scrypted and sha256ed).';")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
_, err1 := txn.Exec("ALTER TABLE pastes ADD COLUMN password_salt VARCHAR(64) NOT NULL DEFAULT ''; COMMENT ON COLUMN pastes.password_salt IS 'Password salt (sha256ed).';")
|
||||
if err1 != nil {
|
||||
// nolint:wrapcheck
|
||||
return err1
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func PasswordedPastesDown(txn *sql.Tx) error {
|
||||
_, err := txn.Exec("ALTER TABLE pastes DROP COLUMN password")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
_, err1 := txn.Exec("ALTER TABLE pastes DROP COLUMN password_salt")
|
||||
if err1 != nil {
|
||||
// nolint:wrapcheck
|
||||
return err1
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -22,49 +22,39 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package api
|
||||
package migrations
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/api/http"
|
||||
"github.com/pztrn/fastpastebin/api/json"
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
|
||||
// other
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/middleware"
|
||||
"github.com/pressly/goose"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
e *echo.Echo
|
||||
)
|
||||
var c *context.Context
|
||||
|
||||
// New initializes variables for api package.
|
||||
// New initializes migrations.
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
}
|
||||
|
||||
// InitializeAPI initializes HTTP API and starts web server.
|
||||
func InitializeAPI() {
|
||||
c.Logger.Info().Msg("Initializing HTTP server...")
|
||||
// Migrate launching migrations.
|
||||
func Migrate() {
|
||||
c.Logger.Info().Msg("Migrating database...")
|
||||
|
||||
e = echo.New()
|
||||
e.Use(echoReqLogger())
|
||||
e.Use(middleware.Recover())
|
||||
e.DisableHTTP2 = true
|
||||
e.HideBanner = true
|
||||
e.HidePort = true
|
||||
_ = goose.SetDialect("postgres")
|
||||
goose.AddNamedMigration("1_initial.go", InitialUp, nil)
|
||||
goose.AddNamedMigration("2_paste_lang.go", PasteLangUp, PasteLangDown)
|
||||
goose.AddNamedMigration("3_private_pastes.go", PrivatePastesUp, PrivatePastesDown)
|
||||
goose.AddNamedMigration("4_passworded_pastes.go", PasswordedPastesUp, PasswordedPastesDown)
|
||||
// Add new migrations BEFORE this message.
|
||||
|
||||
c.RegisterEcho(e)
|
||||
|
||||
http.New(c)
|
||||
json.New(c)
|
||||
|
||||
listenAddress := c.Config.HTTP.Address + ":" + c.Config.HTTP.Port
|
||||
|
||||
go func() {
|
||||
e.Logger.Fatal(e.Start(listenAddress))
|
||||
}()
|
||||
c.Logger.Info().Msgf("Started HTTP server at %s", listenAddress)
|
||||
dbConn := c.Database.GetDatabaseConnection()
|
||||
if dbConn != nil {
|
||||
err := goose.Up(dbConn, ".")
|
||||
if err != nil {
|
||||
c.Logger.Info().Msgf("%+v", err)
|
||||
c.Logger.Panic().Msgf("Failed to migrate database to latest version: %s", err.Error())
|
||||
}
|
||||
} else {
|
||||
c.Logger.Warn().Msg("Current database dialect isn't supporting migrations, skipping")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package postgresql
|
||||
|
||||
// nolint:gci
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
// PostgreSQL driver.
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/database/dialects/postgresql/migrations"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
// Database is a PostgreSQL connection controlling structure.
|
||||
type Database struct {
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
// Checks if queries can be run on known connection and reestablish it
|
||||
// if not.
|
||||
func (db *Database) check() {
|
||||
if db.db != nil {
|
||||
_, err := db.db.Exec("SELECT 1")
|
||||
if err != nil {
|
||||
db.Initialize()
|
||||
}
|
||||
} else {
|
||||
db.Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
// DeletePaste deletes paste from database.
|
||||
func (db *Database) DeletePaste(pasteID int) error {
|
||||
db.check()
|
||||
|
||||
_, err := db.db.Exec(db.db.Rebind("DELETE FROM pastes WHERE id=?"), pasteID)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *Database) GetDatabaseConnection() *sql.DB {
|
||||
db.check()
|
||||
|
||||
if db.db != nil {
|
||||
return db.db.DB
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPaste returns a single paste by ID.
|
||||
func (db *Database) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
db.check()
|
||||
|
||||
// nolint:exhaustivestruct
|
||||
paste := &structs.Paste{}
|
||||
|
||||
err := db.db.Get(paste, db.db.Rebind("SELECT * FROM pastes WHERE id=$1"), pasteID)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// We're aware of timezone in PostgreSQL, so SELECT will return
|
||||
// timestamps in server's local timezone. We should convert them.
|
||||
loc, _ := time.LoadLocation("UTC")
|
||||
|
||||
utcCreatedAt := paste.CreatedAt.In(loc)
|
||||
paste.CreatedAt = &utcCreatedAt
|
||||
|
||||
return paste, nil
|
||||
}
|
||||
|
||||
func (db *Database) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
db.check()
|
||||
|
||||
var (
|
||||
pastesRaw []structs.Paste
|
||||
pastes []structs.Paste
|
||||
)
|
||||
|
||||
// Pagination.
|
||||
startPagination := 0
|
||||
if page > 1 {
|
||||
startPagination = (page - 1) * c.Config.Pastes.Pagination
|
||||
}
|
||||
|
||||
err := db.db.Select(&pastesRaw, db.db.Rebind("SELECT * FROM pastes WHERE private != true ORDER BY id DESC LIMIT $1 OFFSET $2"), c.Config.Pastes.Pagination, startPagination)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// We're aware of timezone in PostgreSQL, so SELECT will return
|
||||
// timestamps in server's local timezone. We should convert them.
|
||||
loc, _ := time.LoadLocation("UTC")
|
||||
|
||||
for _, paste := range pastesRaw {
|
||||
if !paste.IsExpired() {
|
||||
utcCreatedAt := paste.CreatedAt.In(loc)
|
||||
paste.CreatedAt = &utcCreatedAt
|
||||
pastes = append(pastes, paste)
|
||||
}
|
||||
}
|
||||
|
||||
return pastes, nil
|
||||
}
|
||||
|
||||
func (db *Database) GetPastesPages() int {
|
||||
db.check()
|
||||
|
||||
var (
|
||||
pastesRaw []structs.Paste
|
||||
pastes []structs.Paste
|
||||
)
|
||||
|
||||
err := db.db.Get(&pastesRaw, "SELECT * FROM pastes WHERE private != true")
|
||||
if err != nil {
|
||||
return 1
|
||||
}
|
||||
|
||||
// Check if pastes isn't expired.
|
||||
for _, paste := range pastesRaw {
|
||||
if !paste.IsExpired() {
|
||||
pastes = append(pastes, paste)
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate pages.
|
||||
pages := len(pastes) / c.Config.Pastes.Pagination
|
||||
// Check if we have any remainder. Add 1 to pages count if so.
|
||||
if len(pastes)%c.Config.Pastes.Pagination > 0 {
|
||||
pages++
|
||||
}
|
||||
|
||||
return pages
|
||||
}
|
||||
|
||||
// Initialize initializes MySQL/MariaDB connection.
|
||||
func (db *Database) Initialize() {
|
||||
c.Logger.Info().Msg("Initializing database connection...")
|
||||
|
||||
var userpass string
|
||||
if c.Config.Database.Password == "" {
|
||||
userpass = c.Config.Database.Username
|
||||
} else {
|
||||
userpass = c.Config.Database.Username + ":" + c.Config.Database.Password
|
||||
}
|
||||
|
||||
dbConnString := fmt.Sprintf("postgres://%s@%s:%s/%s?connect_timeout=10&fallback_application_name=fastpastebin&sslmode=disable", userpass, c.Config.Database.Address, c.Config.Database.Port, c.Config.Database.Database)
|
||||
c.Logger.Debug().Str("DSN", dbConnString).Msg("Database connection string composed")
|
||||
|
||||
dbConn, err := sqlx.Connect("postgres", dbConnString)
|
||||
if err != nil {
|
||||
c.Logger.Error().Err(err).Msg("Failed to connect to database")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
c.Logger.Info().Msg("Database connection established")
|
||||
|
||||
db.db = dbConn
|
||||
|
||||
// Perform migrations.
|
||||
migrations.New(c)
|
||||
migrations.Migrate()
|
||||
}
|
||||
|
||||
func (db *Database) SavePaste(paste *structs.Paste) (int64, error) {
|
||||
db.check()
|
||||
|
||||
stmt, err := db.db.PrepareNamed("INSERT INTO pastes (title, data, created_at, keep_for, keep_for_unit_type, language, private, password, password_salt) VALUES (:title, :data, :created_at, :keep_for, :keep_for_unit_type, :language, :private, :password, :password_salt) RETURNING id")
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var id int64
|
||||
|
||||
err = stmt.Get(&id, paste)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (db *Database) Shutdown() {
|
||||
if db.db != nil {
|
||||
err := db.db.Close()
|
||||
if err != nil {
|
||||
c.Logger.Error().Err(err).Msg("Failed to close database connection")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,8 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
"github.com/pztrn/fastpastebin/database/interface"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
databaseinterface "go.dev.pztrn.name/fastpastebin/internal/database/interface"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -38,6 +37,8 @@ var (
|
||||
// New initializes database structure.
|
||||
func New(cc *context.Context) {
|
||||
c = cc
|
||||
// nolint:exhaustivestruct
|
||||
d = &Database{}
|
||||
|
||||
c.RegisterDatabaseInterface(databaseinterface.Interface(Handler{}))
|
||||
}
|
||||
@@ -25,27 +25,29 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/database/dialects/interface"
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
dialectinterface "go.dev.pztrn.name/fastpastebin/internal/database/dialects/interface"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
// Handler is an interfaceable structure that proxifies calls from anyone
|
||||
// to Database structure.
|
||||
type Handler struct{}
|
||||
|
||||
func (dbh Handler) DeletePaste(pasteID int) error {
|
||||
return d.DeletePaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetDatabaseConnection() *sql.DB {
|
||||
return d.GetDatabaseConnection()
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPaste(pasteID int) (*pastesmodel.Paste, error) {
|
||||
func (dbh Handler) GetPaste(pasteID int) (*structs.Paste, error) {
|
||||
return d.GetPaste(pasteID)
|
||||
}
|
||||
|
||||
func (dbh Handler) GetPagedPastes(page int) ([]pastesmodel.Paste, error) {
|
||||
func (dbh Handler) GetPagedPastes(page int) ([]structs.Paste, error) {
|
||||
return d.GetPagedPastes(page)
|
||||
}
|
||||
|
||||
@@ -62,7 +64,7 @@ func (dbh Handler) RegisterDialect(di dialectinterface.Interface) {
|
||||
d.RegisterDialect(di)
|
||||
}
|
||||
|
||||
func (dbh Handler) SavePaste(p *pastesmodel.Paste) (int64, error) {
|
||||
func (dbh Handler) SavePaste(p *structs.Paste) (int64, error) {
|
||||
return d.SavePaste(p)
|
||||
}
|
||||
|
||||
+6
-7
@@ -25,23 +25,22 @@
|
||||
package databaseinterface
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"database/sql"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/database/dialects/interface"
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
dialectinterface "go.dev.pztrn.name/fastpastebin/internal/database/dialects/interface"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/structs"
|
||||
)
|
||||
|
||||
// Interface represents database interface which is available to all
|
||||
// parts of application and registers with context.Context.
|
||||
type Interface interface {
|
||||
DeletePaste(int) error
|
||||
GetDatabaseConnection() *sql.DB
|
||||
GetPaste(pasteID int) (*pastesmodel.Paste, error)
|
||||
GetPagedPastes(page int) ([]pastesmodel.Paste, error)
|
||||
GetPaste(pasteID int) (*structs.Paste, error)
|
||||
GetPagedPastes(page int) ([]structs.Paste, error)
|
||||
GetPastesPages() int
|
||||
Initialize()
|
||||
RegisterDialect(dialectinterface.Interface)
|
||||
SavePaste(p *pastesmodel.Paste) (int64, error)
|
||||
SavePaste(p *structs.Paste) (int64, error)
|
||||
Shutdown()
|
||||
}
|
||||
@@ -1,56 +1,60 @@
|
||||
package pagination
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/api/http/static"
|
||||
"go.dev.pztrn.name/fastpastebin/assets"
|
||||
)
|
||||
|
||||
// CreateHTML creates pagination HTML based on passed parameters.
|
||||
func CreateHTML(currentPage int, pages int, linksBase string) string {
|
||||
// Load templates.
|
||||
paginationHTMLRaw, err := static.ReadFile("pagination.html")
|
||||
paginationHTMLRaw, err := assets.Data.ReadFile("pagination.html")
|
||||
if err != nil {
|
||||
return "Missing pagination.html"
|
||||
}
|
||||
|
||||
paginationLinkRaw, err1 := static.ReadFile("pagination_link.html")
|
||||
paginationLinkRaw, err1 := assets.Data.ReadFile("pagination_link.html")
|
||||
if err1 != nil {
|
||||
return "Missing pagination_link.html"
|
||||
}
|
||||
|
||||
paginationLinkCurrentRaw, err2 := static.ReadFile("pagination_link_current.html")
|
||||
paginationLinkCurrentRaw, err2 := assets.Data.ReadFile("pagination_link_current.html")
|
||||
if err2 != nil {
|
||||
return "Missing pagination_link_current.html"
|
||||
}
|
||||
|
||||
paginationEllipsisRaw, err3 := static.ReadFile("pagination_ellipsis.html")
|
||||
paginationEllipsisRaw, err3 := assets.Data.ReadFile("pagination_ellipsis.html")
|
||||
if err3 != nil {
|
||||
return "Missing pagination_ellipsis.html"
|
||||
}
|
||||
|
||||
// First page should always be visible.
|
||||
var paginationString = ""
|
||||
var paginationString string
|
||||
if currentPage == 1 {
|
||||
paginationString = strings.Replace(string(paginationLinkCurrentRaw), "{pageNum}", strconv.Itoa(currentPage), -1)
|
||||
} else {
|
||||
paginationString = strings.Replace(string(paginationLinkRaw), "{pageNum}", "1", -1)
|
||||
paginationString = strings.Replace(string(paginationString), "{paginationLink}", linksBase+"1", -1)
|
||||
paginationString = strings.Replace(paginationString, "{paginationLink}", linksBase+"1", -1)
|
||||
}
|
||||
|
||||
var ellipsisStartAdded = false
|
||||
var ellipsisEndAdded = false
|
||||
i := 2
|
||||
var (
|
||||
ellipsisStartAdded = false
|
||||
ellipsisEndAdded = false
|
||||
i = 2
|
||||
)
|
||||
|
||||
for i <= pages {
|
||||
// ToDo: fix it!
|
||||
// nolint:nestif
|
||||
if pages > 5 {
|
||||
if currentPage-3 < i && currentPage+3 > i || i == pages {
|
||||
var paginationItemRaw = string(paginationLinkRaw)
|
||||
paginationItemRaw := string(paginationLinkRaw)
|
||||
if i == currentPage {
|
||||
paginationItemRaw = string(paginationLinkCurrentRaw)
|
||||
}
|
||||
|
||||
paginationItem := strings.Replace(paginationItemRaw, "{pageNum}", strconv.Itoa(i), -1)
|
||||
paginationItem = strings.Replace(paginationItem, "{paginationLink}", linksBase+strconv.Itoa(i), 1)
|
||||
paginationString += paginationItem
|
||||
@@ -64,7 +68,7 @@ func CreateHTML(currentPage int, pages int, linksBase string) string {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var paginationItemRaw = string(paginationLinkRaw)
|
||||
paginationItemRaw := string(paginationLinkRaw)
|
||||
if i == currentPage {
|
||||
paginationItemRaw = string(paginationLinkCurrentRaw)
|
||||
}
|
||||
@@ -73,7 +77,7 @@ func CreateHTML(currentPage int, pages int, linksBase string) string {
|
||||
paginationString += paginationItem
|
||||
}
|
||||
|
||||
i += 1
|
||||
i++
|
||||
}
|
||||
|
||||
pagination := strings.Replace(string(paginationHTMLRaw), "{paginationLinks}", paginationString, 1)
|
||||
@@ -22,56 +22,64 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package pastesmodel
|
||||
package structs
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
// other
|
||||
"golang.org/x/crypto/scrypt"
|
||||
)
|
||||
|
||||
const (
|
||||
PASTE_KEEP_FOR_MINUTES = 1
|
||||
PASTE_KEEP_FOR_HOURS = 2
|
||||
PASTE_KEEP_FOR_DAYS = 3
|
||||
PASTE_KEEP_FOR_MONTHS = 4
|
||||
// PasteKeepForever indicates that paste should be kept forever.
|
||||
PasteKeepForever = 0
|
||||
// PasteKeepForMinutes indicates that saved timeout is in minutes.
|
||||
PasteKeepForMinutes = 1
|
||||
// PasteKeepForHours indicates that saved timeout is in hours.
|
||||
PasteKeepForHours = 2
|
||||
// PasteKeepForDays indicates that saved timeout is in days.
|
||||
PasteKeepForDays = 3
|
||||
// PasteKeepForMonths indicates that saved timeout is in months.
|
||||
PasteKeepForMonths = 4
|
||||
|
||||
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
)
|
||||
|
||||
var (
|
||||
PASTE_KEEPS_CORELLATION = map[string]int{
|
||||
"M": PASTE_KEEP_FOR_MINUTES,
|
||||
"h": PASTE_KEEP_FOR_HOURS,
|
||||
"d": PASTE_KEEP_FOR_DAYS,
|
||||
"m": PASTE_KEEP_FOR_MONTHS,
|
||||
}
|
||||
)
|
||||
// PasteKeepsCorrelation is a correlation map between database representation
|
||||
// and passed data representation.
|
||||
var PasteKeepsCorrelation = map[string]int{
|
||||
"M": PasteKeepForMinutes,
|
||||
"h": PasteKeepForHours,
|
||||
"d": PasteKeepForDays,
|
||||
"m": PasteKeepForMonths,
|
||||
"forever": PasteKeepForever,
|
||||
}
|
||||
|
||||
// Paste represents paste itself.
|
||||
type Paste struct {
|
||||
ID int `db:"id" json:"id"`
|
||||
CreatedAt *time.Time `db:"created_at" json:"created_at"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Data string `db:"data" json:"data"`
|
||||
CreatedAt *time.Time `db:"created_at" json:"created_at"`
|
||||
KeepFor int `db:"keep_for" json:"keep_for"`
|
||||
KeepForUnitType int `db:"keep_for_unit_type" json:"keep_for_unit_type"`
|
||||
Language string `db:"language" json:"language"`
|
||||
Private bool `db:"private" json:"private"`
|
||||
Password string `db:"password" json:"password"`
|
||||
PasswordSalt string `db:"password_salt" json:"password_salt"`
|
||||
ID int `db:"id" json:"id"`
|
||||
KeepFor int `db:"keep_for" json:"keep_for"`
|
||||
KeepForUnitType int `db:"keep_for_unit_type" json:"keep_for_unit_type"`
|
||||
Private bool `db:"private" json:"private"`
|
||||
}
|
||||
|
||||
// CreatePassword creates password for current paste.
|
||||
func (p *Paste) CreatePassword(password string) error {
|
||||
// Create salt - random string.
|
||||
// Yes, it is insecure. Should be refactored!
|
||||
// nolint:gosec
|
||||
seededRand := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
saltBytes := make([]byte, 64)
|
||||
|
||||
for i := range saltBytes {
|
||||
saltBytes[i] = charset[seededRand.Intn(len(charset))]
|
||||
}
|
||||
@@ -82,8 +90,10 @@ func (p *Paste) CreatePassword(password string) error {
|
||||
// Create crypted password and hash it.
|
||||
passwordCrypted, err := scrypt.Key([]byte(password), []byte(p.PasswordSalt), 131072, 8, 1, 64)
|
||||
if err != nil {
|
||||
// nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
passwordHashBytes := sha256.Sum256(passwordCrypted)
|
||||
p.Password = fmt.Sprintf("%x", passwordHashBytes)
|
||||
|
||||
@@ -93,19 +103,23 @@ func (p *Paste) CreatePassword(password string) error {
|
||||
// GenerateCryptedCookieValue generates crypted cookie value for paste.
|
||||
func (p *Paste) GenerateCryptedCookieValue() string {
|
||||
cookieValueCrypted, _ := scrypt.Key([]byte(p.Password), []byte(p.PasswordSalt), 131072, 8, 1, 64)
|
||||
|
||||
return fmt.Sprintf("%x", sha256.Sum256(cookieValueCrypted))
|
||||
}
|
||||
|
||||
func (p *Paste) GetExpirationTime() time.Time {
|
||||
var expirationTime time.Time
|
||||
|
||||
switch p.KeepForUnitType {
|
||||
case PASTE_KEEP_FOR_MINUTES:
|
||||
case PasteKeepForever:
|
||||
expirationTime = time.Now().UTC().Add(time.Hour * 1)
|
||||
case PasteKeepForMinutes:
|
||||
expirationTime = p.CreatedAt.Add(time.Minute * time.Duration(p.KeepFor))
|
||||
case PASTE_KEEP_FOR_HOURS:
|
||||
case PasteKeepForHours:
|
||||
expirationTime = p.CreatedAt.Add(time.Hour * time.Duration(p.KeepFor))
|
||||
case PASTE_KEEP_FOR_DAYS:
|
||||
case PasteKeepForDays:
|
||||
expirationTime = p.CreatedAt.Add(time.Hour * 24 * time.Duration(p.KeepFor))
|
||||
case PASTE_KEEP_FOR_MONTHS:
|
||||
case PasteKeepForMonths:
|
||||
expirationTime = p.CreatedAt.Add(time.Hour * 24 * 30 * time.Duration(p.KeepFor))
|
||||
}
|
||||
|
||||
@@ -117,11 +131,7 @@ func (p *Paste) IsExpired() bool {
|
||||
curTime := time.Now().UTC()
|
||||
expirationTime := p.GetExpirationTime()
|
||||
|
||||
if curTime.Sub(expirationTime).Seconds() > 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return curTime.Sub(expirationTime).Seconds() > 0
|
||||
}
|
||||
|
||||
// VerifyPassword verifies that provided password is valid.
|
||||
@@ -131,12 +141,9 @@ func (p *Paste) VerifyPassword(password string) bool {
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
passwordHashBytes := sha256.Sum256(passwordCrypted)
|
||||
providedPassword := fmt.Sprintf("%x", passwordHashBytes)
|
||||
|
||||
if providedPassword == p.Password {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return providedPassword == p.Password
|
||||
}
|
||||
@@ -25,20 +25,18 @@
|
||||
package templater
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/api/http/static"
|
||||
"github.com/pztrn/fastpastebin/context"
|
||||
|
||||
// other
|
||||
"github.com/labstack/echo"
|
||||
"github.com/rs/zerolog"
|
||||
"go.dev.pztrn.name/fastpastebin/assets"
|
||||
"go.dev.pztrn.name/fastpastebin/internal/context"
|
||||
)
|
||||
|
||||
var (
|
||||
c *context.Context
|
||||
c *context.Context
|
||||
log zerolog.Logger
|
||||
)
|
||||
|
||||
// GetErrorTemplate returns formatted error template.
|
||||
@@ -52,11 +50,12 @@ func GetErrorTemplate(ec echo.Context, errorText string) string {
|
||||
}
|
||||
|
||||
// GetRawTemplate returns only raw template data.
|
||||
func GetRawTemplate(ec echo.Context, templateName string, data map[string]string) string {
|
||||
func GetRawTemplate(ectx echo.Context, templateName string, data map[string]string) string {
|
||||
// Getting main template.
|
||||
tplRaw, err := static.ReadFile(templateName)
|
||||
tplRaw, err := assets.Data.ReadFile(templateName)
|
||||
if err != nil {
|
||||
ec.String(http.StatusBadRequest, templateName+" not found.")
|
||||
_ = ectx.String(http.StatusBadRequest, templateName+" not found.")
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -70,27 +69,30 @@ func GetRawTemplate(ec echo.Context, templateName string, data map[string]string
|
||||
}
|
||||
|
||||
// GetTemplate returns formatted template that can be outputted to client.
|
||||
func GetTemplate(ec echo.Context, name string, data map[string]string) string {
|
||||
c.Logger.Debug().Msgf("Requested template '%s'", name)
|
||||
func GetTemplate(ectx echo.Context, name string, data map[string]string) string {
|
||||
log.Debug().Str("name", name).Msg("Requested template")
|
||||
|
||||
// Getting main template.
|
||||
mainhtml, err := static.ReadFile("main.html")
|
||||
mainhtml, err := assets.Data.ReadFile("main.html")
|
||||
if err != nil {
|
||||
ec.String(http.StatusBadRequest, "main.html not found.")
|
||||
_ = ectx.String(http.StatusBadRequest, "main.html not found.")
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// Getting navigation.
|
||||
navhtml, err1 := static.ReadFile("navigation.html")
|
||||
navhtml, err1 := assets.Data.ReadFile("navigation.html")
|
||||
if err1 != nil {
|
||||
ec.String(http.StatusBadRequest, "navigation.html not found.")
|
||||
_ = ectx.String(http.StatusBadRequest, "navigation.html not found.")
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// Getting footer.
|
||||
footerhtml, err2 := static.ReadFile("footer.html")
|
||||
footerhtml, err2 := assets.Data.ReadFile("footer.html")
|
||||
if err2 != nil {
|
||||
ec.String(http.StatusBadRequest, "footer.html not found.")
|
||||
_ = ectx.String(http.StatusBadRequest, "footer.html not found.")
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -101,9 +103,10 @@ func GetTemplate(ec echo.Context, name string, data map[string]string) string {
|
||||
tpl = strings.Replace(tpl, "{version}", context.Version, 1)
|
||||
|
||||
// Get requested template.
|
||||
reqhtml, err3 := static.ReadFile(name)
|
||||
reqhtml, err3 := assets.Data.ReadFile(name)
|
||||
if err3 != nil {
|
||||
ec.String(http.StatusBadRequest, name+" not found.")
|
||||
_ = ectx.String(http.StatusBadRequest, name+" not found.")
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -121,4 +124,5 @@ func GetTemplate(ec echo.Context, name string, data map[string]string) string {
|
||||
// Initialize initializes package.
|
||||
func Initialize(cc *context.Context) {
|
||||
c = cc
|
||||
log = c.Logger.With().Str("type", "internal").Str("package", "templater").Logger()
|
||||
}
|
||||
@@ -1,449 +0,0 @@
|
||||
// Fast Paste Bin - uberfast and easy-to-use pastebin.
|
||||
//
|
||||
// Copyright (c) 2018, Stanislav N. aka pztrn and Fast Paste Bin
|
||||
// developers.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject
|
||||
// to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package pastes
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"bytes"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/fastpastebin/captcha"
|
||||
"github.com/pztrn/fastpastebin/pagination"
|
||||
"github.com/pztrn/fastpastebin/pastes/model"
|
||||
"github.com/pztrn/fastpastebin/templater"
|
||||
|
||||
// other
|
||||
"github.com/alecthomas/chroma"
|
||||
"github.com/alecthomas/chroma/formatters"
|
||||
htmlfmt "github.com/alecthomas/chroma/formatters/html"
|
||||
"github.com/alecthomas/chroma/lexers"
|
||||
"github.com/alecthomas/chroma/styles"
|
||||
//"github.com/dchest/captcha"
|
||||
"github.com/labstack/echo"
|
||||
)
|
||||
|
||||
var (
|
||||
regexInts = regexp.MustCompile("[0-9]+")
|
||||
)
|
||||
|
||||
// GET for "/paste/PASTE_ID" and "/paste/PASTE_ID/TIMESTAMP" (private pastes).
|
||||
func pasteGET(ec echo.Context) error {
|
||||
pasteIDRaw := ec.Param("id")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
c.Logger.Debug().Msgf("Requesting paste #%+v", pasteID)
|
||||
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Msgf("Failed to get paste #%d: %s", pasteID, err1.Error())
|
||||
errtpl := templater.GetErrorTemplate(ec, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
if paste.IsExpired() {
|
||||
c.Logger.Error().Msgf("Paste #%d is expired", pasteID)
|
||||
errtpl := templater.GetErrorTemplate(ec, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
// Check if we have a private paste and it's parameters are correct.
|
||||
if paste.Private {
|
||||
tsProvidedStr := ec.Param("timestamp")
|
||||
tsProvided, err2 := strconv.ParseInt(tsProvidedStr, 10, 64)
|
||||
if err2 != nil {
|
||||
c.Logger.Error().Msgf("Invalid timestamp '%s' provided for getting private paste #%d: %s", tsProvidedStr, pasteID, err2.Error())
|
||||
errtpl := templater.GetErrorTemplate(ec, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
pasteTs := paste.CreatedAt.Unix()
|
||||
if tsProvided != pasteTs {
|
||||
c.Logger.Error().Msgf("Incorrect timestamp '%v' provided for private paste #%d, waiting for %v", tsProvidedStr, pasteID, strconv.FormatInt(pasteTs, 10))
|
||||
errtpl := templater.GetErrorTemplate(ec, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
}
|
||||
|
||||
if paste.Private && paste.Password != "" {
|
||||
// Check if cookie for this paste is defined. This means that user
|
||||
// previously successfully entered a password.
|
||||
cookie, err := ec.Cookie("PASTE-" + strconv.Itoa(pasteID))
|
||||
if err != nil {
|
||||
// No cookie, redirect to auth page.
|
||||
c.Logger.Info().Msg("Tried to access passworded paste without autorization, redirecting to auth page...")
|
||||
return ec.Redirect(http.StatusMovedPermanently, "/paste/"+pasteIDRaw+"/"+ec.Param("timestamp")+"/verify")
|
||||
}
|
||||
|
||||
// Generate cookie value to check.
|
||||
cookieValue := paste.GenerateCryptedCookieValue()
|
||||
|
||||
if cookieValue != cookie.Value {
|
||||
c.Logger.Info().Msg("Invalid cookie, redirecting to auth page...")
|
||||
return ec.Redirect(http.StatusMovedPermanently, "/paste/"+pasteIDRaw+"/"+ec.Param("timestamp")+"/verify")
|
||||
}
|
||||
|
||||
// If all okay - do nothing :)
|
||||
}
|
||||
|
||||
// Format paste data map.
|
||||
pasteData := make(map[string]string)
|
||||
pasteData["pasteTitle"] = paste.Title
|
||||
pasteData["pasteID"] = strconv.Itoa(paste.ID)
|
||||
pasteData["pasteDate"] = paste.CreatedAt.Format("2006-01-02 @ 15:04:05") + " UTC"
|
||||
pasteData["pasteExpiration"] = paste.GetExpirationTime().Format("2006-01-02 @ 15:04:05") + " UTC"
|
||||
pasteData["pasteLanguage"] = paste.Language
|
||||
|
||||
if paste.Private {
|
||||
pasteData["pasteType"] = "<span class='has-text-danger'>Private</span>"
|
||||
pasteData["pasteTs"] = strconv.FormatInt(paste.CreatedAt.Unix(), 10) + "/"
|
||||
} else {
|
||||
pasteData["pasteType"] = "<span class='has-text-success'>Public</span>"
|
||||
pasteData["pasteTs"] = ""
|
||||
}
|
||||
|
||||
// Highlight.
|
||||
// Get lexer.
|
||||
lexer := lexers.Get(paste.Language)
|
||||
if lexer == nil {
|
||||
lexer = lexers.Fallback
|
||||
}
|
||||
// Tokenize paste data.
|
||||
lexered, err3 := lexer.Tokenise(nil, paste.Data)
|
||||
if err3 != nil {
|
||||
c.Logger.Error().Msgf("Failed to tokenize paste data: %s", err3.Error())
|
||||
}
|
||||
// Get style for HTML output.
|
||||
style := styles.Get("monokai")
|
||||
if style == nil {
|
||||
style = styles.Fallback
|
||||
}
|
||||
// Get HTML formatter.
|
||||
formatter := chroma.Formatter(htmlfmt.New(htmlfmt.WithLineNumbers(), htmlfmt.LineNumbersInTable()))
|
||||
if formatter == nil {
|
||||
formatter = formatters.Fallback
|
||||
}
|
||||
// Create buffer and format into it.
|
||||
buf := new(bytes.Buffer)
|
||||
err4 := formatter.Format(buf, style, lexered)
|
||||
if err4 != nil {
|
||||
c.Logger.Error().Msgf("Failed to format paste data: %s", err4.Error())
|
||||
}
|
||||
pasteData["pastedata"] = buf.String()
|
||||
|
||||
// Get template and format it.
|
||||
pasteHTML := templater.GetTemplate(ec, "paste.html", pasteData)
|
||||
|
||||
return ec.HTML(http.StatusOK, pasteHTML)
|
||||
}
|
||||
|
||||
// GET for "/paste/PASTE_ID/TIMESTAMP/verify" - a password verify page.
|
||||
func pastePasswordedVerifyGet(ec echo.Context) error {
|
||||
pasteIDRaw := ec.Param("id")
|
||||
timestampRaw := ec.Param("timestamp")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Msgf("Failed to get paste #%d: %s", pasteID, err1.Error())
|
||||
errtpl := templater.GetErrorTemplate(ec, "Paste #"+pasteIDRaw+" not found")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
// Check for auth cookie. If present - redirect to paste.
|
||||
cookie, err := ec.Cookie("PASTE-" + strconv.Itoa(pasteID))
|
||||
if err == nil {
|
||||
// No cookie, redirect to auth page.
|
||||
c.Logger.Debug().Msg("Paste cookie found, checking it...")
|
||||
|
||||
// Generate cookie value to check.
|
||||
cookieValue := paste.GenerateCryptedCookieValue()
|
||||
|
||||
if cookieValue == cookie.Value {
|
||||
c.Logger.Info().Msg("Valid cookie, redirecting to paste page...")
|
||||
return ec.Redirect(http.StatusMovedPermanently, "/paste/"+pasteIDRaw+"/"+ec.Param("timestamp"))
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msg("Invalid cookie, showing auth page")
|
||||
}
|
||||
|
||||
// HTML data.
|
||||
htmlData := make(map[string]string)
|
||||
htmlData["pasteID"] = strconv.Itoa(pasteID)
|
||||
htmlData["pasteTimestamp"] = timestampRaw
|
||||
|
||||
verifyHTML := templater.GetTemplate(ec, "passworded_paste_verify.html", htmlData)
|
||||
|
||||
return ec.HTML(http.StatusOK, verifyHTML)
|
||||
}
|
||||
|
||||
// POST for "/paste/PASTE_ID/TIMESTAMP/verify" - a password verify page.
|
||||
func pastePasswordedVerifyPost(ec echo.Context) error {
|
||||
pasteIDRaw := ec.Param("id")
|
||||
timestampRaw := ec.Param("timestamp")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
c.Logger.Debug().Msgf("Requesting paste #%+v", pasteID)
|
||||
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Msgf("Failed to get paste #%d: %s", pasteID, err1.Error())
|
||||
errtpl := templater.GetErrorTemplate(ec, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
params, err2 := ec.FormParams()
|
||||
if err2 != nil {
|
||||
c.Logger.Debug().Msg("No form parameters passed")
|
||||
errtpl := templater.GetErrorTemplate(ec, "Paste #"+strconv.Itoa(pasteID)+" not found")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
if paste.VerifyPassword(params["paste-password"][0]) {
|
||||
// Set cookie that this paste's password is verified and paste
|
||||
// can be viewed.
|
||||
cookie := new(http.Cookie)
|
||||
cookie.Name = "PASTE-" + strconv.Itoa(pasteID)
|
||||
cookie.Value = paste.GenerateCryptedCookieValue()
|
||||
cookie.Expires = time.Now().Add(24 * time.Hour)
|
||||
ec.SetCookie(cookie)
|
||||
|
||||
return ec.Redirect(http.StatusFound, "/paste/"+strconv.Itoa(pasteID)+"/"+timestampRaw)
|
||||
}
|
||||
|
||||
errtpl := templater.GetErrorTemplate(ec, "Invalid password. Please, try again.")
|
||||
return ec.HTML(http.StatusBadRequest, string(errtpl))
|
||||
}
|
||||
|
||||
// POST for "/paste/" which will create new paste and redirect to
|
||||
// "/pastes/CREATED_PASTE_ID".
|
||||
func pastePOST(ec echo.Context) error {
|
||||
params, err := ec.FormParams()
|
||||
if err != nil {
|
||||
errtpl := templater.GetErrorTemplate(ec, "Cannot create empty paste")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
c.Logger.Debug().Msgf("Received parameters: %+v", params)
|
||||
|
||||
// Do nothing if paste contents is empty.
|
||||
if len(params["paste-contents"][0]) == 0 {
|
||||
c.Logger.Debug().Msg("Empty paste submitted, ignoring")
|
||||
errtpl := templater.GetErrorTemplate(ec, "Empty pastes aren't allowed.")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
if !strings.ContainsAny(params["paste-keep-for"][0], "Mmhd") {
|
||||
c.Logger.Debug().Msgf("'Keep paste for' field have invalid value: %s", params["paste-keep-for"][0])
|
||||
errtpl := templater.GetErrorTemplate(ec, "Invalid 'Paste should be available for' parameter passed. Please do not try to hack us ;).")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
// Verify captcha.
|
||||
if !captcha.Verify(params["paste-captcha-id"][0], params["paste-captcha-solution"][0]) {
|
||||
c.Logger.Debug().Msgf("Invalid captcha solution for captcha ID '%s': %s", params["paste-captcha-id"][0], params["paste-captcha-solution"][0])
|
||||
errtpl := templater.GetErrorTemplate(ec, "Invalid captcha solution.")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
paste := &pastesmodel.Paste{
|
||||
Title: params["paste-title"][0],
|
||||
Data: params["paste-contents"][0],
|
||||
Language: params["paste-language"][0],
|
||||
}
|
||||
|
||||
// Paste creation time in UTC.
|
||||
createdAt := time.Now().UTC()
|
||||
paste.CreatedAt = &createdAt
|
||||
|
||||
// Parse "keep for" field.
|
||||
|
||||
// Get integers and strings separately.
|
||||
keepForUnitRegex := regexp.MustCompile("[Mmhd]")
|
||||
|
||||
keepForRaw := regexInts.FindAllString(params["paste-keep-for"][0], 1)[0]
|
||||
keepFor, err1 := strconv.Atoi(keepForRaw)
|
||||
if err1 != nil {
|
||||
c.Logger.Debug().Msgf("Failed to parse 'Keep for' integer: %s", err1.Error())
|
||||
errtpl := templater.GetErrorTemplate(ec, "Invalid 'Paste should be available for' parameter passed. Please do not try to hack us ;).")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
paste.KeepFor = keepFor
|
||||
|
||||
keepForUnitRaw := keepForUnitRegex.FindAllString(params["paste-keep-for"][0], 1)[0]
|
||||
keepForUnit := pastesmodel.PASTE_KEEPS_CORELLATION[keepForUnitRaw]
|
||||
paste.KeepForUnitType = keepForUnit
|
||||
|
||||
// Try to autodetect if it was selected.
|
||||
if params["paste-language"][0] == "autodetect" {
|
||||
lexer := lexers.Analyse(params["paste-language"][0])
|
||||
if lexer != nil {
|
||||
paste.Language = lexer.Config().Name
|
||||
} else {
|
||||
paste.Language = "text"
|
||||
}
|
||||
}
|
||||
|
||||
// Private paste?
|
||||
paste.Private = false
|
||||
privateCheckbox, privateCheckboxFound := params["paste-private"]
|
||||
pastePassword, pastePasswordFound := params["paste-password"]
|
||||
if privateCheckboxFound && privateCheckbox[0] == "on" || pastePasswordFound && pastePassword[0] != "" {
|
||||
paste.Private = true
|
||||
}
|
||||
|
||||
if pastePassword[0] != "" {
|
||||
paste.CreatePassword(pastePassword[0])
|
||||
}
|
||||
|
||||
id, err2 := c.Database.SavePaste(paste)
|
||||
if err2 != nil {
|
||||
c.Logger.Debug().Msgf("Failed to save paste: %s", err2.Error())
|
||||
errtpl := templater.GetErrorTemplate(ec, "Failed to save paste. Please, try again later.")
|
||||
return ec.HTML(http.StatusBadRequest, errtpl)
|
||||
}
|
||||
|
||||
newPasteIDAsString := strconv.FormatInt(id, 10)
|
||||
c.Logger.Debug().Msgf("Paste saved, URL: /paste/" + newPasteIDAsString)
|
||||
|
||||
// Private pastes have it's timestamp in URL.
|
||||
if paste.Private {
|
||||
return ec.Redirect(http.StatusFound, "/paste/"+newPasteIDAsString+"/"+strconv.FormatInt(paste.CreatedAt.Unix(), 10))
|
||||
}
|
||||
|
||||
return ec.Redirect(http.StatusFound, "/paste/"+newPasteIDAsString)
|
||||
}
|
||||
|
||||
// GET for "/pastes/:id/raw", raw paste output.
|
||||
func pasteRawGET(ec echo.Context) error {
|
||||
pasteIDRaw := ec.Param("id")
|
||||
// We already get numbers from string, so we will not check strconv.Atoi()
|
||||
// error.
|
||||
pasteID, _ := strconv.Atoi(regexInts.FindAllString(pasteIDRaw, 1)[0])
|
||||
c.Logger.Debug().Msgf("Requesting paste #%+v", pasteID)
|
||||
|
||||
// Get paste.
|
||||
paste, err1 := c.Database.GetPaste(pasteID)
|
||||
if err1 != nil {
|
||||
c.Logger.Error().Msgf("Failed to get paste #%d from database: %s", pasteID, err1.Error())
|
||||
return ec.HTML(http.StatusBadRequest, "Paste #"+pasteIDRaw+" does not exist.")
|
||||
}
|
||||
|
||||
if paste.IsExpired() {
|
||||
c.Logger.Error().Msgf("Paste #%d is expired", pasteID)
|
||||
return ec.HTML(http.StatusBadRequest, "Paste #"+pasteIDRaw+" does not exist.")
|
||||
}
|
||||
|
||||
// Check if we have a private paste and it's parameters are correct.
|
||||
if paste.Private {
|
||||
tsProvidedStr := ec.Param("timestamp")
|
||||
tsProvided, err2 := strconv.ParseInt(tsProvidedStr, 10, 64)
|
||||
if err2 != nil {
|
||||
c.Logger.Error().Msgf("Invalid timestamp '%s' provided for getting private paste #%d: %s", tsProvidedStr, pasteID, err2.Error())
|
||||
return ec.String(http.StatusBadRequest, "Paste #"+pasteIDRaw+" not found")
|
||||
}
|
||||
pasteTs := paste.CreatedAt.Unix()
|
||||
if tsProvided != pasteTs {
|
||||
c.Logger.Error().Msgf("Incorrect timestamp '%v' provided for private paste #%d, waiting for %v", tsProvidedStr, pasteID, strconv.FormatInt(pasteTs, 10))
|
||||
return ec.String(http.StatusBadRequest, "Paste #"+pasteIDRaw+" not found")
|
||||
}
|
||||
}
|
||||
|
||||
// ToDo: figure out how to handle passworded pastes here.
|
||||
// Return error for now.
|
||||
if paste.Password != "" {
|
||||
c.Logger.Error().Msgf("Cannot render paste #%d as raw: passworded paste. Patches welcome!", pasteID)
|
||||
return ec.String(http.StatusBadRequest, "Paste #"+pasteIDRaw+" not found")
|
||||
}
|
||||
|
||||
return ec.String(http.StatusOK, paste.Data)
|
||||
}
|
||||
|
||||
// GET for "/pastes/", a list of publicly available pastes.
|
||||
func pastesGET(ec echo.Context) error {
|
||||
pageFromParamRaw := ec.Param("page")
|
||||
var page = 1
|
||||
if pageFromParamRaw != "" {
|
||||
pageRaw := regexInts.FindAllString(pageFromParamRaw, 1)[0]
|
||||
page, _ = strconv.Atoi(pageRaw)
|
||||
}
|
||||
|
||||
c.Logger.Debug().Msgf("Requested page #%d", page)
|
||||
|
||||
// Get pastes IDs.
|
||||
pastes, err3 := c.Database.GetPagedPastes(page)
|
||||
c.Logger.Debug().Msgf("Got %d pastes", len(pastes))
|
||||
|
||||
var pastesString = "No pastes to show."
|
||||
|
||||
// Show "No pastes to show" on any error for now.
|
||||
if err3 != nil {
|
||||
c.Logger.Error().Msgf("Failed to get pastes list from database: %s", err3.Error())
|
||||
noPastesToShowTpl := templater.GetErrorTemplate(ec, "No pastes to show.")
|
||||
return ec.HTML(http.StatusOK, noPastesToShowTpl)
|
||||
}
|
||||
|
||||
if len(pastes) > 0 {
|
||||
pastesString = ""
|
||||
for i := range pastes {
|
||||
pasteDataMap := make(map[string]string)
|
||||
pasteDataMap["pasteID"] = strconv.Itoa(pastes[i].ID)
|
||||
pasteDataMap["pasteTitle"] = pastes[i].Title
|
||||
pasteDataMap["pasteDate"] = pastes[i].CreatedAt.Format("2006-01-02 @ 15:04:05") + " UTC"
|
||||
|
||||
// Get max 4 lines of each paste.
|
||||
pasteDataSplitted := strings.Split(pastes[i].Data, "\n")
|
||||
var pasteData = ""
|
||||
if len(pasteDataSplitted) < 4 {
|
||||
pasteData = pastes[i].Data
|
||||
} else {
|
||||
pasteData = strings.Join(pasteDataSplitted[0:4], "\n")
|
||||
}
|
||||
|
||||
pasteDataMap["pasteData"] = pasteData
|
||||
pasteTpl := templater.GetRawTemplate(ec, "pastelist_paste.html", pasteDataMap)
|
||||
|
||||
pastesString += pasteTpl
|
||||
}
|
||||
}
|
||||
|
||||
// Pagination.
|
||||
pages := c.Database.GetPastesPages()
|
||||
c.Logger.Debug().Msgf("Total pages: %d, current: %d", pages, page)
|
||||
paginationHTML := pagination.CreateHTML(page, pages, "/pastes/")
|
||||
|
||||
pasteListTpl := templater.GetTemplate(ec, "pastelist_list.html", map[string]string{"pastes": pastesString, "pagination": paginationHTML})
|
||||
|
||||
return ec.HTML(http.StatusOK, string(pasteListTpl))
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
/cmd/chroma/chroma
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
|
||||
.glide/
|
||||
|
||||
_models/
|
||||
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
project_name: chroma
|
||||
release:
|
||||
github:
|
||||
owner: alecthomas
|
||||
name: chroma
|
||||
brew:
|
||||
install: bin.install "chroma"
|
||||
builds:
|
||||
- goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- "386"
|
||||
goarm:
|
||||
- "6"
|
||||
main: ./cmd/chroma/main.go
|
||||
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
||||
binary: chroma
|
||||
archive:
|
||||
format: tar.gz
|
||||
name_template: '{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{
|
||||
.Arm }}{{ end }}'
|
||||
files:
|
||||
- COPYING
|
||||
- README*
|
||||
snapshot:
|
||||
name_template: SNAPSHOT-{{ .Commit }}
|
||||
checksum:
|
||||
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'
|
||||
Loaded 100 of 813 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user