Commit Graph

43 Commits

Author SHA1 Message Date
Jake Howard dae00c42b5
feat(server): do path joins more safely (#247)
* Do path joins more safely

* Improve path cleaning and tests

* Lower-case error message

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>

* Correct handle potential errors in `get_path`

* Use `expect` in tests, rather than `unwrap`

* Correctly handle invalid upload path without panic

* Correctly handle filesystem create errors

* Use result rather than option to allow easier error handling

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2024-03-06 05:55:59 +01:00
Orhun Parmaksız 12f0e8f3a7
chore(server): gracefully exit when there is no config file found 2024-03-01 22:17:17 +03:00
Orhun Parmaksız 274bbd3307
fix(lints): apply clippy suggestions 2023-12-31 14:06:46 +03:00
Orhun Parmaksız d4b02eca91
fix(shuttle): fix Shuttle entrypoint 2023-12-05 15:22:10 +03:00
Orhun Parmaksız ef08b9e838
refactor(tracing): use macros from tracing crate 2023-12-05 15:12:48 +03:00
dependabot[bot] a291307bec
chore(deps): bump byte-unit from 4.0.19 to 5.0.3 (#192)
* chore(deps): bump byte-unit from 4.0.19 to 5.0.3

Bumps [byte-unit](https://github.com/magiclen/byte-unit) from 4.0.19 to 5.0.3.
- [Commits](https://github.com/magiclen/byte-unit/compare/v4.0.19...v5.0.3)

---
updated-dependencies:
- dependency-name: byte-unit
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(deps): update codebase accordingly to the new version of byte-unit

* fix(fixtures): use more precise byte comparison

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2023-12-05 13:08:22 +01:00
Jean SIMARD 70541bb842
feat(log): switch to `tracing` for logging (#163)
* feat(log): use 'tracing-subscriber' instead of 'env_logger'

resolves #161

* feat: use 'tracing' instead of 'log'

* feat: make 'INFO' the default log level
2023-10-20 23:30:16 +02:00
Orhun Parmaksız 86759450b9
chore(deps): bump shuttle dependencies to 0.27.0 2023-09-22 15:01:20 +03:00
Helmut K. C. Tessarek d2d07ad345
feat(server): improve random_url config handling (#122)
* feat(server): improve random_url config handling

* log deprecation warnings after hot reload of config

* refactor(config): adjust config files

* tests(config): add test for deprecation codepath

* remove unnecessary to_string()

* style: delete empty line

* refactor(server): clean up random_url config handling

* refactor(config): update configs accordingly to deprecated random_url.enabled

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2023-08-20 20:32:41 +02:00
Helmut K. C. Tessarek 0d4808880f
feat(server): support multiple auth tokens (#84)
* feat(server): support multiple auth tokens

Example:

```toml
[server]
auth_tokens = [
  "super_secret_token1",
  "super_secret_token2",
]
```

The previously used `AUTH_TOKEN` environment variable can still be used
and will be evaluated as well.

* fixtures: add all tokens in array to the test

* add deprecation warning for auth_token

* also add deprecation warnings at server startup

* fix formatting

* fixed tests, so that we do not use deprecated config options

* use bash array

* refactor: use separate function

* refactor: check auth tokens

* Update fixtures/test-server-auth-multiple-tokens/test.sh

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>

* refactor: convert functions to methods

* refactor: check function

* refactor: get_tokens method

* style(format): add newline between functions

* refactor(server): print deprecation warnings once

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2023-07-21 12:28:17 +02:00
Orhun Parmaksız 4df136870a
fix(deploy): use the static folder for config (#70) 2023-06-23 18:33:05 +03:00
Orhun Parmaksız ff9fd68e89
chore(deps): bump shuttle dependencies to 0.19.0 2023-06-20 23:13:00 +03:00
Helmut K. C. Tessarek f7beaef502
feat(server): honor X-Forward-* headers (#61)
* honor X-Forward-* headers

Behind a reverse proxy, the log entries always showed the IP address of the reverse proxy.
With this change the real IP address of the client is shown.
Since the IP address is only used for info in the log, there are no security implications.

* style(format): apply formatting

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2023-06-13 01:00:55 +02:00
dependabot[bot] 07ec392867
chore(deps): bump hotwatch from 0.4.6 to 0.5.0 (#55)
Bumps [hotwatch](https://github.com/francesca64/hotwatch) from 0.4.6 to 0.5.0.
- [Release notes](https://github.com/francesca64/hotwatch/releases)
- [Changelog](https://github.com/francesca64/hotwatch/blob/main/CHANGELOG.md)
- [Commits](https://github.com/francesca64/hotwatch/compare/v0.4.6...v0.5.0)

---
updated-dependencies:
- dependency-name: hotwatch
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-05 23:15:30 +02:00
Orhun Parmaksız 1670a71cdd
feat(server): implement middleware for limiting the content length (#53) 2023-06-05 22:49:26 +03:00
Orhun Parmaksız a13c0f123a
fix(hotwatch): do not drop the config watcher 2023-06-04 14:43:08 +03:00
Orhun Parmaksız 1a9163639c
chore(log): add startup log for showing the server address 2023-05-31 00:53:59 +03:00
Rahul Garg bd88146430
feat(server): support one shot URLs (#46)
* Add support for OneshotUrl

* Review cmt: Update README

* docs(oneshot): update documentation about oneshot URLs

* Review cmt: revert fmt

* test(fixtures): add fixture test for oneshot URLs

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2023-05-28 22:09:14 +02:00
Orhun Parmaksız 29ddef8df0
feat(deploy): deploy on shuttle.rs (#36)
* feat(deploy): deploy on shuttle.rs

* chore(deploy): add automated shuttle deploy workflow

* style(readme): update the formatting in README.md

* chore(deploy): optimize shuttle workflow

* fix(deploy): start the project

* fix(deploy): remove start step

This reverts commit 4f25921aeb.

* chore(deploy): expose the version for the public instance

* docs(lib): update the comment for shuttle entry-point

* chore(deploy): run the shuttle deployment on new tag
2023-05-14 18:03:53 +02:00
Orhun Parmaksız e83b8e6f4a
fix(lints): apply clippy suggestions 2022-12-18 23:12:28 +03:00
Leonidas Spyropoulos 1050448ebd
chore(deps): replace unmaintained dotenv with dotenvy (#30)
Fixes: #25

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>3
2022-10-04 10:02:51 +00:00
Orhun Parmaksız 3467038353
feat(env): support configuring logger from .env file 2022-05-21 09:07:37 +03:00
Orhun Parmaksız 63c79b8297
feat(log): print the configuration as trace log at startup 2022-05-21 06:26:17 +03:00
Orhun Parmaksız dd91c50d50
feat(server): support auto-deletion of expired files (#17)
feat(server): support auto-deletion of expired files (#17)

chore(ci): set the number of test threads to 1

feat(config): allow the real-time update of cleanup routine

docs(readme): update README.md about deleting expired files
2022-03-23 16:13:46 +03:00
Orhun Parmaksız a3e266b8b4
refactor(server): define global constants for environment variables 2022-03-17 15:54:08 +03:00
Orhun Parmaksız c48e45d68c
chore(deps): upgrade actix dependencies
closes #18
2022-03-17 15:46:32 +03:00
Orhun Parmaksız 1dd5dcf167
fix(config): unset `CONFIG` environment variable to avoid conflicts 2022-03-13 21:12:10 +03:00
Orhun Parmaksız 94516c95bb
feat(config): support setting the timeout for HTTP requests 2022-03-12 00:35:54 +03:00
Orhun Parmaksız 9e5bd112e7
feat(config): support setting the refresh rate for hot-reloading 2022-03-12 00:02:25 +03:00
Orhun Parmaksız 8f3f89716f
fix(async): drop the RW guard of config before suspend points 2021-12-05 15:03:51 +03:00
Orhun Parmaksız 8b17137c52
fix(server): gracefully handle the hot-reloading errors 2021-11-16 19:27:18 +03:00
Orhun Parmaksız a2de1c3334
feat(config): hot-reload the configuration 2021-11-07 16:06:57 +03:00
Orhun Parmaksız 7a6842e181
feat(paste): support pasting files from remote URLs 2021-11-06 23:55:55 +03:00
orhun 13126e79ce
refactor(paste): use timestamp for expiring one shot files 2021-08-27 16:05:40 +03:00
orhun 73359f3534
feat(paste): support disappearing (oneshot) files 2021-08-26 22:57:46 +03:00
orhun 3223c6379c
refactor(paste): associate directories with the paste types 2021-08-26 21:09:33 +03:00
orhun f3855be2c9
feat(paste): support shortening URLs 2021-08-04 17:35:54 +03:00
orhun 411f278656
feat(config): use an environment variable for config file path 2021-07-24 20:51:08 +03:00
orhun d538e591ef
chore(project): update project details 2021-07-24 20:46:22 +03:00
orhun 181c8c602c
refactor(server): use .env for auth token 2021-07-24 14:10:30 +03:00
orhun 1413335519
feat(server): support file upload and serving 2021-07-23 22:52:00 +03:00
orhun df0d22dcb3
feat(server): add basic HTTP server implementation 2021-07-20 01:35:52 +03:00
orhun 2d3151292d
Initial commit 2021-07-19 22:16:13 +03:00