Created
December 23, 2025 07:48
-
-
Save ONLym22/577a6d2f744b7f2594c474e28d5d6fa1 to your computer and use it in GitHub Desktop.
ONLym BOT Gist Uploaded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require('axios') | |
| const CryptoJS = require('crypto-js') | |
| const fs = require('fs') | |
| const AES_KEY = 'ai-enhancer-web__aes-key' | |
| const AES_IV = 'aienhancer-aesiv' | |
| function anu(obj){ | |
| return CryptoJS.AES.encrypt( | |
| JSON.stringify(obj), | |
| CryptoJS.enc.Utf8.parse(AES_KEY), | |
| { | |
| iv: CryptoJS.enc.Utf8.parse(AES_IV), | |
| mode: CryptoJS.mode.CBC, | |
| padding: CryptoJS.pad.Pkcs7 | |
| } | |
| ).toString() | |
| } | |
| async function pisang(path, prompt){ | |
| try{ | |
| const img = fs.readFileSync(path, 'base64') | |
| const settings = anu({ | |
| prompt, | |
| aspect_ratio: 'match_input_image', | |
| output_format: 'png', | |
| max_images: 1, | |
| sequential_image_generation: 'disabled' | |
| }) | |
| const create = await axios.post('https://aienhancer.ai/api/v1/r/image-enhance/create', | |
| { | |
| model: 2, | |
| image: `data:image/jpeg;base64,${img}`, | |
| settings | |
| }, | |
| { | |
| headers:{ | |
| 'User-Agent':'Mozilla/5.0 (Linux; Android 10)', | |
| 'Content-Type':'application/json', | |
| Origin:'https://aienhancer.ai', | |
| Referer:'https://aienhancer.ai/ai-image-editor' | |
| } | |
| } | |
| ) | |
| const id = create.data.data.id | |
| while(true){ | |
| const r = await axios.post('https://aienhancer.ai/api/v1/r/image-enhance/result', | |
| { task_id: id }, | |
| { | |
| headers:{ | |
| 'User-Agent':'Mozilla/5.0 (Linux; Android 10)', | |
| 'Content-Type':'application/json', | |
| Origin:'https://aienhancer.ai', | |
| Referer:'https://aienhancer.ai/ai-image-editor' | |
| } | |
| } | |
| ) | |
| if(r.data.data.status === 'succeeded'){ | |
| return { | |
| id, | |
| output: r.data.data.output, | |
| input: r.data.data.input | |
| } | |
| } | |
| await new Promise(r => setTimeout(r, 3000)) | |
| } | |
| }catch(e){ | |
| return { status:'engror', msg: e.message } | |
| } | |
| } | |
| return await pisang('./media/thumb-2.jpg', 'ubah kulitnya menjadi hitam') | |
| /* | |
| { | |
| id: 'cv4dtvesq9rmy0cv84jrgn04em', | |
| output: 'https://cdn.aienhancer.ai/se/aienhancer/image-enhance/cv4dtvesq9rmy0cv84jrgn04em/output.png', | |
| input: 'https://cdn.aienhancer.ai/se/aienhancer/image-enhance/cv4dtvesq9rmy0cv84jrgn04em/origin..png' | |
| } | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment