{"id":21008182,"url":"https://github.com/ediwang/elf","last_synced_at":"2025-04-06T10:11:49.210Z","repository":{"id":40605772,"uuid":"190311691","full_name":"EdiWang/Elf","owner":"EdiWang","description":"The ASP.NET Core URL forward service runs on Microsoft Azure","archived":false,"fork":false,"pushed_at":"2025-03-27T13:05:41.000Z","size":5287,"stargazers_count":80,"open_issues_count":3,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-01T23:35:55.601Z","etag":null,"topics":["asp-net-core","azure","azure-app-service","blazor-webassembly","dotnet-core"],"latest_commit_sha":null,"homepage":"https://go.edi.wang","language":"C#","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/EdiWang.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-05T02:23:59.000Z","updated_at":"2025-03-27T12:41:02.000Z","dependencies_parsed_at":"2023-10-03T16:01:06.496Z","dependency_job_id":"8844c6c0-1851-4235-9cee-de58713f63cf","html_url":"https://github.com/EdiWang/Elf","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdiWang%2FElf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdiWang%2FElf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdiWang%2FElf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdiWang%2FElf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EdiWang","download_url":"https://codeload.github.com/EdiWang/Elf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464222,"owners_count":20942970,"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":["asp-net-core","azure","azure-app-service","blazor-webassembly","dotnet-core"],"created_at":"2024-11-19T09:11:46.200Z","updated_at":"2025-04-06T10:11:49.183Z","avatar_url":"https://github.com/EdiWang.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elf\n\n[![Docker for API](https://github.com/EdiWang/Elf/actions/workflows/docker-api.yml/badge.svg)](https://github.com/EdiWang/Elf/actions/workflows/docker-api.yml)\n![Man hours](https://img.shields.io/endpoint?url=https%3A%2F%2Fmanhours.aiursoft.cn%2Fr%2Fgithub.com%2FEdiWang%2FElf.json)\n\nThe link forward service used by https://go.edi.wang. It generates static URLs for redirecting third party URLs. It's similar to, but **NOT a URL shorter**. \n\n- Use a static token to adapt changes to origin url.\n- Track user click to generate report.\n\ne.g.:\n\nRaw URL:\n```\nhttps://www.somewebsite.com/a-very-long-and-complicated-link-that-can-also-change?with=parameters\n```\n\nwill be translate to `https://yourdomain/fw/token` or `https://yourdomain/aka/name`\n\n## Features\n\nForward Link, Create/Manage/Share Link, View Report.\n\n![list](https://github.com/EdiWang/Elf/assets/3304703/2f3f3691-fa24-4d24-9a8f-562b0cab8261)\n\n![report](https://github.com/EdiWang/Elf/assets/3304703/09eab5b0-0749-4d41-a4a9-56da4eb5aeb5)\n\n\n## Forward Logic\n\n![image](https://cdn.edi.wang/web-assets/lf/LinkForwarder-FW.png)\n\n## Docker Deployment\n\nhttps://hub.docker.com/r/ediwang/elf\n\nYou can also follow the next section to build and run the project yourself.\n\n## Build and Run API\n\nTools | Alternative\n--- | ---\n[.NET 9 SDK](http://dot.net) | N/A\n[Visual Studio 2022](https://visualstudio.microsoft.com/) | [Visual Studio Code](https://code.visualstudio.com/)\n[Azure SQL Database](https://azure.microsoft.com/en-us/services/sql-database/) | [SQL Server 2022](https://www.microsoft.com/en-us/sql-server/sql-server-2022) / LocalDB (Dev Only)\n\nFor a quick Azure deployment, you can use the automation script ```Azure-Deployment\\Deploy.ps1``` to setup a ready-to-run Elf in a couple of minutes. (Azure CLI is required to run the script)\n\n### Setup Database\n\n[Create an Azure SQL Database](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-single-database-get-started?WT.mc_id=AZ-MVP-5002809) or a SQL Server 2019+ database. e.g. elf\n\nUpdate the connection string \"**ElfDatabase**\" in **appsettings.[env].json**\n\n```json\n\"ConnectionStrings\": {\n  \"ElfDatabase\": \"Server=(localdb)\\\\MSSQLLocalDB;Database=elf;Trusted_Connection=True;\"\n}\n```\n### Build Source\n\nBuild and run `./src/API/Elf.sln`\n\n### Authentication\n\nRegister an App in **[Microsoft Entra ID (Azure Active Directory)]((https://azure.microsoft.com/en-us/services/active-directory/))**\n- Set an **Application ID URI** as unique for this app\n- Expose an API with name `access_as_user` and with **Admins and users** type\n- Change `accessTokenAcceptedVersion` to `2` in Manifest blade\n- Copy \"**appId**\" to set as **EntraID:ClientId** in **appsettings.json** file\n\n```json\n\"EntraID\": {\n  \"Domain\": \"{YOUR-VALUE}\",\n  \"TenantId\": \"{YOUR-VALUE}\",\n  \"ClientId\": \"{YOUR-VALUE}\",\n}\n```\n\n### Azure Cache for Redis (Optional)\n\nTo use Redis, follow these steps:\n\n1. Create an [Azure Cache for Redis instance](https://docs.microsoft.com/en-us/azure/azure-cache-for-redis/cache-overview?WT.mc_id=AZ-MVP-5002809)\n2. Copy the connection string in \"Access keys\"\n3. Set the connection string in `ConnectionStrings:RedisConnection` in `appsettings.json` or environment variable\n4. Restart the application\n\n## Build and Run Admin Portal\n\n### Pre-requests\n\n- Visual Studio / VSCode / .NET CLI or any editor you like\n\n### Configure Microsoft Entra ID\n\n1. Navigate to the [Azure portal](https://portal.azure.com) and select the **Microsoft Entra ID** service.\n2. Select **New registration**.\n3. In the **Register an application page**, enter your application's information:\n   - In the **Name** section, for example `elf-admin`.\n   - Under **Supported account types**, select **Accounts in this organizational directory only**.\n   - In the **Redirect URI (optional)** section, select **Single-page application** and enter redirect URI: `https://localhost:7160/authentication/login-callback` for local debug and whatever URL you use in production.\n4. Select **Register** to create the application.\n5. In the app's registration screen, find and note the **Application (client) ID**. \n6. In the app's registration screen, click on the **API permissions** blade.\n   - Click the **Add a permission** button and then,\n   - Ensure that the **My APIs** tab is selected.\n   - In the list of APIs, select the API you created.\n   - In the **Delegated permissions** section, select the **access_as_user** in the list.\n   - Click on the **Add permissions**.\n   \n### Configure API endpoint\n\n1. Open `./src/Admin/Constants.cs`, replace `APIAddress`, `APIAppUrlGuid` with your own values.\n2. Open `./src/Admin/wwwroot/appsettings.json`, replace `Authority`, `ClientId` with your own values.\n\n### Run\n\n```bash\ncd ./src/Admin/\ndotnet run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fediwang%2Felf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fediwang%2Felf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fediwang%2Felf/lists"}