From e44e2fe070484e06d384a31ef2699c3a2d5d474e Mon Sep 17 00:00:00 2001 From: RaindropsSys <raindrops@equestria.dev> Date: Thu, 13 Jun 2024 15:46:03 +0200 Subject: GitHub migration --- intimate/index.html | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 intimate/index.html (limited to 'intimate/index.html') diff --git a/intimate/index.html b/intimate/index.html new file mode 100755 index 0000000..3c9eb06 --- /dev/null +++ b/intimate/index.html @@ -0,0 +1,140 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Intimate</title> + <link href="./bs5/bootstrap.min.css" rel="stylesheet"> + <script src="./bs5/bootstrap.bundle.min.js"></script> +</head> +<body data-bs-theme="dark" style="position: fixed; inset: 0;"> + <div style="position: fixed; top: 0; left: 0; right: 0; height: 257px; -webkit-app-region: drag; z-index: 99999;"></div> + <div id="bg-cover" class="bg-dark-subtle" style="height: 275px; position: fixed; top: 0; left: 0; right: 0; z-index: 10; transition: opacity 200ms; pointer-events: none; opacity: 1;"></div> + <div id="bg-img" class="bg-dark-subtle" style="height: 275px; z-index: 0; background-position: center; background-size: cover;"></div> + <div style="text-align: center;"> + <div class="btn-group"> + <div class="dropdown" style="position: relative; top: -18px; z-index: 999999; -webkit-app-region: no-drag;"> + <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" disabled id="main-btn"> + Get started + </button> + <ul class="dropdown-menu" style="z-index: 999999; -webkit-app-region: no-drag;"> + <li><a class="dropdown-item" href="#" onclick="start(true, true, true);">Ponies · Furries · Local</a></li> + <li><a class="dropdown-item" href="#" onclick="start(true, false, true);">Ponies · Local</a></li> + <li><a class="dropdown-item" href="#" onclick="start(false, true, true);">Furries · Local</a></li> + <li><a class="dropdown-item" href="#" onclick="start(true, true, false);">Ponies · Furries</a></li> + <li><a class="dropdown-item" href="#" onclick="start(true, false, false);">Ponies</a></li> + <li><a class="dropdown-item" href="#" onclick="start(false, true, false);">Furries</a></li> + <li><a class="dropdown-item" href="#" onclick="start(false, false, true);">Local</a></li> + </ul> + </div> + </div> + </div> + <div style="text-align: center; margin-top: 15px;"> + <h3 style="margin-bottom: 0;">Spend some time with yourself</h3> + <h3 id="cta"></h3> + </div> + <div style="position: fixed; bottom: 5px; left: 10px; opacity: .5;" class="text-muted small">© Equestria.dev Developers</div> + <div style="position: fixed; bottom: 5px; right: 10px; opacity: .5; -webkit-app-region: no-drag;" class="text-muted small" id="version"></div> + + <script> + function start(e621, derpibooru, local) { + require('electron/renderer').ipcRenderer.send("start", e621, derpibooru, local, config); + } + + try { + document.getElementById("version").innerText = "v" + navigator.userAgent.split("intimate/")[1].split(" ")[0]; + } catch (e) { + document.getElementById("version").innerText = "v" + navigator.userAgent.split("Electron/")[1].split(" ")[0]; + } + + switch (new Date().getHours()) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + document.getElementById("cta").innerText = "this night"; + break; + + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + document.getElementById("cta").innerText = "this morning"; + break; + + case 12: + case 13: + document.getElementById("cta").innerText = "before or after lunch"; + break; + + case 14: + case 15: + case 16: + case 17: + document.getElementById("cta").innerText = "this afternoon"; + break; + + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + document.getElementById("cta").innerText = "tonight"; + break; + } + + function setBackground(url) { + console.log(url); + let img = document.createElement("img"); + + img.onload = () => { + document.getElementById("bg-img").style.backgroundImage = 'url("' + url + '")'; + document.getElementById("bg-cover").style.opacity = "0"; + } + + img.src = url; + } + + window.onload = () => { + setTimeout(async () => { + window.configPath = await require('electron/renderer').ipcRenderer.invoke("config"); + const config = window.config = require('toml').parse(require('fs').readFileSync(configPath).toString()); + + if (!config.configured) { + alert("Intimate is currently not configured.\n\nThe configuration file will open in your favorite text editor. Please go through it and adjust the settings to your liking, and then restart Intimate.\n\nIf you have already configured Intimate, make sure the \"configured\" options is set to true."); + await require('electron/renderer').ipcRenderer.invoke("openConfig"); + window.close(); + return; + } + + let seed = Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("hex"); + let derpibooru; + let e621; + + if (config.modules.derpibooru) derpibooru = (await (await fetch("https://derpibooru.org/api/v1/json/search/images/?q=suggestive,%20faved_by:" + encodeURIComponent(config.modules.derpibooru.source) + ",%20mime_type:image/*,%20-mime_type:image/gif,%20-animated&per_page=1&filter_id=56027&sf=random:" + seed)).json())["images"][0]["view_url"]; + if (config.modules.e621) e621 = (await (await fetch("https://e621.net/posts.json?limit=1&tags=order:random%20fav:" + encodeURIComponent(config.modules.e621.source) + "%20rating:q%20randseed:" + seed)).json())["posts"][0]["file"]["url"]; + + console.log(derpibooru, e621); + + setTimeout(() => { + if (e621) { + if (derpibooru) { + setBackground(Math.random() > 0.1 ? derpibooru : e621); + } else { + setBackground(e621); + } + } else if (derpibooru) { + setBackground(derpibooru); + } + + document.getElementById("main-btn").disabled = false; + }); + }); + } + </script> +</body> +</html> -- cgit