{"id":42237718,"url":"https://github.com/dadav/sroreg","last_synced_at":"2026-01-27T03:42:29.270Z","repository":{"id":333744298,"uuid":"1127823742","full_name":"dadav/sroreg","owner":"dadav","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-20T20:00:30.000Z","size":591,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-21T04:49:22.114Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/dadav.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-04T17:01:26.000Z","updated_at":"2026-01-20T19:59:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dadav/sroreg","commit_stats":null,"previous_names":["dadav/sroreg"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/dadav/sroreg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadav%2Fsroreg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadav%2Fsroreg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadav%2Fsroreg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadav%2Fsroreg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dadav","download_url":"https://codeload.github.com/dadav/sroreg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadav%2Fsroreg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28800308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:37:11.304Z","status":"ssl_error","status_checked_at":"2026-01-27T03:37:10.427Z","response_time":168,"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":[],"created_at":"2026-01-27T03:42:27.836Z","updated_at":"2026-01-27T03:42:29.265Z","avatar_url":"https://github.com/dadav.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Silkroad Online Registration Website\n\nA beautiful split-screen registration website for Silkroad Online built with Go.\n\n## Features\n\n- Modern split-screen design with official Silkroad Online logo\n- Clean, spacious form layout with yellow/black theme\n- **Comprehensive validation:**\n  - Frontend: HTML5 pattern validation with instant feedback\n  - Backend: Regex validation for username (alphanumeric only) and email\n  - Password strength requirements (minimum 6 characters)\n  - Password confirmation matching\n- **SQL Injection Protection:**\n  - Parameterized queries (@p1, @p2, @p3)\n  - Input sanitization and validation\n  - No direct string concatenation in queries\n- **TLS/HTTPS Support:**\n  - Optional TLS encryption for secure connections\n  - Self-signed certificate generation for development\n  - Production-ready with proper CA certificates\n- **Flexible Configuration:**\n  - Environment variables\n  - Command-line flags\n  - Configurable database connection and server port\n- Duplicate username checking\n- MD5 password hashing\n- Automatic security level assignment (sec_primary and sec_content set to 3)\n- Fully responsive design\n- Form never exceeds viewport height\n\n## Design\n\n- **Left Panel**: Beautiful background image with gradient overlay\n- **Right Panel**: Registration form with clean, modern styling\n- **Mobile Responsive**: Adapts to vertical layout on smaller screens\n\n## Configuration\n\nThe application can be configured using environment variables or command-line flags.\n\n### Environment Variables\n\nCreate a `.env` file (use `.env.example` as template):\n\n```bash\n# Database Configuration\nDB_SERVER=localhost\nDB_PORT=1433\nDB_USER=sa\nDB_PASSWORD=YourPasswordHere\nDB_DATABASE=SRO_VT_ACCOUNT\n\n# Server Configuration\nSERVER_PORT=8080\n```\n\n### Command-Line Flags\n\nAll settings can be overridden using command-line flags:\n\n```bash\n./sroreg --db-server localhost \\\n         --db-port 1433 \\\n         --db-user sa \\\n         --db-password YourPassword \\\n         --db-database SRO_VT_ACCOUNT \\\n         --port 8080\n```\n\n### TLS/HTTPS Support\n\nThe application supports TLS/HTTPS for secure connections:\n\n**Environment Variables:**\n```bash\nTLS_ENABLED=true\nTLS_CERT=./certs/server.crt\nTLS_KEY=./certs/server.key\n```\n\n**Command-Line Flags:**\n```bash\n./sroreg --tls --tls-cert ./certs/server.crt --tls-key ./certs/server.key\n```\n\n**Generate Self-Signed Certificate (for development):**\n```bash\n./generate-cert.sh\n```\n\nThis creates `certs/server.crt` and `certs/server.key` for testing purposes.\n\n**⚠️ Important:** Self-signed certificates are for development only. In production, use certificates from a trusted Certificate Authority (CA) like Let's Encrypt.\n\n**Running with TLS:**\n```bash\n# Using environment variables\nTLS_ENABLED=true TLS_CERT=./certs/server.crt TLS_KEY=./certs/server.key DB_PASSWORD=YourPassword go run main.go\n\n# Using flags\ngo run main.go --tls --tls-cert ./certs/server.crt --tls-key ./certs/server.key --db-password YourPassword\n```\n\nThe server will be accessible at `https://localhost:8080` (or your configured port).\n\n### Reverse Proxy Support\n\nFor production deployments, it's recommended to use a reverse proxy like Caddy or Nginx in front of the application. This provides:\n- Automatic HTTPS with Let's Encrypt\n- Load balancing\n- Security headers\n- Access logging\n\n**Using Caddy (Recommended):**\n\n1. Copy the example Caddyfile:\n   ```bash\n   cp Caddyfile.example Caddyfile\n   ```\n\n2. Edit the Caddyfile and replace `register.silkroad-example.com` with your domain\n\n3. Run the Go application on HTTP (Caddy will handle TLS):\n   ```bash\n   DB_PASSWORD=YourPassword ./sroreg --port 8080\n   ```\n\n4. Start Caddy:\n   ```bash\n   caddy run\n   ```\n\nCaddy will automatically:\n- Obtain TLS certificates from Let's Encrypt\n- Handle HTTPS connections\n- Forward requests to your Go application\n- Renew certificates before expiration\n\n**Using Nginx:**\n\nExample Nginx configuration:\n```nginx\nserver {\n    listen 80;\n    server_name register.silkroad-example.com;\n    return 301 https://$server_name$request_uri;\n}\n\nserver {\n    listen 443 ssl http2;\n    server_name register.silkroad-example.com;\n\n    ssl_certificate /path/to/fullchain.pem;\n    ssl_certificate_key /path/to/privkey.pem;\n\n    location / {\n        proxy_pass http://localhost:8080;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n    }\n}\n```\n\n### Configuration Priority\n\nConfiguration is loaded in the following order (later overrides earlier):\n1. Default values (localhost:1433, port 8080)\n2. Environment variables\n3. Command-line flags\n\n### Database Schema\n\n- Database: SRO_VT_ACCOUNT\n- Table: dbo.TB_User\n- Columns used: StrUserID, password, Email, sec_primary, sec_content\n\n## Running the Application\n\n### Windows Quick Start (One-Click)\n\nFor Windows users, you can use the provided startup scripts:\n\n**Option 1: Batch File (start.bat)** - Recommended for simplicity\n1. Double-click `start.bat`\n2. Enter your database password when prompted\n3. Press Enter to start the server\n\n**Option 2: PowerShell (start.ps1)** - Recommended for security (masked password input)\n1. Right-click `start.ps1` and select \"Run with PowerShell\"\n2. Enter your database password when prompted (input will be hidden)\n3. Press Enter to start the server\n\nBoth scripts will:\n- Prompt for the database password securely (no hardcoded passwords)\n- Use the compiled `sroreg.exe` binary if available\n- Fall back to `go run main.go` if no binary is found\n- Keep the window open so you can see the server logs\n\n**Note:** Before first use:\n- Build the binary: `go build -o sroreg.exe main.go`\n- Or ensure Go is installed to use `go run main.go`\n\n**Security:** The PowerShell script masks password input for better security, while the batch file shows the password as you type.\n\n### Using Environment Variables\n\n1. Copy the example environment file:\n   ```bash\n   cp .env.example .env\n   ```\n\n2. Edit `.env` and set your database password\n\n3. Run the server:\n   ```bash\n   export $(cat .env | xargs)\n   go run main.go\n   ```\n\n### Using Command-Line Flags\n\n```bash\ngo run main.go --db-password YourPassword --port 8080\n```\n\n### Quick Start (with defaults)\n\n```bash\nDB_PASSWORD=Foobarfoobar2 go run main.go\n```\n\nThe server will start on http://localhost:8080 (or the port you configured)\n\n## Building and Releases\n\n### Automated Releases (GitHub Actions)\n\nThe project uses GoReleaser with GitHub Actions to automatically build binaries for multiple platforms when you push a tag:\n\n1. Create and push a new tag:\n   ```bash\n   git tag -a v1.0.0 -m \"Release v1.0.0\"\n   git push origin v1.0.0\n   ```\n\n2. GitHub Actions will automatically:\n   - Build binaries for Linux (amd64, arm64) and Windows (amd64)\n   - Create release archives with templates and static files included\n   - Generate checksums\n   - Create a GitHub release with all artifacts\n\n### Manual Build\n\nTo build manually for your current platform:\n```bash\ngo build -o sroreg main.go\n```\n\nTo build for a specific platform:\n```bash\n# Linux\nGOOS=linux GOARCH=amd64 go build -o sroreg-linux-amd64 main.go\n\n# Windows\nGOOS=windows GOARCH=amd64 go build -o sroreg-windows-amd64.exe main.go\n```\n\n### Release Artifacts\n\nEach release includes:\n- Pre-compiled binaries for Linux and Windows\n- All necessary templates and static files\n- README and documentation\n- Checksums for verification\n\n## Customization\n\nYou can replace the background image by updating `static/silkroad-bg.jpg` with your own Silkroad Online themed image.\n\n## Project Structure\n\n```\nsroreg/\n├── main.go                    # Main application with database logic\n├── templates/\n│   └── register.html         # Registration form template\n├── static/\n│   ├── style.css            # Modern split-screen styling\n│   └── silkroad-bg.jpg      # Background image (can be replaced)\n├── go.mod                   # Go module dependencies\n└── README.md               # This file\n```\n\n## How It Works\n\n1. User fills out the registration form with username, email, and password\n2. Frontend validation ensures proper input lengths\n3. Backend checks for duplicate usernames using StrUserID\n4. Password is hashed using MD5\n5. New user is inserted with sec_primary=3 and sec_content=3 (regular user, not admin)\n6. Success or error message is displayed to the user\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadav%2Fsroreg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdadav%2Fsroreg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadav%2Fsroreg/lists"}