147 Commits

Author SHA1 Message Date
d6fd055cd5 fix(handlers): add HTTP redirect for API requests
- Implemented an HTTP redirect to a random URL in the HandleAPIRequest function, enhancing user experience by guiding users to the appropriate resource after processing their request.
2024-12-01 00:20:23 +08:00
80d18f2b88 feat(config, handlers, middleware): enhance configuration and API request handling
- Added performance settings to the configuration, including max concurrent requests and caching options.
- Updated API request handling to use context for timeouts and improved logging with Unix timestamps.
- Introduced rate limiting middleware to manage request load effectively.
- Enhanced metrics logging to include atomic counters for request counts and improved data structure for performance metrics.
- Implemented caching for CSV content to optimize data retrieval and reduce load times.
2024-12-01 00:14:21 +08:00
83e0226e41 feat(monitoring, public): enhance metrics logging and display
- Added a new function to format latency metrics in both Go and JavaScript for improved readability.
- Updated the LogRequest function to parse and store only the domain of the referer, enhancing data clarity.
- Modified the recent requests and top referers display logic in the HTML to improve performance and maintainability.
- Ensured that the recent requests are displayed in a more user-friendly format, including formatted latency values.
2024-12-01 00:03:26 +08:00
fd9c616aa2 feat(main, handlers): initialize random number generator and enhance URL stats response format
- Added initialization of a random number generator in main.go to support future features.
- Refactored HandleURLStats in handlers.go to return URL statistics in a structured format, improving API response clarity and usability.
2024-11-30 23:56:21 +08:00
1b2fd3ea85 feat(handlers, monitoring, public): enhance API request handling and improve metrics logging
- Implemented detailed logging for API requests, including real IP, referer, and latency metrics.
- Added dynamic routing for handling requests to /pic/ and /video/ endpoints.
- Enhanced error handling for CSV content fetching and improved response messages.
- Updated the HTML and JavaScript to load and display statistics more efficiently, including filtering based on endpoint configuration.
- Introduced new metrics collection logic to only log relevant API requests, optimizing performance and clarity.
2024-11-30 23:52:31 +08:00
44afb8cae9 fix(config, docker): update log file path and BASE_URL for consistency
- Changed log_file path in config.json to point to /root/data/logs/server.log.
- Updated BASE_URL in docker-compose.yml to use https://example.net/random-api for improved clarity and consistency.
2024-11-30 23:38:43 +08:00
1fc1069ec1 refactor(docker, config): streamline directory structure and enhance configuration management
- Removed unnecessary volume mounts for public and logs in docker-compose.yml.
- Updated Dockerfile to create necessary directories under /root/data.
- Modified start.sh to copy files to the new public directory location.
- Enhanced config.go to create default configuration and directory structure if not present.
- Adjusted router.go to serve static files from the new public directory path.
2024-11-30 23:34:45 +08:00
88c86787a0 refactor(main): reorder configuration loading and directory creation in Initialize method
- Moved the configuration loading to occur before creating necessary directories.
- Improved code clarity by ensuring that configuration is loaded prior to any directory operations.
2024-11-30 23:30:17 +08:00
e70ca4cf52 feat(docker, config, api): update docker-compose for logging, enhance app structure, and add system metrics display
- Updated docker-compose.yml to mount logs directory.
- Changed BASE_URL environment variable to point to the new API endpoint.
- Refactored main.go to implement a structured App type, improving initialization and graceful shutdown.
- Enhanced config management with JSON loading and environment variable support.
- Added monitoring capabilities in api_handler for logging request metrics.
- Introduced new metrics display in index.html with corresponding CSS styles for better visualization.
2024-11-30 23:23:58 +08:00
f31ff5caa7 feat(generate_csv): fetch album mapping from remote instead of local file 2024-11-17 07:18:15 +08:00
eb7ddee0af chore(lankong_tools): update album_mapping.json for truegirl.csv 2024-11-17 00:27:16 +08:00
365c3a8936 2728 2024-11-16 07:00:20 +08:00
a4d6890a78 refactor(public, services): improve HTML structure and optimize CSV service logging 2024-11-16 05:45:24 +08:00
61e84d87b8 chore(workflow,ci): update docker build process and add multi-arch support
Update the GitHub Actions workflow to include Go setup, multi-arch builds, and push multi-arch Docker images. Also, refactor the CSV service to improve logging and caching mechanism.
2024-11-16 05:34:37 +08:00
981759be39 feat(api, services, handlers): add URL statistics endpoint and service initialization 2024-11-16 05:21:05 +08:00
88986bb637 refactor: update analytics script in index.html 2024-11-15 18:29:48 +08:00
098abf86bf feat(public): add clarity analytics script 2024-11-15 15:14:14 +08:00
152c45605d chore(lankong_tools): update album_mapping.json for truegirl.csv 2024-11-03 09:49:46 +08:00
973fe5c8de style(api_handler): adjust log format for better readability 2024-11-03 08:25:31 +08:00
402c6cf82d refactor(api_handler): remove unused log statement 2024-11-03 08:15:05 +08:00
1b2106697f refactor(api_handler): improve logging format for API request handling 2024-11-03 08:14:50 +08:00
wood chen
aac15c23c9
Update readme.md 2024-11-02 13:14:29 +08:00
275190681c docs(public): Update statistics start date to 2024-11-1 2024-11-02 13:12:39 +08:00
f8f14165d2 docs: add description meta tag to index.html 2024-11-02 13:04:53 +08:00
e03550423d fix: Update start date in stats update function 2024-11-02 13:03:02 +08:00
63106f9008 chore(Dockerfile): add tzdata for proper timezone handling 2024-10-31 01:17:18 +08:00
9c4d57c9b8 Merge branch 'main' of https://github.com/woodchen-ink/random-api-go 2024-10-31 01:08:33 +08:00
887e8a7ca8 refactor(api_handler): improve source info extraction and logging 2024-10-31 01:08:30 +08:00
wood chen
018e22f681
Create LICENSE 2024-10-31 00:40:00 +08:00
f68fa981ce chore(workflow): add push event trigger for generate-csv.yml 2024-10-31 00:33:08 +08:00
967daa51da fix: update album mapping file path 2024-10-31 00:22:57 +08:00
1f35985ef4 refactor(lankong_tools): update album mapping structure and processing logic 2024-10-31 00:21:31 +08:00
a6cc6454f9 refactor(public): update favicon and stylesheet links, markdown-it version 2024-10-30 23:14:58 +08:00
73dfc63d36 style: Update header level in stats summary 2024-10-28 15:18:21 +08:00
58bf760574 chore(workflow): add scheduled task for generating CSV files 2024-10-27 21:30:40 +08:00
d06ae01922 chore(lankong_tools): remove czl-website-background.csv from album_mapping.json 2024-10-27 21:09:30 +08:00
abd9c75e7f style(public/css, public/index.html): Update fade class and endpoint-link color, fetch stats from local server, add view column and update interval 2024-10-27 20:57:27 +08:00
f2d4d5d2a4 chore(github-actions): auto update CSV files by GitHub Actions 2024-10-27 12:15:47 +08:00
995022af74 chore(workflow): Github Bot Update CSV files 2024-10-27 12:10:59 +08:00
caec1217cb refactor(generate-csv): update file paths from public to lankong_csv 2024-10-27 12:07:51 +08:00
4c2309e83f chore(workflow): auto update CSV files by GitHub Actions 2024-10-27 12:00:38 +08:00
81815e6986 chore(workflows): update docker and generate-csv workflows 2024-10-27 11:51:33 +08:00
ac191d4ab6 chore(github-actions): improve target repo access and debugging
Add debug steps and improve file handling in GitHub Actions workflow
2024-10-27 11:46:50 +08:00
c6e081a2db chore: ignore lankong_tools and md files in docker workflow, update mapping file path in generate_csv.go 2024-10-27 11:35:41 +08:00
7aba71cb83 feat(generate-csv): add workflow to generate CSV files and update tools for album mapping 2024-10-27 11:32:24 +08:00
9436878ea5 refactor(index.html): optimize endpoint config loading and stats refresh handling 2024-10-27 09:17:22 +08:00
dd3904e26f Merge branch 'main' of https://github.com/woodchen-ink/random-api-go 2024-10-27 09:07:56 +08:00
dc6cc93055 refactor(index.html): Refactor endpoint configuration and stats display logic 2024-10-27 09:07:54 +08:00
wood chen
f0f4d2084e
Update readme.md 2024-10-27 06:44:16 +08:00
wood chen
cbeadf2e48
Update docker-compose.yml 2024-10-27 06:18:13 +08:00