Skip to content

Dev#3

Merged
simwai merged 12 commits into
masterfrom
dev
Jun 6, 2025
Merged

Dev#3
simwai merged 12 commits into
masterfrom
dev

Conversation

@simwai
Copy link
Copy Markdown
Owner

@simwai simwai commented Jun 6, 2025

No description provided.

simwai added 12 commits June 1, 2025 16:46
This commit reverts the API base URL in the frontend code back to the production URL. The previous change was premature.
This commit introduces a persistent lyrics caching system using SQLite, improves the frontend UI, and enhances error handling.

- Implements SQLite caching for lyrics to reduce API calls to Genius and improve performance.
- Adds admin endpoints for cache management (clear cache, get cache stats) protected by an ADMIN_KEY.
- Updates the `.gitignore` file to exclude the SQLite database file.
- Modifies the `.env.example` file to include an ADMIN_KEY variable.
- Removes `.babelrc` and `scripts/build-frontend.js` as the build process is now handled differently.
- Updates `package.json` with new dependencies (sequelize, sqlite3, prettier-eslint, concurrently, cpx2, rimraf) and modifies build scripts.
- Updates `.vscode/settings.json` to configure code formatting with prettier-eslint.
- Updates `.stylelintrc` to remove unnecessary rules.
- Removes `src/config.js` as configuration is now handled via environment variables.
- Modifies `src/index.html` to streamline the HTML structure.
- Enhances `src/index.js` with token management, improved error handling, and playlist rendering.
- Updates `server.js` to integrate SQLite caching, implement admin endpoints, and improve error handling.
- Updates `README.md` to document the new caching system, admin endpoints, and updated dependencies.
- Fixes minor styling issues in `src/index.css`.
- Updates `.github/workflows/deploy.yml` to align with the new build process.
This commit addresses several minor UI and code formatting issues:

- Updates the async function declaration in `src/index.js` for better readability.
- Updates `.vscode/settings.json` to improve code formatting.
- Adjusts CSS in `src/index.css` for better visual appearance, including tag input focus and footer padding.
- Updates `src/index.html` to include favicon and meta tag updates, and to use Bootstrap and Font Awesome from CDNs.
This commit removes the `babel-node` dependency from `package.json`. It is no longer needed.
…cess

This commit moves static assets from `src/res` to the top-level `res` directory. This change improves project organization and simplifies the build process.

- Moves image assets (music-icon.png, spotify-icon.svg, favicon files) from `src/res` to `res`.
- Updates the `build` script in `package.json` to copy assets from both `src` and `res` directories to the `dist` directory.
…s caching

This commit introduces a major refactor of the application architecture, implementing a modular design with clear separation of concerns, and persistent lyrics caching using SQLite.

- Implements a modular architecture with services, routes, middleware, models, clients, and utils directories.
- Introduces SQLite database integration for persistent lyrics caching using Sequelize.
- Adds admin routes and services for cache management (clear cache, get cache stats) protected by an ADMIN_KEY.
- Updates `.env.example` to include ADMIN_KEY and clarifies environment variable usage.
- Adds new dependencies (sequelize, sqlite3, needle, cors, cookie-parser, he) and updates build scripts in `package.json`.
- Configures code formatting with prettier-eslint in `.vscode/settings.json`.
- Implements middleware for authentication, error handling, and request processing.
- Creates routes for authentication, lyrics search, and static file serving.
- Implements services for Spotify authentication, lyrics processing, and admin operations.
- Adds a Genius API client to handle communication with the Genius API.
- Implements utility functions for cache key generation, lyrics extraction, and random string generation.
- Updates `README.md` to document the new architecture, caching system, admin endpoints, and updated dependencies.
- Implements comprehensive error handling throughout the application.
…sertions

This commit enhances the client-side and lyrics tests with improved mocks and assertions to ensure more robust and reliable testing.

- **lyrics-client.test.js:**
  - Removes unnecessary global fetch mock.
  - Simplifies mock result handling.
  - Improves null song ID handling in `fetchLyrics` test.
  - Simplifies mock lyrics extraction.
- **client.test.js:**
  - Streamlines jQuery mocking.
  - Simplifies DOM API mocking.
  - Improves hash parameter parsing test.
  - Simplifies navigation handler test.
- **lyrics.test.js:**
  - Simplifies lyrics search test by removing unnecessary comments.
  - Improves error handling test for missing parameters.
  - Simplifies lyrics extraction test.
- **server.test.js:**
  - Simplifies mock setup and assertion.
  - Improves authentication flow tests with more precise mocking.
  - Adds test case for successful authentication callback with valid state.
  - Simplifies refresh token test.
This commit adds a `launch.json` file to the `.vscode` directory, providing a launch configuration for debugging the application in Google Chrome at `http://localhost:8888`. This simplifies the debugging process for developers.
…pdates

This commit introduces dependency injection using a custom container, refactors the frontend, updates the server-side architecture, and removes admin-related features.

- Implements a simple dependency injection container in `src/container` to manage service dependencies.
- Adds `src/types.js` to define service identifiers for dependency injection.
- Modifies route handlers (`src/routes/auth.js`, `src/routes/lyrics.js`) to accept the container and resolve dependencies.
- Updates `src/services/lyrics.js` to receive dependencies via constructor injection.
- Refactors the server entry point (`src/server.js`) to set up the container and pass it to route handlers.
- Moves static assets and frontend code to a dedicated `frontend` directory.
- Updates the `.gitignore` file to ignore `.old` files.
- Removes the `src/app.js`, `src/routes/static.js`, `src/services/admin.js`, and `src/routes/admin.js` files, along with the admin key from `.env.example` and related admin authentication middleware.
- Updates `.eslintrc` to include the `eslint-plugin-json` plugin.
- Updates `.vscode/extensions.json` to include path-intellisense and unocss extensions.
- Updates `.vscode/settings.json` to enable path-intellisense extension on import.
- Updates `package.json` to remove unused dependencies and update scripts.
- Adds a basic `uno.config.ts` file to bypass VS Code extension requirements.
- Updates `README.md` to reflect the architectural changes and remove references to admin features.
- Updates `src/config/index.js` to remove admin key and add app redirect URL.
- Updates `src/middleware/index.js` to remove static file serving.
- Updates `src/services/spotify-auth.js` to improve error handling and token management.
- Adds a new authentication flow diagram to `README.md`.
@simwai simwai merged commit bc0aaeb into master Jun 6, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant