From 3f5b118ac5cb65fd688dbbeaefd6d73a04608d4f Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Fri, 9 Aug 2019 19:43:58 +0200 Subject: [PATCH] Rename project --- Dockerfile | 14 ++++++------ backend/README.md => README.md | 8 +++---- backend/Cargo.lock | 40 +++++++++++++++++----------------- backend/Cargo.toml | 2 +- backend/src/statics.rs | 6 ++--- docker-compose.yml | 4 ++-- frontend/build.sh | 6 ++--- frontend/src/Data.elm | 2 +- frontend/template.html | 6 ++--- 9 files changed, 44 insertions(+), 44 deletions(-) rename backend/README.md => README.md (85%) diff --git a/Dockerfile b/Dockerfile index 06ec90e..3f4ccaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,18 +17,18 @@ RUN ./build.sh FROM ekidd/rust-musl-builder:stable as backend # create new cargo project -RUN USER=rust cargo new --bin gitache +RUN USER=rust cargo new --bin yagcdn RUN USER=rust cargo new --lib time-cache # copy build config -COPY --chown=rust ./backend/Cargo.lock ./gitache/Cargo.lock -COPY --chown=rust ./backend/Cargo.toml ./gitache/Cargo.toml +COPY --chown=rust ./backend/Cargo.lock ./yagcdn/Cargo.lock +COPY --chown=rust ./backend/Cargo.toml ./yagcdn/Cargo.toml COPY --chown=rust ./time-cache/Cargo.toml ./time-cache/Cargo.toml -WORKDIR /home/rust/src/gitache +WORKDIR /home/rust/src/yagcdn # build to cache dependencies RUN cargo build --release # delete build cache to prevent caching issues later on -RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/gitache-* +RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/yagcdn* RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/time-cache-* COPY ./backend/static ./static @@ -49,9 +49,9 @@ COPY --from=linuxkit/ca-certificates:v0.7 / / COPY --from=user_builder /etc/passwd /etc/passwd USER dummy -COPY --from=backend /home/rust/src/gitache/target/x86_64-unknown-linux-musl/release/gitache / +COPY --from=backend /home/rust/src/yagcdn/target/x86_64-unknown-linux-musl/release/yagcdn / COPY --from=frontend /output/index.html /public/index.html COPY --from=frontend /output/scripts /public/scripts COPY --from=frontend /output/assets /public/assets -ENTRYPOINT ["/gitache"] +ENTRYPOINT ["/yagcdn"] diff --git a/backend/README.md b/README.md similarity index 85% rename from backend/README.md rename to README.md index 2799c59..806b659 100644 --- a/backend/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Gitache +# YaGCDN -Gitache is a web service that serves raw files from GitHub, GitLab and Bitbucket +YaGCDN is a web service that serves raw files from GitHub, GitLab and Bitbucket with the proper `Content-Type` headers. Requests to a branch will be redirected to the branches `HEAD`. Requests to a specific commit will also set long time cache headers, so the service can be put behind a CDN like Cloudflare. @@ -20,7 +20,7 @@ exposing port `8080`. ## API Limits -To get the `HEAD` of a requested branch, Gitache sends a request to the +To get the `HEAD` of a requested branch, YaGCDN sends a request to the requested service's API. To prevent running into rate limiting issues with the GitHub API, an OAuth2 App should be created and the client ID and secret can be set via the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` environment variables. @@ -34,4 +34,4 @@ set via the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` environment variables. | `CF_ZONE_IDENT` | `--cf-zone` | Cloudflare Zone identifier | | `CF_AUTH_USER` | `--cf-auth-user` | CF API User (`X-Auth-Email`) | | `CF_AUTH_KEY` | `--cf-auth-key` | CF API Key (`X-Auth-Key`) | -| `HOSTNAME` | `--hostname` | Hostname (default: `gitcdn.tk`) | +| `YAGCDN_HOSTNAME` | `--hostname` | Hostname (default: `yagcdn.tk`) | diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 9b59fdd..8cb6faf 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -642,26 +642,6 @@ dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "gitache" -version = "0.1.0" -dependencies = [ - "actix-files 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-web 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "awc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "mime_guess 1.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "time-cache 0.1.0", -] - [[package]] name = "h2" version = "0.1.25" @@ -1966,6 +1946,26 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "yagcdn" +version = "0.1.0" +dependencies = [ + "actix-files 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "awc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 1.8.7 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "time-cache 0.1.0", +] + [metadata] "checksum actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9f2c11af4b06dc935d8e1b1491dad56bfb32febc49096a91e773f8535c176453" "checksum actix-connect 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d161322a26e6b76d6598f48654afbdcfee644c900d4368e9962ec68abd0713b" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index f4dd078..5b045a1 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "gitache" +name = "yagcdn" version = "0.1.0" authors = ["Valentin Brandl "] edition = "2018" diff --git a/backend/src/statics.rs b/backend/src/statics.rs index 0d065fe..4c62603 100644 --- a/backend/src/statics.rs +++ b/backend/src/statics.rs @@ -6,7 +6,7 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); pub(crate) const REDIRECT_AGE: Duration = Duration::from_secs(5 * 60); pub(crate) const FAVICON: &[u8] = include_bytes!("../static/favicon32.png"); lazy_static! { - pub(crate) static ref USER_AGENT: String = format!("gitache/{}", VERSION); + pub(crate) static ref USER_AGENT: String = format!("yagcdn/{}", VERSION); pub(crate) static ref OPT: Opt = Opt::from_args(); pub(crate) static ref GITHUB_AUTH_QUERY: String = Github::auth_query().unwrap_or_default(); pub(crate) static ref CF_ZONE_IDENT: String = OPT @@ -27,8 +27,8 @@ lazy_static! { pub(crate) static ref HOSTNAME: String = OPT .hostname .clone() - .or_else(|| load_env_var("GITACHE_HOSTNAME")) - .unwrap_or_else(|| "gitcdn.tk".to_string()); + .or_else(|| load_env_var("YAGCDN_HOSTNAME")) + .unwrap_or_else(|| "yagcdn.tk".to_string()); } pub(crate) fn load_env_var(key: &str) -> Option { diff --git a/docker-compose.yml b/docker-compose.yml index 9d093e0..279a3ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: '2' services: - gitache: - build: ./ + yagcdn: + image: vbrandl/yagcdn:latest restart: always environment: - CF_ZONE_IDENT=${CF_ZONE_IDENT} diff --git a/frontend/build.sh b/frontend/build.sh index c24d6e6..691fd58 100755 --- a/frontend/build.sh +++ b/frontend/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh -js="gitcdn.js" -min="gitcdn.min.js" +js="yagcdn.js" +min="yagcdn.min.js" outdir="./output/" scriptdir="${outdir}scripts/" @@ -24,7 +24,7 @@ sha1() { rename_with_hash() { sha1=${1} - cp ${min} "${scriptdir}/gitcdn-${sha1}.min.js" + cp ${min} "${scriptdir}/yagcdn-${sha1}.min.js" } create_index() { diff --git a/frontend/src/Data.elm b/frontend/src/Data.elm index fa546ea..fc2bf5c 100644 --- a/frontend/src/Data.elm +++ b/frontend/src/Data.elm @@ -3,7 +3,7 @@ module Data exposing (Provider(..), Url, hostname, pathSeparator, toUrl) hostname : String hostname = - "https://gitcdn.tk/" + "https://yagcdn.tk/" type Provider diff --git a/frontend/template.html b/frontend/template.html index afc37c4..99745ee 100644 --- a/frontend/template.html +++ b/frontend/template.html @@ -11,12 +11,12 @@
-

GitCDN

+

YaGCDN

-