INSOMNIA MD

WELCOME GENERATOR

SYSTEM ONLINE

Welcome Generator.

Buat gambar welcome peserta dengan mudah. Masukkan nama peserta dan nama grup untuk membuat gambar.

01 / Pengaturan
Maksimal 45 karakter
Maksimal 35 karakter
02 / Preview Gambar
LIVE PREVIEW 1536 × 864 / 16:9
03 / API Documentation

Gunakan endpoint berikut untuk mengintegrasikan generator ke bot atau aplikasi lainnya.

GET /api/health
POST /api/generate

Request Body JSON:

{
  "namaPeserta": "Nama Peserta",
  "namaGrup": "Nama Grup"
}

Contoh pemanggilan JavaScript:

const response = await fetch(
  "https://getw.insomniaxd.my.id/api/generate",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      namaPeserta: "Nama Peserta",
      namaGrup: "Nama Grup"
    })
  }
);

const imageBlob = await response.blob();
==================== background.onload = () => { backgroundReady = true; $("renderStatus").textContent = "Ready"; render(); }; background.onerror = () => { backgroundReady = false; $("renderStatus").textContent = "Background tidak ditemukan"; render(); }; background.src = "template.jpg"; // ========================================== // FONT LOADING // ========================================== async function loadFonts() { try { await document.fonts.load("1000 100px Nunito"); } catch (error) { console.warn(error); } render(); } // ========================================== // DRAW BACKGROUND // ========================================== function drawBackground() { ctx.clearRect(0, 0, W, H); if (!backgroundReady) { const gradient = ctx.createLinearGradient(0,0,W,H); gradient.addColorStop(0,"#101a32"); gradient.addColorStop(.5,"#28213e"); gradient.addColorStop(1,"#10101c"); ctx.fillStyle = gradient; ctx.fillRect(0,0,W,H); return; } const scale = Math.max( W / background.width, H / background.height ); const sw = W / scale; const sh = H / scale; const sx = (background.width - sw) / 2; const sy = (background.height - sh) / 2; ctx.drawImage( background, sx, sy, sw, sh, 0, 0, W, H ); } // ========================================== // FONT SIZE // ========================================== function calculateFont(text, maxWidth, initialSize) { let size = initialSize; while (size > 24) { ctx.font = `1000 ${size}px Nunito, Arial`; if (ctx.measureText(text).width <= maxWidth) { break; } size -= 2; } return size; } // ========================================== // PINK GRADIENT // ========================================== function createPinkGradient(y) { const gradient = ctx.createLinearGradient( 0, y-60, 0, y+60 ); gradient.addColorStop(0,"#ffc5df"); gradient.addColorStop(.45,"#f48bbd"); gradient.addColorStop(1,"#e96b9f"); return gradient; } // ========================================== // PREMIUM TEXT // ========================================== function drawPremiumText(options) { const { text, x, y, maxWidth, size, color = "#ffffff", strokeWidth = 10, shadowBlur = 12, shadowY = 5 } = options; if (!text) return; ctx.save(); const fontSize = calculateFont( text, maxWidth, size ); ctx.font = `1000 ${fontSize}px Nunito, Arial`; ctx.textAlign = "center"; ctx.textBaseline = "middle"; ctx.lineJoin = "round"; ctx.shadowColor = "rgba(0,0,0,.95)"; ctx.shadowBlur = shadowBlur; ctx.shadowOffsetX = 3; ctx.shadowOffsetY = shadowY; ctx.strokeStyle = "#08060d"; ctx.lineWidth = strokeWidth + 7; ctx.strokeText(text,x,y,maxWidth); ctx.shadowBlur = 0; ctx.strokeStyle = "rgba(30,17,35,.95)"; ctx.lineWidth = strokeWidth; ctx.strokeText(text,x,y,maxWidth); ctx.fillStyle = color; ctx.fillText(text,x,y,maxWidth); ctx.restore(); } // ========================================== // HELLO // ========================================== function drawHello() { drawPremiumText({ text: "HELLO", x: 768, y: 150, maxWidth: 1000, size: 130, color: "#f9efff", strokeWidth: 12, shadowBlur: 15, shadowY: 6 }); } // ========================================== // PARTICIPANT // ========================================== function drawParticipant() { const name = ( participantInput.value.trim() || "NAMA PESERTA" ).toUpperCase(); drawPremiumText({ text: name, x: 768, y: 254, maxWidth: 1370, size: 120, color: createPinkGradient(254), strokeWidth: 13, shadowBlur: 16, shadowY: 7 }); } // ========================================== // WELCOME TO // ========================================== function drawWelcome() { drawPremiumText({ text: "WELCOME TO", x: 768, y: 379, maxWidth: 1100, size: 77, color: "#fff8ff", strokeWidth: 10, shadowBlur: 12, shadowY: 5 }); } // ========================================== // GROUP // ========================================== function drawGroup() { const name = ( groupInput.value.trim() || "NAMA GRUB" ).toUpperCase(); drawPremiumText({ text: `"${name}"`, x: 768, y: 460, maxWidth: 1400, size: 68, color: "#ffffff", strokeWidth: 10, shadowBlur: 15, shadowY: 6 }); } // ========================================== // RULES // ========================================== function drawRules() { drawPremiumText({ text: "HARAP PATUHI PERATURAN GRUB INI, JIKA", x: 768, y: 616, maxWidth: 1430, size: 43, color: "#ffffff", strokeWidth: 9, shadowBlur: 13, shadowY: 5 }); drawPremiumText({ text: "MELANGGAR AKAN DI KICK TANPA AMPUN.", x: 768, y: 673, maxWidth: 1430, size: 43, color: "#ffffff", strokeWidth: 9, shadowBlur: 13, shadowY: 5 }); } // ========================================== // FOOTER // ========================================== function drawFooter() { drawPremiumText({ text: "POWERED BY INSOMNIAMD", x: 768, y: 743, maxWidth: 1100, size: 23, color: "#f7eaf5", strokeWidth: 5, shadowBlur: 9, shadowY: 3 }); } // ========================================== // MAIN RENDER // ========================================== function render() { drawBackground(); drawHello(); drawParticipant(); drawWelcome(); drawGroup(); drawRules(); drawFooter(); $("renderStatus").textContent = "Rendering selesai"; } // ========================================== // LIVE INPUT // ========================================== participantInput.addEventListener("input",render); groupInput.addEventListener("input",render); // ========================================== // UPLOAD BACKGROUND // ========================================== $("backgroundUpload").addEventListener("change",event => { const file = event.target.files[0]; if (!file) return; if (!file.type.startsWith("image/")) { showToast("File harus berupa gambar!"); event.target.value = ""; return; } if (file.size > 15 * 1024 * 1024) { showToast("Ukuran maksimal 15 MB!"); event.target.value = ""; return; } const url = URL.createObjectURL(file); const newImage = new Image(); newImage.onload = () => { if (backgroundURL) { URL.revokeObjectURL(backgroundURL); } background = newImage; backgroundURL = url; backgroundReady = true; render(); showToast("Background berhasil diganti!"); }; newImage.onerror = () => { URL.revokeObjectURL(url); showToast("Gagal memuat background!"); }; newImage.src = url; }); // ========================================== // DOWNLOAD PNG // ========================================== $("downloadBtn").addEventListener("click",() => { if (!backgroundReady) { showToast("Background belum tersedia!"); return; } render(); canvas.toBlob(blob => { if (!blob) { showToast("Gagal membuat gambar!"); return; } const url = URL.createObjectURL(blob); const link = document.createElement("a"); const name = ( participantInput.value || "peserta" ).toLowerCase() .replace(/[^a-z0-9-_]/g,"-") .replace(/-+/g,"-") .substring(0,40); link.href = url; link.download = `welcome-${name || "peserta"}.png`; document.body.appendChild(link); link.click(); link.remove(); setTimeout(() => { URL.revokeObjectURL(url); },2000); showToast("Gambar berhasil didownload!"); },"image/png"); }); // ========================================== // RESET // ========================================== $("resetBtn").addEventListener("click",() => { participantInput.value = "NAMA PESERTA"; groupInput.value = "NAMA GRUB"; render(); showToast("Teks berhasil direset!"); }); // ========================================== // COPY JAVASCRIPT // ========================================== $("copyApiBtn").addEventListener("click",async () => { try { await navigator.clipboard.writeText( $("apiExample").textContent ); showToast("JavaScript berhasil disalin!"); } catch (error) { showToast("Gagal menyalin kode!"); } }); // ========================================== // API HEALTH CHECK // ========================================== async function testHealth() { const result = $("apiResult"); const status = $("systemStatus"); result.textContent = "Menghubungkan ke API..."; status.textContent = "● CHECKING API"; try { const response = await fetch("/api/health"); if (!response.ok) { throw new Error("HTTP " + response.status); } const data = await response.json(); result.textContent = "API STATUS: " + data.status.toUpperCase() + " | VERSION: " + data.version; status.textContent = "● SYSTEM ONLINE"; } catch (error) { result.textContent = "API ERROR: " + error.message; status.textContent = "● API OFFLINE"; } } $("testApiBtn").addEventListener("click",testHealth); // ========================================== // TEST IMAGE GENERATION // ========================================== $("testGenerateBtn").addEventListener("click",async () => { const button = $("testGenerateBtn"); const result = $("apiResult"); button.disabled = true; button.textContent = "GENERATING..."; try { const response = await fetch("/api/generate",{ method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ namaPeserta: participantInput.value, namaGrup: groupInput.value }) }); if (!response.ok) { const error = await response.json(); throw new Error(error.message || error.error); } const blob = await response.blob(); if (!blob.type.includes("image/png")) { throw new Error("Response bukan PNG"); } const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = "insomnia-api-test.png"; document.body.appendChild(link); link.click(); link.remove(); setTimeout(() => { URL.revokeObjectURL(url); },3000); result.textContent = "SUCCESS: Gambar PNG berhasil dibuat melalui API."; showToast("API berhasil generate gambar!"); } catch (error) { result.textContent = "ERROR: " + error.message; showToast("Gagal generate melalui API!"); } finally { button.disabled = false; button.textContent = "TEST IMAGE GENERATION"; } }); // ========================================== // TOAST // ========================================== function showToast(message) { $("toast").textContent = message; $("toast").classList.add("show"); clearTimeout(toastTimer); toastTimer = setTimeout(() => { $("toast").classList.remove("show"); },2500); } // ========================================== // INITIALIZATION // ========================================== render(); loadFonts(); testHealth();