Compare commits

...

45 Commits

Author SHA1 Message Date
Stanislav Nikitin a0f896dc53
CI config update. 2 years ago
Stanislav Nikitin fa7a79310d
Assets update. 2 years ago
Stanislav Nikitin ce962ddd00
Version bump. 2 years ago
Stanislav Nikitin 164a37d41f
A pretty basic pastes cleanup procedure. 2 years ago
Stanislav Nikitin 3ebff29113
Linting fixes about struct alignment. 2 years ago
Stanislav Nikitin 7f04a9a7bb
Typo fix and missed dependencies files. 2 years ago
Stanislav Nikitin a2a21482e2
Dependencies update and fix for line linking. 2 years ago
Stanislav Nikitin ffb42f43eb
README update. 3 years ago
Stanislav Nikitin 3f9801b1bd
Update chroma and make line numbers linkable. 3 years ago
Stanislav Nikitin 825fd724ff
Some logging refactoring. 3 years ago
Stanislav Nikitin 5f58741159
Added maximum request body size limiting. 3 years ago
Stanislav Nikitin 47672c586d
Linter configuration fixes and linting issues fixes. 3 years ago
Stanislav Nikitin 11897d0e1a
Drone CI recipe fix. 3 years ago
Stanislav Nikitin 02cea49fc4 Merge branch 'linting' of fastpastebin/fastpastebin into master 3 years ago
Stanislav Nikitin a52b18ffe4
Linting. 3 years ago
Stanislav Nikitin da4bc379d8
Typo in commend and switching to discordrone for notifications. 3 years ago
Stanislav Nikitin 9c9f0c1f68 Merge branch 'linting' of fastpastebin/fastpastebin into master 3 years ago
Stanislav Nikitin 6a787e7e23
Linting things. 3 years ago
Stanislav Nikitin cdc8ecf49b Merge branch 'readme-update' of fastpastebin/fastpastebin into master 3 years ago
Stanislav Nikitin bd981023da
README update. 3 years ago
Stanislav Nikitin a982e07faf Fixed improper tooltip (popups) rendering. Fixes #8. (#11) 3 years ago
Stanislav Nikitin 0bbb415852
Drone pipelines update. 3 years ago
Vladimir Hodakov 6207229e9b Move to Go modules (#10) 3 years ago
Stanislav Nikitin 2159aadfcb
Fixed Safari stuck when clicking on dropdowns by updating Bulma. 3 years ago
Stanislav Nikitin 3ebf9b653e
Put docker image into approriate repo. Related to #6. 3 years ago
Stanislav Nikitin 4d60a9b1b6
Switching to Drone CI and giredore. 3 years ago
Stanislav Nikitin e042c4414f
Moved from gitlab.com to Gitea with giredore. 3 years ago
Stanislav Nikitin 333fc1d12a
CI configuration. 3 years ago
Stanislav Nikitin 7f2174a33e
Moved Dockerfile and docker-compose.yml to top directory. 3 years ago
Stanislav Nikitin e26a466efc Merge branch 'feature/docker' into 'master' 3 years ago
Timur Demin d9a46aa5b3
Make changes proposed by @pztrn 3 years ago
Timur Demin dbf82e213b
Dockerize the app 3 years ago
Stanislav Nikitin 4f01e2f5ce
Logger refactoring, part 1. 4 years ago
Stanislav Nikitin 7281b9be65
Refactoring for pastes domain for code reusing and better structuring. 4 years ago
Stanislav Nikitin 19b5ef3d9f
Fastfix for previous two commits (sorry) and chroma update. 4 years ago
Stanislav Nikitin 3fe51fc6c5
Dependencies update and database not available crash fix. 4 years ago
Stanislav Nikitin 19a3a5004c
The Huge Refactoring. 4 years ago
Stanislav Nikitin 0bf20cd2c9
Assets update. 4 years ago
Stanislav Nikitin 35c217fe46
Builder script and gitignore update. 4 years ago
Stanislav Nikitin 849c72b238
Version bump. 4 years ago
Stanislav Nikitin c565ec8f21 Fixed timezone things with postgresql and made "Forever" work. 4 years ago
Stanislav Nikitin aa5e11329f PostgreSQL support. 4 years ago
Stanislav Nikitin b6556d6e90 Moved database migrations for MySQL dialect into approriate package. 4 years ago
Stanislav Nikitin 400ce0db0c Quick and dirty fix to get database connection reestablish if connection was lost. 4 years ago
Stanislav Nikitin fc8f4e9d8b Switch to Gitlab. 4 years ago
  1. 69
      .drone.yml
  2. 7
      .gitignore
  3. 31
      .gitlab-ci.yml
  4. 21
      .golangci.yml
  5. 17
      Dockerfile
  6. 187
      Gopkg.lock
  7. 34
      Gopkg.toml
  8. 69
      README.md
  9. 35
      api/http/static/b0xfile_static_css_bulma-0.7.0.min.css.go
  10. 35
      api/http/static/b0xfile_static_css_bulma-tooltip-1.0.4.min.css.go
  11. 35
      api/http/static/b0xfile_static_css_bulma.css.map.go
  12. 1
      assets/css/bulma-0.7.0.min.css
  13. 1
      assets/css/bulma-0.7.5.min.css
  14. 1
      assets/css/bulma-tooltip-1.0.4.min.css
  15. 1
      assets/css/bulma-tooltip-3.0.0.min.css
  16. 2
      assets/css/bulma.css.map
  17. 5
      assets/css/style.css
  18. 6
      assets/database_not_available.html
  19. 4
      assets/footer.html
  20. 3
      assets/index.html
  21. 4
      assets/main.html
  22. 21
      assets/static/ab0x.go
  23. 35
      assets/static/b0xfile__database_not_available.html.go
  24. 4
      assets/static/b0xfile__error.html.go
  25. 6
      assets/static/b0xfile__footer.html.go
  26. 6
      assets/static/b0xfile__index.html.go
  27. 6
      assets/static/b0xfile__main.html.go
  28. 4
      assets/static/b0xfile__navigation.html.go
  29. 4
      assets/static/b0xfile__pagination.html.go
  30. 4
      assets/static/b0xfile__pagination_ellipsis.html.go
  31. 4
      assets/static/b0xfile__pagination_link.html.go
  32. 4
      assets/static/b0xfile__pagination_link_current.html.go
  33. 4
      assets/static/b0xfile__passworded_paste_verify.html.go
  34. 4
      assets/static/b0xfile__paste.html.go
  35. 4
      assets/static/b0xfile__pastelist_list.html.go
  36. 4
      assets/static/b0xfile__pastelist_paste.html.go
  37. 35
      assets/static/b0xfile_static_css_bulma-0.7.5.min.css.go
  38. 35
      assets/static/b0xfile_static_css_bulma-tooltip-3.0.0.min.css.go
  39. 35
      assets/static/b0xfile_static_css_bulma.css.map.go
  40. 6
      assets/static/b0xfile_static_css_style.css.go
  41. 4
      assets/static/b0xfile_static_js_fontawesome-5.0.7.js.go
  42. 26
      builder.sh
  43. 24
      cmd/fastpastebin/fastpastebin.go
  44. 37
      docker-compose.yml
  45. 22
      docker/fastpastebin.docker.yaml
  46. 10
      docker/nginx.conf
  47. 7
      docker/set_docker_tag.sh
  48. 28
      domains/dbnotavailable/dbnotavailable.go
  49. 43
      domains/dbnotavailable/exported.go
  50. 10
      domains/indexpage/exported.go
  51. 12
      domains/indexpage/indexpage.go
  52. 27
      domains/pastes/exported.go
  53. 337
      domains/pastes/paste_get.go
  54. 153
      domains/pastes/paste_post.go
  55. 111
      domains/pastes/pastes_get.go
  56. 8
      examples/fastpastebin.yaml.dist
  57. 7
      fileb0x.yml
  58. 21
      go.mod
  59. 107
      go.sum
  60. 14
      internal/captcha/exported.go
  61. 4
      internal/config/database.go
  62. 11
      internal/config/http.go
  63. 4
      internal/config/logging.go
  64. 4
      internal/config/pastes.go
  65. 12
      internal/config/struct.go
  66. 49
      internal/context/context.go
  67. 2
      internal/context/exported.go
  68. 47
      internal/context/http_server.go
  69. 80
      internal/context/logger.go
  70. 62
      internal/database/database.go
  71. 5
      internal/database/dialects/flatfiles/exported.go
  72. 137
      internal/database/dialects/flatfiles/flatfiles.go
  73. 12
      internal/database/dialects/flatfiles/handler.go
  74. 0
      internal/database/dialects/flatfiles/index.go
  75. 9
      internal/database/dialects/interface/dialectinterface.go
  76. 5
      internal/database/dialects/mysql/exported.go
  77. 12
      internal/database/dialects/mysql/handler.go
  78. 9
      internal/database/dialects/mysql/migrations/1_initial.go
  79. 0
      internal/database/dialects/mysql/migrations/2_paste_lang.go
  80. 0
      internal/database/dialects/mysql/migrations/3_private_pastes.go
  81. 0
      internal/database/dialects/mysql/migrations/4_passworded_pastes.go
  82. 6
      internal/database/dialects/mysql/migrations/exported.go
  83. 88
      internal/database/dialects/mysql/mysqldatabase.go
  84. 43
      internal/database/dialects/postgresql/exported.go
  85. 67
      internal/database/dialects/postgresql/handler.go
  86. 56
      internal/database/dialects/postgresql/migrations/1_initial.go
  87. 48
      internal/database/dialects/postgresql/migrations/2_paste_lang.go
  88. 48
      internal/database/dialects/postgresql/migrations/3_private_pastes.go
  89. 45
      internal/database/dialects/postgresql/migrations/4_passworded_pastes.go
  90. 52
      internal/database/dialects/postgresql/migrations/exported.go
  91. 222
      internal/database/dialects/postgresql/postgresqldatabase.go
  92. 5
      internal/database/exported.go
  93. 15
      internal/database/handler.go
  94. 11
      internal/database/interface/databaseinterface.go
  95. 18
      internal/pagination/exported.go
  96. 62
      internal/structs/paste.go
  97. 21
      internal/templater/exported.go
  98. 449
      pastes/api_http.go
  99. 1
      vendor/github.com/alecthomas/chroma/.gitignore
  100. 55
      vendor/github.com/alecthomas/chroma/.golangci.yml
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,69 @@
---
kind: pipeline
type: docker
name: build
steps:
- name: notify-start
image: pztrn/discordrone
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_secret
message: 'Starting building **{{repo.name}}#{{build.number}}@{{commit.sha}}** @ {{datetime build.started "02-Jan-2006 15:04:05 MST" "Asia/Yekaterinburg"}} (See {{build.link}} for logs).'
- name: lint
image: golangci/golangci-lint:latest
environment:
GOFLAGS: -mod=vendor
CGO_ENABLED: 0
commands:
- golangci-lint run
depends_on:
- notify-start
- name: test
image: golang:1.13.5-alpine
environment:
GOFLAGS: -mod=vendor
CGO_ENABLED: 0
commands:
- go test ./...
depends_on:
- notify-start
- name: docker
image: plugins/docker
when:
branch: master
settings:
username:
from_secret: dockerhub_user
password:
from_secret: dockerhub_password
repo: pztrn/fastpastebin
auto_tag: true
depends_on:
- lint
- test
- name: notify-end
when:
status:
- success
- failure
image: pztrn/discordrone
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_secret
message: "
{{#success build.status}}
**{{repo.name}}#{{build.number}}@{{commit.sha}}** built in {{since build.startedint}} and pushed to hub.docker.com.
{{ else }}
**{{repo.name}}#{{build.number}}@{{commit.sha}}** failed. See {{build.link}}.
{{/success}}"
depends_on:
- docker

7
.gitignore vendored

@ -1 +1,6 @@
examples/fastpastebin.yaml
examples/fastpastebin.yaml
dist/
data/
.idea
.vscode
*DS_Store*

@ -0,0 +1,31 @@
image: docker:dind
variables:
HOST: 0.0.0.0
PORT: 2375
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
CONTAINER_NAME: registry.gitlab.pztrn.name/fastpastebin/fastpastebin
GIT_STRATEGY: clone
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
stages:
- build
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
build:
stage: build
tags:
- docker
script:
- 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,21 @@
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
linters-settings:
lll:
line-length: 420
gocognit:
min-complexity: 50
gocyclo:
min-complexity: 40

@ -0,0 +1,17 @@
FROM golang:1.13.1-alpine AS build
WORKDIR /fastpastebin
COPY . .
WORKDIR /fastpastebin/cmd/fastpastebin
RUN GOFLAGS="-mod=vendor" go build
FROM alpine:3.10
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" ]

187
Gopkg.lock generated

@ -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

@ -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!
[![Drone (self-hosted)](https://img.shields.io/drone/build/fastpastebin/fastpastebin?server=https%3A%2F%2Fci.dev.pztrn.name)](https://ci.dev.pztrn.name/fastpastebin/fastpastebin/) [![Discord](https://img.shields.io/discord/632359730089689128)](https://discord.gg/qHN6KsD) ![Keybase XLM](https://img.shields.io/keybase/xlm/pztrn)
Easy-to-use-and-install pastebin software written in Go. No bells or whistles, no websockets and even NO JAVASCRIPT!
# Current functionality.
## 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!
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:
Also if you're changed list of assets (by creating or deleting them) be sure to fix files list in ``fileb0x.yml`` file!
* Imports should be organized in 3 groups: stdlib, local, other. See
https://github.com/pztrn/fastpastebin/blob/master/pastes/api_http.go for
example.
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:
* We're not forcing any limits on line length for code, only for comments,
they should be 72-76 chars long.
* 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.
# 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.
* CLI client for pastes and files uploading.
* Possibility to copy-paste-edit WYSIWYG content.
* CLI client for pastes and files uploading.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -6,4 +6,9 @@
.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
}

@ -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>

@ -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>
</div>

@ -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">

@ -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,5 +1,5 @@
// 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)
// Code generated by fileb0x at "2021-01-09 06:15:34.328599857 +0500 +05 m=+0.033228523" from config file "fileb0x.yml" DO NOT EDIT.
// modification hash(a501d12d9fe3316e4b2134554bdc730c.238872c2653234e79053054d1ba776af)
package static
@ -7,6 +7,7 @@ package static
import (
"bytes"
"context"
"io"
"net/http"
"os"
@ -14,7 +15,6 @@ import (
"golang.org/x/net/webdav"
"context"
)
@ -36,13 +36,17 @@ var (
)
// HTTPFS implements http.FileSystem
type HTTPFS struct {}
type HTTPFS struct {
// Prefix allows to limit the path of all requests. F.e. a prefix "css" would allow only calls to /css/*
Prefix string
}
func init() {
if CTX.Err() != nil {
panic(CTX.Err())
err := CTX.Err()
if err != nil {
panic(err)
}
@ -50,10 +54,6 @@ func init() {
var err error
err = FS.Mkdir(CTX, "static/", 0777)
if err != nil && err != os.ErrExist {
@ -91,6 +91,7 @@ func init() {
// Open a file
func (hfs *HTTPFS) Open(path string) (http.File, error) {
path = hfs.Prefix + path
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)

@ -0,0 +1,35 @@
// Code generaTed by fileb0x at "2021-01-09 06:15:34.380518788 +0500 +05 m=+0.085147493" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.805743275 +0500 +05)
// original path: assets/database_not_available.html
package static
import (
"os"
)
// FileDatabaseNotAvailableHTML is "/database_not_available.html"
var FileDatabaseNotAvailableHTML = []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\x6e\x6f\x74\x69\x66\x69\x63\x61\x74\x69\x6f\x6e\x20\x69\x73\x2d\x64\x61\x6e\x67\x65\x72\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x68\x33\x3e\x3c\x73\x74\x72\x6f\x6e\x67\x3e\x44\x61\x74\x61\x62\x61\x73\x65\x20\x6e\x6f\x74\x20\x61\x76\x61\x69\x6c\x61\x62\x6c\x65\x3c\x2f\x73\x74\x72\x6f\x6e\x67\x3e\x3c\x2f\x68\x33\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x3e\x53\x6f\x6d\x65\x74\x68\x69\x6e\x67\x20\x77\x65\x6e\x74\x20\x77\x72\x6f\x6e\x67\x20\x77\x68\x69\x6c\x65\x20\x74\x72\x79\x69\x6e\x67\x20\x74\x6f\x20\x63\x6f\x6e\x6e\x65\x63\x74\x20\x74\x6f\x20\x64\x61\x74\x61\x62\x61\x73\x65\x2e\x20\x43\x68\x65\x63\x6b\x20\x6c\x6f\x67\x73\x20\x66\x6f\x72\x20\x64\x65\x74\x61\x69\x6c\x73\x2e\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, "/database_not_available.html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
if err != nil {
panic(err)
}
_, err = f.Write(FileDatabaseNotAvailableHTML)
if err != nil {
panic(err)
}
err = f.Close()
if err != nil {
panic(err)
}
}

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.366001707 +0500 +05 m=+0.070630336" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.805743275 +0500 +05)
// original path: assets/error.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.379885693 +0500 +05 m=+0.084514363" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-09 06:13:46.102341215 +0500 +05)
// original path: assets/footer.html
package static
@ -10,7 +10,7 @@ import (
)
// 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")
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\x6c\x61\x62\x2e\x70\x7a\x74\x72\x6e\x2e\x6e\x61\x6d\x65\x2f\x66\x61\x73\x74\x70\x61\x73\x74\x65\x62\x69\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\x0a")
func init() {

File diff suppressed because one or more lines are too long

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.333846038 +0500 +05 m=+0.038474816" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/main.html
package static
@ -10,7 +10,7 @@ import (
)
// 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")
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\x35\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\x33\x2e\x30\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\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() {

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.381029312 +0500 +05 m=+0.085658023" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/navigation.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.373359597 +0500 +05 m=+0.077988268" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/pagination.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.372861545 +0500 +05 m=+0.077490249" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/pagination_ellipsis.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.334873281 +0500 +05 m=+0.039502074" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/pagination_link.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.366696762 +0500 +05 m=+0.071325415" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/pagination_link_current.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.373841671 +0500 +05 m=+0.078470340" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/passworded_paste_verify.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.36723926 +0500 +05 m=+0.071867934" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/paste.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.335668233 +0500 +05 m=+0.040296968" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/pastelist_list.html
package static

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.336449591 +0500 +05 m=+0.041078378" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/pastelist_paste.html
package static

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.37218288 +0500 +05 m=+0.076811562" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.805743275 +0500 +05)
// original path: assets/css/style.css
package static
@ -10,7 +10,7 @@ import (
)
// 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")
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\x0a\x0a\x2f\x2a\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x70\x65\x63\x69\x61\x6c\x20\x63\x61\x73\x65\x20\x66\x6f\x72\x20\x6d\x75\x6c\x74\x69\x6c\x69\x6e\x65\x20\x74\x6f\x6f\x6c\x74\x69\x70\x73\x2e\x20\x53\x65\x65\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x57\x69\x6b\x69\x6b\x69\x2f\x62\x75\x6c\x6d\x61\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2f\x69\x73\x73\x75\x65\x73\x2f\x33\x34\x20\x2a\x2f\x0a\x2e\x74\x6f\x6f\x6c\x74\x69\x70\x2e\x69\x73\x2d\x74\x6f\x6f\x6c\x74\x69\x70\x2d\x6d\x75\x6c\x74\x69\x6c\x69\x6e\x65\x3a\x3a\x62\x65\x66\x6f\x72\x65\x20\x7b\x0a\x20\x20\x20\x20\x77\x68\x69\x74\x65\x2d\x73\x70\x61\x63\x65\x3a\x70\x72\x65\x2d\x6c\x69\x6e\x65\x0a\x7d")
func init() {

@ -1,5 +1,5 @@
// 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)
// Code generaTed by fileb0x at "2021-01-09 06:15:34.33997584 +0500 +05 m=+0.044604593" from config file "fileb0x.yml" DO NOT EDIT.
// modified(2021-01-08 11:51:03.815743367 +0500 +05)
// original path: assets/js/fontawesome-5.0.7.js
package static

@ -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

@ -31,13 +31,13 @@ import (
"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() {
@ -54,21 +54,23 @@ func main() {
// Continue loading.
c.LoadConfiguration()
c.InitializePost()
database.New(c)
c.Database.Initialize()
migrations.New(c)
migrations.Migrate()
templater.Initialize(c)
api.New(c)
api.InitializeAPI()
captcha.New(c)
dbnotavailable.New(c)
indexpage.New(c)
pastes.New(c)
// 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()

@ -0,0 +1,37 @@
version: "3"
volumes:
mysql:
services:
database:
image: mariadb:10.3
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,30 +22,26 @@
// 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 dbnotavailable
import (
// stdlib
"net/http"
// local
"github.com/pztrn/fastpastebin/api/http/static"
"github.com/pztrn/fastpastebin/context"
"go.dev.pztrn.name/fastpastebin/internal/templater"
// other
"github.com/labstack/echo"
)
var (
c *context.Context
)
// 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...")
// Database not available error page
func dbNotAvailableGet(ec echo.Context) error {
htmlData := templater.GetTemplate(ec, "database_not_available.html", nil)
// Static files.
c.Echo.GET("/static/*", echo.WrapHandler(static.Handler))
return ec.HTML(http.StatusInternalServerError, htmlData)
}
// Index.
c.Echo.GET("/", indexGet)
func dbNotAvailableRawGet(ec echo.Context) error {
return ec.String(http.StatusInternalServerError, "Database not available\nSomething went wrong while trying to connect to database. Check logs for details.")
}

@ -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 dbnotavailable
import (
// local
"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,21 @@
// 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
)
// 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,15 +22,15 @@
// 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"
"go.dev.pztrn.name/fastpastebin/internal/captcha"
"go.dev.pztrn.name/fastpastebin/internal/templater"
// other
"github.com/alecthomas/chroma/lexers"
@ -39,6 +39,12 @@ import (
// Index of this site.
func indexGet(ec echo.Context) error {
// We should check if database connection available.
dbConn := c.Database.GetDatabaseConnection()
if c.Config.Database.Type != "flatfiles" && dbConn == nil {
return ec.Redirect(http.StatusFound, "/database_not_available")
}
// Generate list of available languages to highlight.
availableLexers := lexers.Names(false)

@ -25,35 +25,42 @@
package pastes
import (
// stdlib
"regexp"
// local
"github.com/pztrn/fastpastebin/context"
"go.dev.pztrn.name/fastpastebin/internal/context"
)
var (
regexInts = regexp.MustCompile("[0-9]+")
)
var (
c *context.Context
)
// New initializes pastes package and adds neccessary HTTP and API
// 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)