{"id":17217596,"url":"https://github.com/lrstanley/links","last_synced_at":"2025-05-09T01:45:45.421Z","repository":{"id":16654315,"uuid":"19409776","full_name":"lrstanley/links","owner":"lrstanley","description":"Simple, fast link shortener","archived":true,"fork":false,"pushed_at":"2025-04-03T22:10:49.000Z","size":1323,"stargazers_count":52,"open_issues_count":1,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-09T01:45:37.338Z","etag":null,"topics":["cli","docker","go","golang","google-safebrowsing","link-shortener"],"latest_commit_sha":null,"homepage":"","language":"Go","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/lrstanley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"lrstanley"}},"created_at":"2014-05-03T18:50:16.000Z","updated_at":"2025-04-03T22:10:54.000Z","dependencies_parsed_at":"2024-01-25T05:29:05.453Z","dependency_job_id":"ce6b2c52-5369-4e17-848a-f787963ed4bd","html_url":"https://github.com/lrstanley/links","commit_stats":null,"previous_names":["lrstanley/links.ml"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrstanley%2Flinks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrstanley%2Flinks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrstanley%2Flinks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrstanley%2Flinks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lrstanley","download_url":"https://codeload.github.com/lrstanley/links/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176443,"owners_count":21866142,"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","docker","go","golang","google-safebrowsing","link-shortener"],"created_at":"2024-10-15T03:44:22.651Z","updated_at":"2025-05-09T01:45:45.405Z","avatar_url":"https://github.com/lrstanley.png","language":"Go","funding_links":["https://github.com/sponsors/lrstanley"],"categories":[],"sub_categories":[],"readme":"\u003c!-- template:define:options\n{\n  \"nodescription\": true\n}\n--\u003e\n![logo](https://liam.sh/-/gh/svg/lrstanley/links?icon=ph%3Alink-simple\u0026icon.height=65\u0026layout=left\u0026icon.color=rgba%280%2C+184%2C+126%2C+1%29\u0026font=1.3)\n\n\u003c!-- template:begin:header --\u003e\n\u003c!-- do not edit anything in this \"template\" block, its auto-generated --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/releases\"\u003e\n    \u003cimg title=\"Release Downloads\" src=\"https://img.shields.io/github/downloads/lrstanley/links/total?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/tags\"\u003e\n    \u003cimg title=\"Latest Semver Tag\" src=\"https://img.shields.io/github/v/tag/lrstanley/links?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/commits/master\"\u003e\n    \u003cimg title=\"Last commit\" src=\"https://img.shields.io/github/last-commit/lrstanley/links?style=flat-square\"\u003e\n  \u003c/a\u003e\n\n\n\n\n  \u003ca href=\"https://github.com/lrstanley/links/actions?query=workflow%3Atest+event%3Apush\"\u003e\n    \u003cimg title=\"GitHub Workflow Status (test @ master)\" src=\"https://img.shields.io/github/actions/workflow/status/lrstanley/links/test.yml?branch=master\u0026label=test\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n\n\n\n\n  \u003ca href=\"https://codecov.io/gh/lrstanley/links\"\u003e\n    \u003cimg title=\"Code Coverage\" src=\"https://img.shields.io/codecov/c/github/lrstanley/links/master?style=flat-square\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://pkg.go.dev/github.com/lrstanley/links\"\u003e\n    \u003cimg title=\"Go Documentation\" src=\"https://pkg.go.dev/badge/github.com/lrstanley/links?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/lrstanley/links\"\u003e\n    \u003cimg title=\"Go Report Card\" src=\"https://goreportcard.com/badge/github.com/lrstanley/links?style=flat-square\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/issues?q=is:open+is:issue+label:bug\"\u003e\n    \u003cimg title=\"Bug reports\" src=\"https://img.shields.io/github/issues/lrstanley/links/bug?label=issues\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/issues?q=is:open+is:issue+label:enhancement\"\u003e\n    \u003cimg title=\"Feature requests\" src=\"https://img.shields.io/github/issues/lrstanley/links/enhancement?label=feature%20requests\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/pulls\"\u003e\n    \u003cimg title=\"Open Pull Requests\" src=\"https://img.shields.io/github/issues-pr/lrstanley/links?label=prs\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/releases\"\u003e\n    \u003cimg title=\"Latest Semver Release\" src=\"https://img.shields.io/github/v/release/lrstanley/links?style=flat-square\"\u003e\n    \u003cimg title=\"Latest Release Date\" src=\"https://img.shields.io/github/release-date/lrstanley/links?label=date\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/lrstanley/links/discussions/new?category=q-a\"\u003e\n    \u003cimg title=\"Ask a Question\" src=\"https://img.shields.io/badge/support-ask_a_question!-blue?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://liam.sh/chat\"\u003e\u003cimg src=\"https://img.shields.io/badge/discord-bytecord-blue.svg?style=flat-square\" title=\"Discord Chat\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003c!-- template:end:header --\u003e\n\n\u003c!-- template:begin:toc --\u003e\n\u003c!-- do not edit anything in this \"template\" block, its auto-generated --\u003e\n## :link: Table of Contents\n\n  - [Installation](#computer-installation)\n    - [Container Images (ghcr)](#whale-container-images-ghcr)\n    - [Source](#toolbox-source)\n  - [Usage](#gear-usage)\n    - [Dot-env](#dot-env)\n    - [Example](#example)\n    - [Google SafeBrowsing](#google-safebrowsing)\n  - [Using as a library](#using-as-a-library)\n    - [Example](#example-1)\n  - [API](#api)\n      - [Password protection](#password-protection)\n  - [Support \u0026amp; Assistance](#raising_hand_man-support--assistance)\n  - [Contributing](#handshake-contributing)\n  - [License](#balance_scale-license)\n\u003c!-- template:end:toc --\u003e\n\n## :computer: Installation\n\nCheck out the [releases](https://github.com/lrstanley/links/releases)\npage for prebuilt versions.\n\n\u003c!-- template:begin:ghcr --\u003e\n\u003c!-- do not edit anything in this \"template\" block, its auto-generated --\u003e\n### :whale: Container Images (ghcr)\n\n```console\n$ docker run -it --rm ghcr.io/lrstanley/links:master\n```\n\u003c!-- template:end:ghcr --\u003e\n\n### :toolbox: Source\n\nNote that you must have [Go](https://golang.org/doc/install) installed (latest is usually best).\n\n```console\n$ git clone https://github.com/lrstanley/links.git \u0026\u0026 cd links\n$ make\n$ ./links --help\n```\n\n## :gear: Usage\n\n```\n$ links --help\nUsage:\n  links [OPTIONS] [add | delete]\n\nApplication Options:\n  -s, --site-name=                      site url, used for url generation (default: https://links.wtf) [$SITE_URL]\n      --session-dir=                    optional location to store temporary sessions [$SESSION_DIR]\n  -q, --quiet                           don't log to stdout [$QUIET]\n      --debug                           enable debugging (pprof endpoints) [$DEBUG]\n  -b, --http=                           ip:port pair to bind to (default: :8080) [$HTTP]\n  -p, --behind-proxy                    if X-Forwarded-For headers should be trusted [$PROXY]\n  -d, --db=                             path to database file (default: store.db) [$DB_PATH]\n      --key-length=                     default length of key (uuid) for generated urls (default: 4) [$KEY_LENGTH]\n      --http-pre-include=               HTTP include which is included directly after css is included (near top of the page)\n                                        [$HTTP_PRE_INCLUDE]\n      --http-post-include=              HTTP include which is included directly after js is included (near bottom of the page)\n                                        [$HTTP_POST_INCLUDE]\n  -e, --export-file=                    file to export db to (default: links.export)\n      --export-json                     export db to json elements\n  -v, --version                         display the version of links.wtf and exit\n\nTLS Options:\n      --tls.enable                      run tls server rather than standard http [$TLS_ENABLE]\n  -c, --tls.cert=                       path to ssl cert file [$TLS_CERT_PATH]\n  -k, --tls.key=                        path to ssl key file [$TLS_KEY_PATH]\n\nSafe Browsing Support:\n      --safebrowsing.api-key=           Google API Key used for querying SafeBrowsing, disabled if not provided (see:\n                                        https://github.com/lrstanley/links#google-safebrowsing) [$SAFEBROWSING_API_KEY]\n      --safebrowsing.db=                path to SafeBrowsing database file (default: safebrowsing.db) [$SAFEBROWSING_DB_PATH]\n      --safebrowsing.update-period=     duration between updates to the SafeBrowsing API local database (default: 1h)\n                                        [$SAFEBROWSING_UPDATE_PERIOD]\n      --safebrowsing.redirect-fallback  if the SafeBrowsing request fails (local cache, and remote hit), this still lets the\n                                        redirect happen [$SAFEBROWSING_REDIRECT_FALLBACK]\n\nPrometheus Metrics:\n      --prom.enabled                    enable exposing of prometheus metrics (on std port, or --prometheus.addr) [$PROM_ENABLED]\n      --prom.addr=                      expose on custom address/port, e.g. ':9001' (all ips) or 'localhost:9001' (local only)\n                                        [$PROM_ADDR]\n      --prom.endpoint=                  endpoint to expose metrics on (default: /metrics) [$PROM_ENDPOINT]\n\nHelp Options:\n  -h, --help                            Show this help message\n\nAvailable commands:\n  add     add a link\n  delete  delete a link, id, or link matching an author\n\n```\n\n### Dot-env\n\nLinks also supports a `.env` file for loading environment variables. Example:\n\n```\nSAFEBROWSING_API_KEY=\u003cyour-secret-key\u003e\nFOO=BAR\n```\n\n### Example\n\n```\n$ links -s \"http://your-domain.com\" -b \"0.0.0.0:80\" -d links.db\n```\n\n### Google SafeBrowsing\n\nLinks supports utilizing [Google SafeBrowsing](https://safebrowsing.google.com/),\n(see `Safe Browsing Support` under ##Usage). This helps prevent users being\nredirected to malicious or otherwise harmful websites. It does require a Google\nDeveloper account (free).\n\n   1. Go to the [Google Developer Console](https://console.developers.google.com/)\n   2. Create a new project (dropdown top left, click `NEW PROJECT`)\n   3. Enable the \"Safe Browsing\" API\n   4. Create a new credential (API key)\n\nScreenshot example:\n![](https://i.imgur.com/VHyPYqi.png)\n\n## Using as a library\n\nLinks also has a Go client library which you can use, which adds a simple\nwrapper around an http call, to make shortening links simpler. Download it\nusing the following `go get` command:\n\n```\n$ go get -u github.com/lrstanley/links/client\n```\n\nView the documentation [here](https://godoc.org/github.com/lrstanley/links/client)\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\tlinks \"github.com/lrstanley/links/client\"\n)\n\nfunc main() {\n\turi, err := links.Shorten(\"https://your-long-link.com/longer/link\", \"\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to shorten link: %s\", err)\n\t}\n\n\tfmt.Printf(\"shortened: %s\n\", uri.String())\n}\n```\n\n## API\n\nShortening a link is quite easy. simply send a `POST` request to `https://example.com/add`,\nwhich will return JSON-safe information as shown below:\n\n```\n$ curl --data \"url=http://google.com\" https://example.com/add\n{\"url\": \"https://example.com/27f4\", \"success\": true}\n```\n\n#### Password protection\n\nYou can also password protect a link, simply by adding a `password` variable to the payload:\n\n```\n$ curl --data 'url=https://google.com/example\u0026encrypt=y0urp4$$w0rd' https://example.com/add\n{\"url\": \"https://example.com/abc123\", \"success\": true}\n```\n\n\u003c!-- template:begin:support --\u003e\n\u003c!-- do not edit anything in this \"template\" block, its auto-generated --\u003e\n## :raising_hand_man: Support \u0026 Assistance\n\n* :heart: Please review the [Code of Conduct](.github/CODE_OF_CONDUCT.md) for\n     guidelines on ensuring everyone has the best experience interacting with\n     the community.\n* :raising_hand_man: Take a look at the [support](.github/SUPPORT.md) document on\n     guidelines for tips on how to ask the right questions.\n* :lady_beetle: For all features/bugs/issues/questions/etc, [head over here](https://github.com/lrstanley/links/issues/new/choose).\n\u003c!-- template:end:support --\u003e\n\n\u003c!-- template:begin:contributing --\u003e\n\u003c!-- do not edit anything in this \"template\" block, its auto-generated --\u003e\n## :handshake: Contributing\n\n* :heart: Please review the [Code of Conduct](.github/CODE_OF_CONDUCT.md) for guidelines\n     on ensuring everyone has the best experience interacting with the\n    community.\n* :clipboard: Please review the [contributing](.github/CONTRIBUTING.md) doc for submitting\n     issues/a guide on submitting pull requests and helping out.\n* :old_key: For anything security related, please review this repositories [security policy](https://github.com/lrstanley/links/security/policy).\n\u003c!-- template:end:contributing --\u003e\n\n\u003c!-- template:begin:license --\u003e\n\u003c!-- do not edit anything in this \"template\" block, its auto-generated --\u003e\n## :balance_scale: License\n\n```\nMIT License\n\nCopyright (c) 2014 Liam Stanley \u003cliam@liam.sh\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n_Also located [here](LICENSE)_\n\u003c!-- template:end:license --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flrstanley%2Flinks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flrstanley%2Flinks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flrstanley%2Flinks/lists"}