- This is a small PHP website, not a Node or framework app.
- Main entry pages are
index.php,docs.php,issues.php, andchangelog.php. - Shared layout is split across
header.phpandfooter.php. - Frontend behavior lives mostly in
assets/app.js,assets/i18n.js, andassets/site.js. - Data storage is file-based under
data/.
- The homepage map modal currently uses a public Mapbox token hardcoded in
assets/app.js. - The header visitor flag is rendered from Cloudflare's
CF-IPCountryrequest header inheader.php. - The site uses clean URLs like
/docs/,/issues/, and/changelog/. - Apache routing and dotfile protection are defined in
.htaccess. .envis currently inside the web root, so web-server blocking of dotfiles is important.
- Production server:
136.243.151.32(hz-sites), managed with 1Panel. - Production site path:
/opt/1panel/www/sites/flagcdn.io/index. - The production site directory is not a git worktree.
- Current deployment flow is:
- commit locally
- push to GitHub
origin/main - sync changed files to the 1Panel site path with
rsyncover SSH
- Latest deployed GitHub commit:
7ad00ed(Use Cloudflare country header for visitor flag).
- Added
assets/site.jsto centralize shared page scripts:- visitor country flag
- GitHub stars
- latest release announcement
- footer back-to-top behavior
- Updated
footer.phpto loadassets/site.jsglobally. - Removed duplicated shared header/footer JS from
docs.php,issues.php, andchangelog.php. - Fixed race conditions in
api/download-count.phpby using a single locked read-modify-write flow. - Fixed race conditions in
api/issues.phprate limiting by locking the per-IP temp file during the full update. - Added
.htaccesswith:- clean URL rewrites for
/docs/,/issues/,/changelog/ - dotfile blocking such as
.env DirectoryIndex index.php
- clean URL rewrites for
- Replaced homepage CTA icons with Font Awesome icons instead of custom SVG/mask rendering:
- docs button uses
fa-file-lines - download button uses
fa-arrow-down-to-line
- docs button uses
- Replaced the flag-card "copy image URL" action icon with Font Awesome
fa-clone. - Added a CSS override for
.fi::beforeinassets/main.cssto avoid mojibake rendering (A/Â) over sample flags on some setups. - Removed the browser-side
https://api.cnip.io/geoipfetch and switched the header visitor flag to CloudflareCF-IPCountry, fixing the CORS error and removing the third-party geo-IP dependency from the browser. - Synced these changes to GitHub and deployed them to the 1Panel production server via
rsync.
- Download stats are stored in
data/download-count.txt. - Feedback items are stored in
data/issues.json. - Rate limiting for feedback uses temp files in
sys_get_temp_dir(). - Pages still call third-party APIs directly from the browser for GitHub metadata.
- Move GitHub metadata fetches behind local cached PHP endpoints.
- Either complete or hide partially supported languages in
assets/i18n.js(ja,de,ru,arare mostly fallback content). - Consider moving
.envoutside the web root if deployment allows it.