DogeJS / Doge on X / Header and avatar

Header and avatar

A header image that says Dogecoin accepted or Tips in DOGE, and your photo with a Dogecoin ring.

Free, no account, nothing leaves your browser. For developers: the docs

The header page on a phone: a Dogecoin accepted header with a QR code, and the options for words, colours and the QR code.

What you get

Header and avatar, step by step

dogejs.com/x/profile/app/
A Night header: Dogecoin accepted here with the coin, @dogejs_demo and a QR code to the tip page.

A header that says Dogecoin accepted

Pick a style and a text. Add a QR code that opens your tip page, so people can tip from your profile.

  • Sized 1500 by 500, the size X asks for
  • Two texts, so the header always fits
  • The QR code leads to your tip page
The avatar section on a phone: a round photo with a gold Dogecoin ring and a Download avatar button.

Your photo with a coin ring

Choose a photo and get it back as a round avatar with a gold Dogecoin ring, 400 by 400.

  • The photo is read in your browser and never uploaded
  • Works with a JPG or a PNG
  • Download it as a PNG
The header page on a phone with the Tips in DOGE words in the Cream colours.

Pick the look

Two texts, Dogecoin accepted or Tips in DOGE, and three colours: gold, night and cream. The QR code is optional.

  • Your username is optional and shown on the header
  • The QR code needs your Dogecoin address and leads to your tip page
  • Download it any time and make another
An illustration of a post box with the new-header text and the header attached.

Show the new look off

Post it with one tap. The post box opens with the words filled in. Attach the header and press Post.

  • We never post for you
  • Then change the header on X under Edit profile
  • Works on phone and computer

How it works

  1. Pick a style

    Choose the header text and look.

  2. Add your photo

    Get the avatar with the coin ring.

  3. Download and upload on X

    Set them under Edit profile.

Questions

Is my photo uploaded?

No. It is read and drawn in your browser; nothing leaves your device.

What size should I upload to X?

The header is 1500x500 and the avatar 400x400, the sizes X asks for.

Where does the QR code lead?

To your tip page, the same link as your bio. Without an address there is no QR code.

Can I change the words?

Two texts are offered so the header always fits and reads well.

Do I log in to X here?

No. The page never connects to your X account. You download the images and upload them on X yourself.

Is this made by X?

No. DogeJS is an independent project and is not affiliated with X Corp. The tools only open X's own post box with the text filled in; you press Post yourself.

Header and avatar

It works for real, right here. No sign-up.

For developers

The header kit for developers

What the images are, how they are drawn in the browser, and what the QR code holds.

How it works

  1. The header is 1500x500 (X's header size), in Gold, Night or Cream, with "Dogecoin accepted here" or "Tips in DOGE welcome" and your @handle.
  2. With an address, a QR code to your tip page is drawn on the right; it holds the same link as your bio (tipLink).
  3. The avatar is 400x400: your photo, cropped to a circle, with a Dogecoin ring. The photo is read with a local file input and drawn on a canvas; it is never uploaded.
  4. Download gives PNG files; "Show it off on X" opens the composer with a short text and the tip link.

How the card renderer works: card renderer.

Use it in your own code

The package is @dogejs/xkit. It is not on npm yet: install it from its repository tag, then import the helpers. They are plain functions with no DOM at module level, so they run in Node 20+, in browsers and in workers.

Shell
npm install github:DogeJS-Dev/doge-on-x#v0.2.0
JavaScript
import { tipLink, decodeLink, checkProof, draw, postIntentUrl } from '@dogejs/xkit';

The drawing code is browser-only and lives in src/pages/profile.ts and src/canvas.ts; the links and texts it uses are in the package.

Code examples

Each example runs in Node against the built package; the output is recorded from that run and checked by npm run examples.

What the QR code and the post hold

The tip link inside the QR code, the bio line, the profile link and the composer link. File examples/profile-links.mjs; run: node examples/profile-links.mjs.

JavaScript
// What the header's QR code holds, and the post that shows the new header off.
import { addressNetwork, bioLine, postIntentUrl, profilePost, profileUrl, tipLink } from '@dogejs/xkit';

const address = 'nUCAGGgZEPN1QyknmQe1oAku817bQAFKFt'; // a test network address
const record = { handle: 'dogejs_demo', address, network: addressNetwork(address) };
console.log('QR code ->', tipLink(record));
console.log('bio     ->', bioLine(record));
console.log('profile ->', profileUrl(record.handle));
console.log(postIntentUrl({ text: profilePost(), url: tipLink(record) }));
Output
QR code -> https://dogejs.com/x/t/#1~dogejs_demo~nUCAGGgZEPN1QyknmQe1oAku817bQAFKFt~2bb48547
bio     -> Tips in Dogecoin: dogejs.com/x/t/#1~dogejs_demo~nUCAGGgZEPN1QyknmQe1oAku817bQAFKFt~2bb48547
profile -> https://x.com/dogejs_demo
https://x.com/intent/post?text=New%20header%2C%20now%20with%20Dogecoin.%20Tips%20in%20DOGE%20welcome.%20Wow.%20%23Dogecoin&url=https%3A%2F%2Fdogejs.com%2Fx%2Ft%2F%231%7Edogejs_demo%7EnUCAGGgZEPN1QyknmQe1oAku817bQAFKFt%7E2bb48547

Draw a header yourself

A minimal header with the plain Canvas API, run in Chrome: the X path, a title that shrinks to fit, a PNG. File examples/header-canvas.html; run: Open it in a browser.

HTML
<!doctype html>
<meta charset="utf-8">
<title>Draw an X header in the browser</title>
<canvas id="c" width="1500" height="500" style="width:100%;max-width:750px"></canvas>
<pre id="out"></pre>
<script>
// The same steps as the header kit: fixed size, fonts first, text measured before drawing, PNG out.
// The X mark is the unmodified logo path (viewBox 0 0 1200 1227), only scaled and filled.
const X_PATH = 'M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z';

async function drawHeader(canvas, { title, handle }) {
  const ctx = canvas.getContext('2d');
  await document.fonts.ready;                               // the kit waits for its web fonts here
  ctx.fillStyle = '#FDC606';
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  // X mark, 160 px high, top-left at (90, 90)
  ctx.save();
  ctx.translate(90, 90);
  ctx.scale(160 / 1227, 160 / 1227);
  ctx.fillStyle = '#000';
  ctx.fill(new Path2D(X_PATH));
  ctx.restore();
  // the title shrinks until it fits 1000 px
  let size = 110;
  do ctx.font = `900 ${size}px system-ui, sans-serif`; while (ctx.measureText(title).width > 1000 && --size > 40);
  ctx.fillStyle = '#2F220C';
  ctx.fillText(title, 300, 230);
  ctx.font = '700 44px system-ui, sans-serif';
  ctx.fillText('@' + handle, 300, 320);
  return new Promise((resolve) => canvas.toBlob(resolve, 'image/png'));
}

drawHeader(document.getElementById('c'), { title: 'Dogecoin accepted here', handle: 'dogejs_demo' }).then((blob) => {
  const c = document.getElementById('c');
  document.getElementById('out').textContent = `${c.width}x${c.height} ${blob.type} ${blob.size > 10000 ? 'ok' : 'too small'}`;
});
</script>
Output
1500x500 image/png ok

Check the username and address

The same checks the form uses before the QR code is drawn. File examples/inputs.mjs; run: node examples/inputs.mjs.

JavaScript
// Read what people type into a tip-jar form, the way the tip page does.
import { addressHint, addressNetwork, handleHint, looksSecret, parseHandle } from '@dogejs/xkit';

for (const typed of ['@dogejs_demo', 'https://twitter.com/dogejs_demo/', 'doge js', 'much_too_long_name_here']) {
  const h = parseHandle(typed);
  console.log(JSON.stringify(typed), '->', h ?? handleHint(typed));
}
for (const typed of ['DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L', 'nUCAGGgZEPN1QyknmQe1oAku817bQAFKFt', 'DH5yaieqoZN36fDVciNyRueRGvGLR3mr7', 'bc1qexampleexampleexample']) {
  console.log(typed.slice(0, 12) + '...', '->', addressNetwork(typed) ?? addressHint(typed));
}
// A pasted recovery phrase or private key is recognised so the page can clear it and never keep it.
console.log(looksSecret('abandon ability able about above absent absorb abstract absurd abuse access accident'));
Output
"@dogejs_demo" -> dogejs_demo
"https://twitter.com/dogejs_demo/" -> dogejs_demo
"doge js" -> A username has no spaces.
"much_too_long_name_here" -> X usernames have at most 15 characters.
DH5yaieqoZN3... -> mainnet
nUCAGGgZEPN1... -> testnet
DH5yaieqoZN3... -> Not finished yet. A Dogecoin address has 34 characters and starts with D.
bc1qexamplee... -> That is not a Dogecoin address. Dogecoin addresses start with D.
true

API reference

The exports this page uses. The full list is on the Doge on X developer page.

Page links and texts src/links.ts

ExportReturnsWhat it does
tipLink(record, base?)stringbase + /x/t/# + fragment; base defaults to https://dogejs.com.
proofLink(record, base?)stringbase + /x/proof/# + fragment.
bioLine(record, base?)stringTips in Dogecoin: dogejs.com/x/t/#..., always without the proof so it stays short.
pinnedPost(), proofPost(handle, address), pricePost(headline, line), wowPost(line), profilePost(), lockPost(commit, entries), winnersPost(winners, commit)stringThe texts the pages prefill in the composer; each stays under 240 with its link.
SITE, PAGES'https://dogejs.com', { hub, tip, tipPage, proof, price, wow, profile, giveaway }The site and the page paths.

Handles and post links src/handle.ts

ExportReturnsWhat it does
parseHandle(input)string | nullReads "@name", "name", "x.com/name" or "https://twitter.com/name" as a handle (1 to 15 of A-Z a-z 0-9 _), or null.
handleHint(input)stringA plain sentence saying what is wrong with a handle that is not valid yet.
sameHandle(a, b)booleanCompares two handles without case, as X does.
profileUrl(handle)stringhttps://x.com/<handle>
parsePostUrl(input, handle){ ok: true, id } | { ok: false, reason }Accepts only an https x.com or twitter.com status link whose path names the same handle (any case). Refuses look-alike hosts, user:password@, other ports and non-status paths.
postUrl(handle, id)stringhttps://x.com/<handle>/status/<id>
HANDLE_RERegExp/^[A-Za-z0-9_]{1,15}$/

Addresses src/address.ts

ExportReturnsWhat it does
addressNetwork(address)'mainnet' | 'testnet' | nullThe network of a valid Dogecoin address (checksum checked by @dogejs/core), or null.
addressHint(value)stringA plain sentence for an address that is not valid yet (too short, another coin, spaces...).
looksSecret(value)booleanTrue for a private key (WIF, hex), an extended private key or a recovery phrase. The pages clear such input and never keep it.

Self-hosting

Everything is static files. The page scripts are built from DogeJS-Dev/doge-on-x; the HTML and CSS of the pages are in DogeJS-Dev/website under site/x/.

Shell
git clone https://github.com/DogeJS-Dev/doge-on-x
cd doge-on-x
npm install
npm run build      # dist/x-tip.js, x-t.js, x-proof.js, x-price.js, x-wow.js, x-profile.js, x-giveaway.js
npm test           # unit tests
npm run examples   # runs every example on this page and compares its output
  1. Copy site/x/ from the website repository (the product page of each tool is x/<tool>/, the tool itself x/<tool>/app/), with ui.css, apps.css, styles.css, site.js, pay.js (tip pages) and signin.js (proof page) from the site root, and the images the pages name.
  2. Put the built dist/x-*.js next to the pages as site/x/x-*.js.
  3. Serve the folder from any static host. Nothing else is needed: no database, no keys, no X API.

What changes on your own host: the pages write links for the host they are served from (so your tip links point to your copy), and proofs are signed for your host. A proof page accepts proofs signed for dogejs.com and for its own host, nothing else. To make another host the default for links built in code, pass it as the base argument of tipLink, proofLink and bioLine, and the hosts you accept as allowedHosts of checkProof.