{"id":27493490,"url":"https://github.com/thisoverride/glcsvc","last_synced_at":"2025-04-17T01:25:26.157Z","repository":{"id":283336284,"uuid":"951441736","full_name":"thisoverride/glcsvc","owner":"thisoverride","description":"A lightweight Unix socket-based service that provides device geolocation data using Selenium. Easily retrieve location coordinates through a simple JSON protocol.","archived":false,"fork":false,"pushed_at":"2025-04-02T00:42:02.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T01:31:03.799Z","etag":null,"topics":["geolocation","geolocation-api","location-services","selenium-python","socket-communication-protocol","unix-socket-ipc"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thisoverride.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-03-19T17:24:31.000Z","updated_at":"2025-04-02T00:44:06.000Z","dependencies_parsed_at":"2025-03-19T18:44:00.257Z","dependency_job_id":null,"html_url":"https://github.com/thisoverride/glcsvc","commit_stats":null,"previous_names":["thisoverride/glcsvc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisoverride%2Fglcsvc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisoverride%2Fglcsvc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisoverride%2Fglcsvc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisoverride%2Fglcsvc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisoverride","download_url":"https://codeload.github.com/thisoverride/glcsvc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249296864,"owners_count":21246309,"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":["geolocation","geolocation-api","location-services","selenium-python","socket-communication-protocol","unix-socket-ipc"],"created_at":"2025-04-17T01:25:25.623Z","updated_at":"2025-04-17T01:25:26.155Z","avatar_url":"https://github.com/thisoverride.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geolocation Service with Unix Socket Interface\n\nThis project provides a reliable geolocation service that retrieves user location data through a browser-based approach and exposes it via a Unix domain socket interface. It combines Selenium WebDriver automation with socket-based IPC to deliver accurate geolocation information to local system components.\n\nThe service uses Chrome in headless mode to access the browser's Geolocation API, providing high-accuracy location data including latitude, longitude, and accuracy metrics. It implements intelligent caching to minimize resource usage while maintaining data freshness, and exposes a robust Unix socket interface with proper error handling and validation. The service is designed for integration with local system components that require reliable geolocation data.\n\n## Repository Structure\n```\n.\n├── controllers/\n│   └── LocationController.py\n├── services/\n│   └── LocationService.py\n├── template/\n│   └── index.html\n├── tests/\n│   ├── __init__.py\n│   └── test_location_service.py\n├── main.py\n└── requirements.txt\n```\n\n## Usage Instructions\n### Prerequisites\n- Python 3.6 or higher\n- Chrome browser installed\n- Unix-like operating system (Linux/MacOS) for Unix socket support\n- The following Python packages:\n  - selenium==4.30.0\n  - webdriver_manager==4.0.2\n\n### Installation\n1. Clone the repository:\n```bash\ngit clone https://github.com/thisoverride/glcsvc\ncd glcsvc\n```\n\n2. Create and activate a virtual environment:\n```bash\npython -m venv .venv\nsource .venv/bin/activate  # On Linux/MacOS\n# or\n.venv\\Scripts\\activate     # On Windows\n```\n\n3. Install dependencies:\n```bash\npip install -r requirements.txt\n```\n\n### Quick Start\n1. Start the geolocation service:\n```bash\npython main.py\n```\n\n2. The service will create a Unix socket at `/tmp/sme-glcsvc.sock`\n\n3. Connect to the service using a Unix socket client:\n```python\nimport socket\nimport json\n\nclient = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\nclient.connect('/tmp/sme-glcsvc.sock')\n\nrequest = {\n    \"source\": \"CTL_LOCAL_SYS\",\n    \"version\": 1.0,\n    \"request\": {\n        \"type\": \"GET_LOC\"\n    }\n}\n\nclient.send(json.dumps(request).encode('utf-8'))\nresponse = client.recv(1024)\nprint(json.loads(response.decode('utf-8')))\n```\n\n### More Detailed Examples\nExample response format:\n```json\n{\n    \"location\": {\n        \"timestamp\": \"2023-09-20T14:30:00.123456\",\n        \"geolocation\": {\n            \"latitude\": 37.7749,\n            \"longitude\": -122.4194,\n            \"accuracy\": 10\n        }\n    }\n}\n```\n\n### Troubleshooting\nCommon issues and solutions:\n\n1. Socket file already exists:\n   - Error: `RuntimeError: The socket file /tmp/sme-glcsvc.sock already exists`\n   - Solution: Remove the existing socket file:\n     ```bash\n     rm /tmp/sme-glcsvc.sock\n     ```\n\n2. Chrome driver issues:\n   - Error: `WebDriver not initialized`\n   - Solution: Ensure Chrome is installed and up to date:\n     ```bash\n     # On Ubuntu/Debian\n     sudo apt update \u0026\u0026 sudo apt install google-chrome-stable\n     ```\n\n3. Permission issues:\n   - Error: `Permission denied: '/tmp/sme-glcsvc.sock'`\n   - Solution: Check socket file permissions:\n     ```bash\n     sudo chmod 777 /tmp/sme-glcsvc.sock\n     ```\n\n## Data Flow\nThe service uses a browser-based approach to access the Geolocation API, processes the data through Selenium WebDriver, and serves it via a Unix domain socket.\n\n```ascii\n[Browser Geolocation API] -\u003e [Selenium WebDriver] -\u003e [LocationService]\n           |                                                |\n           v                                                v\n    [HTML Template]                                 [Location Cache]\n           |                                                |\n           |                                                v\n           +-------------\u003e [LocationController] \u003c-----------+\n                                   |\n                                   v\n                         [Unix Domain Socket]\n                                   |\n                                   v\n                         [Client Applications]\n```\n\nComponent interactions:\n1. LocationService initializes Chrome in headless mode with Selenium WebDriver\n2. HTML template accesses browser's Geolocation API\n3. LocationService caches location data for 10 seconds\n4. LocationController validates incoming socket requests\n5. Valid requests trigger location retrieval from LocationService\n6. Location data is returned to clients in JSON format\n7. Error responses include specific error types and messages","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisoverride%2Fglcsvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisoverride%2Fglcsvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisoverride%2Fglcsvc/lists"}