4.6 KiB
QuickLaunch - Server
Overview
QuickLaunch is a web application designed to provide personalized access to bookmarks and services based on user identity, which is determined by their IP address. This repository contains the server-side component of QuickLaunch, responsible for serving the client application, managing data (users, departments, links), and providing administrative APIs.
Features
- IP-based User Identification: Identifies users based on their IP address to provide personalized content.
- User Management: Centralized user entity (
users.json) storing user details, their assigned IP, and department affiliation. - Department Management: Organizes users into departments, allowing for department-specific link assignments.
- Dynamic Link Provisioning: Delivers links categorized as global, department-specific, or user-specific based on the identified user.
- Admin Panel: A web-based interface (
public/index.html) for managing users, departments, and links. - Simple JSON Data Storage: Uses flat JSON files for easy data management.
Architecture and Data Model
The server is built with Node.js and Express.js, providing RESTful APIs for both the client application and the administration panel. Data is persisted in JSON files within the data/ directory.
Data Files
-
data/users.json: Stores user information. Each user has anid,name,ip, anddepartmentIdlinking them to a specific department.[ { "id": "user_1", "name": "Alice", "ip": "192.168.1.10", "departmentId": "dept_it" } ] -
data/departments.json: Defines departments. Departments now solely focus on organizational structure and are linked to users viadepartmentId.[ { "id": "dept_it", "name": "IT Department" } ] -
data/links.json: Contains the quick access links. Links can beglobal(visible to all),department-scoped (visible to users of a specific department viatargetbeingdepartmentId), oruser-scoped (visible to a specific user viatargetbeinguserId).[ { "id": "link_1", "name": "Corporate Portal", "url": "https://portal.company.com", "scope": "global", "target": null }, { "id": "link_2", "name": "IT Jira", "url": "https://jira.company.com", "scope": "department", "target": "dept_it" }, { "id": "link_4", "name": "My Localhost", "url": "http://localhost:8080", "scope": "user", "target": "user_1" } ]
API Endpoints
Client API
GET /api/config: Returns a list of relevant links for the requesting client, determined by their IP address and associated user/department.
Admin API
Accessible via the /public/index.html admin panel.
-
Departments:
GET /api/admin/departments: Retrieve all departments.POST /api/admin/departments: Create a new department.PUT /api/admin/departments/:id: Update an existing department.DELETE /api/admin/departments/:id: Delete a department.
-
Users:
GET /api/admin/users: Retrieve all users.POST /api/admin/users: Create a new user.PUT /api/admin/users/:id: Update an existing user.DELETE /api/admin/users/:id: Delete a user.
-
Links:
GET /api/admin/links: Retrieve all links.POST /api/admin/links: Create a new link.PUT /api/admin/links/:id: Update an existing link.DELETE /api/admin/links/:id: Delete a link.
Setup and Installation
- Clone the repository:
git clone [repository-url] cd Server # Assuming this is the server directory - Install dependencies:
npm install - Run the server:
The server will start on
node server.jshttp://localhost:3000(or the port specified by thePORTenvironment variable).
Admin Panel
The server hosts a simple administration panel at /public/index.html. This panel allows administrators to:
- Manage (create, edit, delete) users, assigning them an IP and a department.
- Manage (create, edit, delete) departments.
- Manage (create, edit, delete) links, setting their scope (global, department, or user) and target.
Client Application
The client application is expected to fetch its configuration from /api/config. For details on the client-side setup and features, please refer to CLIENT_README.md.