diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 0dca6dd..86e3ab2 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -183,3 +183,27 @@ jobs: hyperlink="[${{ matrix.platform.release_for }}]($url)" echo "🚀 Built for $hyperlink in $time_taken seconds" >> $GITHUB_STEP_SUMMARY shell: bash + + publish-crate: + needs: + - release + - upload_assets + if: needs.release.outputs.release-flag == 'true' + runs-on: thevickypedia-lite + steps: + - uses: actions/checkout@v4 + - name: Update Rust + run: | + printf '*%.0s' {1..60} && printf "\n" + echo "Existing rust version: $(rustc --version)" + printf '*%.0s' {1..60} && printf "\n\n" + rustup update && printf "\n" + printf '*%.0s' {1..60} && printf "\n" + echo "Updated rust version: $(rustc --version)" + printf '*%.0s' {1..60} && printf "\n" + shell: bash + - name: Release Crate + run: | + cargo login ${{ secrets.CRATES_TOKEN }} + cargo publish --allow-dirty # Set allow-dirty since building will create a /target folder that will be uncommitted in git + shell: bash diff --git a/Cargo.toml b/Cargo.toml index ed7de00..5df508b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.1" description = "Service that creates object listing functionality for S3 buckets" edition = "2021" authors = ["Vignesh Rao"] +license = "MIT" [[bin]] name = "lists3" diff --git a/README.md b/README.md index 80a3473..d927722 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,37 @@ +[![crates.io][crates-logo]][crate] + +[![build][gh-logo]][build] + +#### Summary +[`lists3`][repo] is a self-hosted streaming engine, that can render media files via authenticated sessions. + # ListS3 File Browser for S3 buckets +
+Download pre-compiled OS specific executable + +###### macOS +```shell +curl -o lists3-darwin-amd64.tar.gz -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/lists3/releases/latest/download/lists3-darwin-amd64.tar.gz" +``` + +###### macOS - M1 +```shell +curl -o lists3-darwin-arm64.tar.gz -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/lists3/releases/latest/download/lists3-darwin-arm64.tar.gz" +``` + +###### Linux +```shell +curl -o lists3-linux-amd64.tar.gz -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/lists3/releases/latest/download/lists3-linux-amd64.tar.gz" +``` + +###### Windows +```shell +curl -o lists3-windows-amd64.zip -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/lists3/releases/latest/download/lists3-windows-amd64.zip" +``` +
+ ### Arguments - **--bucket / -b**: Bucket name for which listing has to be created. @@ -20,3 +51,40 @@ File Browser for S3 buckets ```shell ./lists3 --bucket thevickypedia.com --object list --filter '["github/"]' ``` + +## Crate +[https://crates.io/crates/lists3][crate] + +### Cargo Docs - Official Runbook +[https://docs.rs/lists3/latest/lists3/][docs] + +**Generator** +```shell +cargo doc --document-private-items --no-deps +``` + +## Linting +### Requirement +```shell +rustup component add clippy +``` +### Usage +```shell +cargo clippy --no-deps --fix +``` + +## License & copyright + +© Vignesh Rao + +Licensed under the [MIT License][license] + +[repo]: https://github.com/thevickypedia/lists3 +[license]: https://github.com/thevickypedia/lists3/blob/main/LICENSE +[build]: https://github.com/thevickypedia/lists3/actions/workflows/rust.yaml +[rust-logo]: https://img.shields.io/badge/Made%20with-Rust-black?style=for-the-badge&logo=Rust +[gh-logo]: https://github.com/thevickypedia/lists3/actions/workflows/rust.yaml/badge.svg +[crate]: https://crates.io/crates/lists3 +[gh-checks]: https://github.com/thevickypedia/lists3/actions/workflows/rust.yml +[crates-logo]: https://img.shields.io/crates/v/lists3.svg +[docs]: https://docs.rs/lists3/latest/ diff --git a/src/main.rs b/src/main.rs index 5cbf3cd..3dfbf72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ mod aws; async fn generate_html( config: &squire::settings::Config, region: &Region, + metadata: &squire::constant::MetaData ) -> String { let jinja = templates::environment(); let template_string = format!("list-s3-{}", config.style); @@ -19,6 +20,7 @@ async fn generate_html( folder_names => config.filter, ignore_objects => config.ignore, proxy_server => config.proxy.to_string(), + cargo_version => metadata.pkg_version )); html_data.unwrap() } @@ -48,6 +50,6 @@ async fn main() { &config.bucket, bucket_names); exit(1) } - let data = generate_html(&config, ®ion).await; + let data = generate_html(&config, ®ion, &metadata).await; aws::upload_object(&aws_client, &config.bucket, &data, &config.object).await; } diff --git a/src/templates/list_bootstrap.rs b/src/templates/list_bootstrap.rs index cd16b66..9571734 100644 --- a/src/templates/list_bootstrap.rs +++ b/src/templates/list_bootstrap.rs @@ -92,7 +92,7 @@ pub fn get_content() -> String { if (!ignoreFlag) { if (folderNames.length > 0) { for (let k = 0; k < folderNames.length; k++) { - if (fileName.startsWith(folderNames[k])) { + if (fileName != folderNames[k] && fileName.startsWith(folderNames[k])) { filteredFiles.push(files[i]); filteredSize += parseInt(fileSize); } @@ -192,7 +192,7 @@ pub fn get_content() -> String { function renderTable(bucketName, regionName, folderNames, ignoreObjects, proxyServer) { let pretext = document.getElementById('pretext'); - pretext.innerHTML = "Amazon S3 Bucket list v2"; + pretext.innerHTML = "Rustic Bucket Listing - v{{ cargo_version }}"; const data = getList(bucketName, regionName, folderNames, ignoreObjects, proxyServer); diff --git a/src/templates/list_vanilla.rs b/src/templates/list_vanilla.rs index c4ab2a9..5c8d135 100644 --- a/src/templates/list_vanilla.rs +++ b/src/templates/list_vanilla.rs @@ -88,7 +88,7 @@ pub fn get_content() -> String { function getList(bucketName, regionName, folderNames, ignoreObjects) { let pretext = document.getElementById('pretext'); - pretext.innerHTML = "Amazon S3 Bucket list v2"; + pretext.innerHTML = "Rustic Bucket Listing - v{{ cargo_version }}"; let origin = `http://${bucketName}.s3-${regionName}.amazonaws.com` let responseType = "application/xml" @@ -119,7 +119,7 @@ pub fn get_content() -> String { if (!ignoreFlag) { if (folderNames.length > 0) { for (let k = 0; k < folderNames.length; k++) { - if (fileName.startsWith(folderNames[k])) { + if (fileName != folderNames[k] && fileName.startsWith(folderNames[k])) { filteredFiles.push(files[i]); filteredSize += parseInt(fileSize); }