{"id":22778978,"url":"https://github.com/sinipelto/node-lightgallery","last_synced_at":"2026-04-24T16:39:53.581Z","repository":{"id":45098441,"uuid":"443851538","full_name":"sinipelto/node-lightgallery","owner":"sinipelto","description":"NodeJS simple implementation for Lightgallery with simple access management.","archived":false,"fork":false,"pushed_at":"2023-12-10T17:08:11.000Z","size":382,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T14:13:34.802Z","etag":null,"topics":["access-control","access-management","auth","authentication","authorization","gallery","gallery-images","key-management","lightgallery","node","node-gallery","node-js","node-lightgallery","nodejs","nodejs-gallery"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/sinipelto.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":"2022-01-02T19:23:40.000Z","updated_at":"2023-12-27T01:25:23.000Z","dependencies_parsed_at":"2025-02-07T01:31:42.188Z","dependency_job_id":null,"html_url":"https://github.com/sinipelto/node-lightgallery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sinipelto/node-lightgallery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinipelto%2Fnode-lightgallery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinipelto%2Fnode-lightgallery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinipelto%2Fnode-lightgallery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinipelto%2Fnode-lightgallery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinipelto","download_url":"https://codeload.github.com/sinipelto/node-lightgallery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinipelto%2Fnode-lightgallery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32231581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["access-control","access-management","auth","authentication","authorization","gallery","gallery-images","key-management","lightgallery","node","node-gallery","node-js","node-lightgallery","nodejs","nodejs-gallery"],"created_at":"2024-12-11T20:07:27.915Z","updated_at":"2026-04-24T16:39:53.564Z","avatar_url":"https://github.com/sinipelto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-lightgallery\nNode JS simple implementation for Lightgallery with simple access token management (user interface for managing tokens).\n\nUses lightgallery (https://github.com/sachinchoolur/lightGallery) for frontend photo management.\n\n# Getting started\n\n## Requirements:\n- [Node.js runtime](https://nodejs.org/en/) \u0026 [NPM (Node Package Manager)](https://www.npmjs.com/)\n- Database server (Currently supported: [MySQL](https://www.mysql.com/))\n- \n\n## Setup instructions (Unix)\n\nStart by cloning this repo:\n\n```bash\ngit clone https://github.com/sinipelto/node-lightgallery.git ./gallery\n```\n\nGet access to a supported database or\n(Optional) Install and configure a database system from a supported db provider to a local system (e.g. for local testing).\n\nEnsure that you have access to a database (User and password, DB, a Table with CRUD permissions).\n\nGo to the repository directory:\n\n```bash\ncd ./gallery\n```\n\nInstall required dependencies:\n\n```bash\nnpm i\n```\nor\n```bash\nnpm install\n```\n\nConfigure the environment variables to match your environment:\n\n```bash\ncp .env.example .env\nnano .env\n```\n\nTo start right off, just launch the: [`server.js`](server.js):\n```bash\nnode server.js\n```\n\n(\nOR with NPM:\n```bash\nnpm start\n```\n)\n\n(Optional) Create a service for the application to ensure its running and to get proper logging/journaling:\n\nCreate a systemd daemon service for the node application:\n```bash\nnano node-gallery.service\n```\n\nWrite and Modify the following to match with your environment, OS etc.:\n```text\n[Unit]\nDescription=Systemd Service Unit for node.js Lightgallery App\nAfter=network.target network-online.target\n\n[Service]\nWorkingDirectory=/path/to/gallery\nEnvironmentFile=/path/to/gallery/.env\nType=simple\nRestart=always\nRestartSec=3\nUser=\u003cUSER or nobody\u003e\nExecStart=/usr/bin/env npm start\n\n[Install]\nWantedBy=multi-user.target\n```\n\n```text\n(USER =\u003e e.g. root/user with read access to server and gallery directory)\n```\n\nInstall the service:\n```bash\n(sudo / root user)\nsudo cp node-gallery.service /etc/systemd/system/node-gallery.service\nsudo systemctl daemon-reload\n```\n\n(Optional) Enable the service on system startup:\n```bash\n(sudo / root user)\nsudo systemctl enable node-gallery\n```\n\nFinally, start the service:\n```bash\n(sudo / root user)\nsudo systemctl start node-gallery\n```\n(\n    OR with service CLI:\n```bash\n(sudo / root user)\nsudo service node-gallery start\n```\n)\n\n## Usage instructions\n\nOnce you have the server up and running correctly, you can set up the albums.\n\nThe directory path for the albums is set in the `.env` file. Assuming it to be set to `/path/to/albums`.\n\nEnsure the directory exists:\n\n```bash\ndir=\"/path/to/albums\"; [ ! -f \"$dir\" ] \u0026\u0026 (mkdir \"$dir\" \u0026\u0026 echo \"Album dir created.\" || echo \"ERROR: Failed to create album directory.\") || echo \"Album dir already exists.\"\n```\n\nNow, add an album to the albums directory. E.g. album `test-album` would be a directory in `/path/to/albums/test-album`\n\n```bash\nmkdir /path/to/albums/test-album\n```\n\nNow, add some images/photos to the album directory. The image filename doesn't matter.\nE.g.:\n\n`/path/to/albums/test-album/img1.png`\n`/path/to/albums/test-album/img2.png`\n`/path/to/albums/test-album/img3.jpg`\n`/path/to/albums/test-album/img4.bmp`\n\n(Optional but highly recommended) You can also add a meta file to add a title and description for the album:\n```bash\nnano /path/to/albums/test-album/meta.json\n```\n\nWith a following format:\n```json\n{\n    \"title\": \"My Test Album\",\n    \"description\": \"This is my test album. You can start the slideshow by clicking one of the photos.\"\n}\n```\n\nNext, you need to generate a token for the album to access it through the web server.\n\nThe initial key for management page is generated on the first successful launch of the server.\nThe key resides in the file `tokens.json`. Get the token value from the file:\n\n```bash\ncat tokens.json\n```\n\n```json\n[\n    {\n        \"path\": \"/management\",\n        \"value\": \"\u003cTOKEN_VALUE\u003e\", // EXAMPLE TOKEN\n    },\n    ...\n]\n```\n\nGo to the management page: `http(s)://server-url/management?key=\u003cTOKEN_VALUE\u003e`.\n\nOR to create the URL programmatically:\n\n```bash\necho \"http(s)://\u003cYOUR-SERVER-URL\u003e:\u003cPORT\u003e/management?key=$(cat tokens.json | grep \"management\" -m1 -A1 | tr { '\\n' | tr , '\\n' | tr } '\\n' | grep \"value\" | awk  -F'\"' '{print $4}')\"\n```\n\ne.g.\n```bash\necho \"http://127.0.0.1/management?key=$(cat tokens.json | grep \"management\" -m1 -A1 | tr { '\\n' | tr , '\\n' | tr } '\\n' | grep \"value\" | awk  -F'\"' '{print $4}')\"\n```\n\nFrom the Management page you can manage (create, edit, delete, disable) all of the access tokens (including management and index page keys).\n\nCAUTION: Never delete the last known active key to the /management route or you **WILL LOSE ACCESS to the management interface** until a new key is manually created into the DB / the db is reset (table deleted).\n\nNext, generate a new token for the just created album (see the 'Create new key' section).\n\nThe new album with all the photos included in the album directory is now accessible in: `http(s)://server-url/test-album?key=\u003cTOKEN_FOR_THE_ALBUM\u003e`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinipelto%2Fnode-lightgallery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinipelto%2Fnode-lightgallery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinipelto%2Fnode-lightgallery/lists"}