{"id":23231017,"url":"https://github.com/charlzyx/silver","last_synced_at":"2026-04-24T16:32:14.831Z","repository":{"id":62690474,"uuid":"561321816","full_name":"charlzyx/silver","owner":"charlzyx","description":"super simple static server, but with try_files and proxy, build for tauri sidecar.","archived":false,"fork":false,"pushed_at":"2022-11-04T16:08:54.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-11T17:16:05.264Z","etag":null,"topics":["cli","reverse-proxy","rouille","rust","server","sidecar","static-server","tauri","tauri-app","tiny-http","tools"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charlzyx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-03T12:50:25.000Z","updated_at":"2022-11-04T15:56:19.000Z","dependencies_parsed_at":"2023-01-23T13:01:33.419Z","dependency_job_id":null,"html_url":"https://github.com/charlzyx/silver","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlzyx%2Fsilver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlzyx%2Fsilver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlzyx%2Fsilver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlzyx%2Fsilver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charlzyx","download_url":"https://codeload.github.com/charlzyx/silver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247387563,"owners_count":20930836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","reverse-proxy","rouille","rust","server","sidecar","static-server","tauri","tauri-app","tiny-http","tools"],"created_at":"2024-12-19T02:12:50.221Z","updated_at":"2026-04-24T16:32:14.800Z","avatar_url":"https://github.com/charlzyx.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# silver\n\n## Overview\nSuper simple and smart static server as a single executable, build for [tauri app sidecar](https://tauri.app/zh/v1/guides/building/sidecar/).\n\n## Features\n-  `try_files` automic, useful for web app history router.\n- reverse proxy by headers `silverproxy`, look at bottom.\n\n\n## Usage\n\nDownload silver_xxx.zip for your platform. [Releases](https://github.com/charlzyx/silver/releases).\n\n### Usage executable binary file\n\n```sh\nsilver [root=$PWD] [port=2333]\n```\n\n\n\n### Usage in tauri app\n1. download all of platform zips you needs, and unzip all of them to `src-tauri/binaries/` folder.\n2. `tauri.config.json` looks like this.\n\n```json\n{\n  \"tauri\": {\n    \"bundle\": {\n      \"externalBin\": [\n        \"binaries/silver\"\n      ]\n    },\n    \"allowlist\": {\n      \"shell\": {\n        \"sidecar\": true,\n        \"scope\": [\n          { \"name\": \"binaries/silver\", \"sidecar\": true }\n        ]\n      }\n    }\n  }\n}\n```\n\n3. Example use in rust with args. [and more offical docs](https://tauri.app/zh/v1/guides/building/sidecar/)\n\n```rust\nuse tauri::api::path;\nuse tauri::api::process::{Command, CommandEvent};\n\npub fn serve() {\n    let port = 8686;\n\n    let root = String::from(\n        path::home_dir()\n            .unwrap()\n            .join(\"www\")\n            .to_str()\n            .unwrap(),\n    );\n\n\n    let (mut rx, mut child) = Command::new_sidecar(\"silver\")\n        .expect(\"failed to create `silver` binary command\")\n        .args([root, port.to_string()])\n        .spawn()\n        .expect(\"Failed to spawn sidecar\");\n\n\n    tauri::async_runtime::spawn(async move {\n        // read events such as stdout\n        while let Some(event) = rx.recv().await {\n            if let CommandEvent::Stdout(line) = event {\n                println!(\"{}\", line);\n                // window\n                //     .emit(\"message\", Some(format!(\"'{}'\", line)))\n                //     .expect(\"failed to emit event\");\n                // // write to stdin\n                child.write(\"message from Rust\\n\".as_bytes()).unwrap();\n            }\n        }\n    });\n}\n```\n## Advance:: proxy\n\nwith speical header `silverproxy` with proxy to taget `host:port`,\n**no* `http/https` prefix and last `/` but `port` is required\n\n`silverhost` is not required, if not setting, will be same with `silverproxy`\n\nexample\n\n```sh\ncurl --location --request GET 'http://127.0.0.1:2333/api/v5/users/charlzyx/repos' \\\n--header 'silverproxy: gitee.com:80' \\\n--header 'silverhost: gitee.com' \\\n```\n\n# Powered by\n- [rouille](https://github.com/tomaka/rouille)\n- [tiny-http](https://github.com/tiny-http/tiny-http)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlzyx%2Fsilver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlzyx%2Fsilver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlzyx%2Fsilver/lists"}