Skip to content

Commit

Permalink
edit README file
Browse files Browse the repository at this point in the history
  • Loading branch information
robatipoor committed Mar 17, 2024
1 parent a5f2444 commit 4a5dce6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.PHONY: local
local:
cargo build --release

.PHONY: run
run:
ifndef ARGS
@echo Run "make run" with ARGS set to pass arguments…
endif
cargo run --release -- $(ARGS)

.PHONY: build-linux
build-linux:
cargo build --target x86_64-unknown-linux-musl --release --locked
strip target/x86_64-unknown-linux-musl/release/api
upx --lzma target/x86_64-unknown-linux-musl/release/api
strip target/x86_64-unknown-linux-musl/release/cli
upx --lzma target/x86_64-unknown-linux-musl/release/cli

.PHONY: build-win
build-win:
RUSTFLAGS="-C linker=x86_64-w64-mingw32-gcc" cargo build --target x86_64-pc-windows-gnu --release --locked
strip target/x86_64-pc-windows-gnu/release/api.exe
upx --lzma target/x86_64-pc-windows-gnu/release/api.exe
strip target/x86_64-pc-windows-gnu/release/cli.exe
upx --lzma target/x86_64-pc-windows-gnu/release/cli.exe

.PHONY: build-mac
build-mac:
cargo build --target x86_64-apple-darwin --release --locked
strip target/x86_64-apple-darwin/release/api
upx --lzma target/x86_64-apple-darwin/release/api
strip target/x86_64-apple-darwin/release/cli
upx --lzma target/x86_64-apple-darwin/release/cli
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ $ cargo run --bin api
**Run API Service via Docker**

```sh
# Build docker image
# Pull the image from the github registry and run container
$ docker run --name pf-api --rm -p 8080:8080 -d ghcr.io/robatipoor/pf-api:latest

# Alternatively, if you need to configure the server with custom settings,
# edit api/settings/base.toml and then build the Docker image.
$ docker build -t pf-api:latest -f api/Dockerfile .

# Run Docker container on address 0.0.0.0:8080
$ docker run --name pf-api --rm -p 8080:8080 -d pf-api:latest

# Alternatively, you can pull the image from the github registry and run container
$ docker run --name pf-api --rm -p 8080:8080 -d ghcr.io/robatipoor/pf-api:latest
```

**How to Use**
Expand Down Expand Up @@ -125,7 +126,7 @@ port = 8080
domain_name = "localhost:8080"

# Public IP address
public_addr = "192.168.100.130:8080"
public_addr = "192.168.1.1:8080"

# TLS key file path
file_tls_key_path = "key.pem"
Expand Down Expand Up @@ -163,10 +164,10 @@ $ mv ~/.cargo/bin/cli ~/.cargo/bin/pf
# Define an alias in the shell profile for 'pf' with server address
$ alias pf="pf --server-addr http://localhost:8080"

# Copy a text content to the server with an expiration time of 10 minutes.
# Copy text content to the server with an expiration time of 10 minutes.
$ echo 'Hello World!' | pf copy --expire "10 minute"

# Paste a text content to the file.
# Paste text content into the file.
$ pf paste --url-path "{code}/{file_name}" > my_file.txt

# Encrypt and upload a file and retrieve the corresponding download URL.
Expand Down
2 changes: 1 addition & 1 deletion api/settings/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ port = 8080
# Domain name URL
domain_name = "localhost:8080"
# Public IP address
public_addr = "127.0.0.1:8080"
public_addr = "192.168.1.1:8080"
# TLS key file path
file_tls_key_path = "key.pem"
# TLS certificate file path
Expand Down
3 changes: 1 addition & 2 deletions sdk/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tokio_util::io::{ReaderStream, StreamReader};

pub static CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {
let disable_redirect = reqwest::redirect::Policy::custom(|attempt| attempt.stop());
reqwest::Client::builder()
.redirect(disable_redirect)
.redirect(reqwest::redirect::Policy::custom(|attempt| attempt.stop()))
.build()
.unwrap()
});
Expand Down

0 comments on commit 4a5dce6

Please sign in to comment.