Skip to content

Footer hash#9

Open
3scava1i3r wants to merge 5 commits into
ubiquity:mainfrom
3scava1i3r:footer-hash
Open

Footer hash#9
3scava1i3r wants to merge 5 commits into
ubiquity:mainfrom
3scava1i3r:footer-hash

Conversation

@3scava1i3r

Copy link
Copy Markdown

fixes #6

Screenshot 2026-02-04 at 7 08 28 PM Screenshot 2026-02-04 at 7 09 27 PM

I had some questions though -

RPC endpoint clarification

For https://rpc.ubq.fi/:chainId, could you please share the relevant GitHub repository where this RPC is defined so it can be correctly added to the app-registry mapping?

README typo

There appears to be a small typo in the README:
os--dev[elopment].ubq.fi
Should this consistently be os--development.ubq.fi?

Plugin deployment issue

Several plugin pages currently display a “deno not deployed” error.
Is this expected behavior (e.g., work in progress), or are these plugins supposed to be live?

@coderabbitai

coderabbitai Bot commented Feb 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds three new utilities and integrates them into the worker. src/utils/github-api.ts provides a GitHub client with caching, parsing, and latest-commit retrieval. src/utils/app-registry.ts implements a pattern-to-repo registry with manual and auto-detection, positive/negative caching, and APIs to initialize, register, query, preload, and clear entries. src/utils/html-injector.ts builds footer HTML/CSS, decides injection eligibility, and injects a version footer into HTML responses. worker.ts wires registry initialization/preloading, exposes version metadata in logs, adds FOOTER_ENABLED, and conditionally injects footers into proxied HTML responses.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Footer hash' is partially related to the changeset—it describes a core feature (footer display), but is vague about the key detail: displaying revision hashes dynamically in app footers.
Description check ✅ Passed The PR description references issue #6, includes screenshots showing the footer feature in action, and explains the implementation with clarifying questions about related components.
Linked Issues check ✅ Passed The code fully addresses issue #6 objectives: app registry maps hostnames to repos, github-api fetches commit info, html-injector renders footers with commit hashes linking to repos, and worker integrates all components. The footer excludes any question-mark elements per requirements.
Out of Scope Changes check ✅ Passed All changes directly support the footer hash feature: app-registry enables host-to-repo mapping, github-api fetches commit metadata, html-injector renders styled footers, and worker orchestrates integration. No out-of-scope additions detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (2)
src/utils/html-injector.ts (1)

232-260: decompressBody currently returns compressed bytes.

The name implies decompression but the function only concatenates chunks. If it’s used for gzip/br content later, the output will be invalid. Consider implementing decompression (e.g., DecompressionStream) or throw/rename to avoid silent misuse.

🧭 Safer placeholder
-  // Note: Full decompression would require additional libraries
-  // For Cloudflare Workers, we'd need to handle this differently
-  // This is a placeholder for the decompression logic
-  return combined;
+  throw new Error(`Decompression for ${encoding} not implemented`);
src/utils/app-registry.ts (1)

467-479: Escape regex metacharacters in patterns.

Dots in patterns are currently treated as wildcards. Escaping before replacing * avoids over-matching.

🔧 Suggested regex build
-      const regex = new RegExp('^' + pattern.replace(/\*/g, '[^.]+') + '$');
+      const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&');
+      const regex = new RegExp('^' + escaped.replace(/\\\*/g, '[^.]+') + '$');

Comment thread src/utils/app-registry.ts
Comment thread src/utils/app-registry.ts
Comment thread src/utils/github-api.ts
Comment thread src/utils/html-injector.ts
Comment thread src/worker.ts
Comment thread src/worker.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
src/utils/github-api.ts (2)

137-142: Duplicate getShortHash function.

Same function exists in src/utils/html-injector.ts (lines 264-266). Consider exporting from one location.


144-169: In-memory cache lacks size limits.

Cache can grow unbounded for long-running workers with many unique repos. Consider adding max entries or LRU eviction.

💡 Example: simple max-size cap
+const MAX_CACHE_SIZE = 1000;
+
 function setCache(key: string, value: GitHubCommitInfo, ttlSeconds: number): void {
+  // Evict oldest entries if cache is full
+  if (cache.size >= MAX_CACHE_SIZE) {
+    const firstKey = cache.keys().next().value;
+    if (firstKey) cache.delete(firstKey);
+  }
   cache.set(key, {
     value,
     expiresAt: Date.now() + ttlSeconds * 1000,
   });
 }
src/utils/app-registry.ts (1)

40-353: Large static registry is verbose but functional.

Consider extracting to a JSON/YAML config file for easier maintenance, but acceptable as-is for now.

Comment thread src/utils/app-registry.ts
Comment thread src/utils/app-registry.ts
Comment thread src/worker.ts
@3scava1i3r

Copy link
Copy Markdown
Author

@0x4007 would appreciate a review 🙏
I’ve left a couple of questions above if those are relevant here.

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.

Dynamically append the revision hash on every app footer

1 participant