1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Intimate</title>
<link href="./bs5/bootstrap.min.css" rel="stylesheet">
<link href="./bs5/bootstrap-icons.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="display: flex; align-items: center; height: 196px; text-align: center; margin-top: 15px;">
<div id="page-0" class="page" style="width: 100%; display: none;">
<h3 style="margin-bottom: 20px;">Which sources should we use?</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 10px; margin: 0 20px;">
<span onclick="window.preferences.sources = 0; page(2);" class="btn btn-outline-light" style="max-width: 145px; display: flex; align-items: center; justify-content: center; gap: 8px;">
<i class="bi bi-cloud"></i>
Online only
</span>
<span onclick="window.preferences.sources = 1; page(2);" class="btn btn-outline-light" style="max-width: 145px; display: flex; align-items: center; justify-content: center; gap: 8px;">
<i class="bi bi-hdd"></i>
Local only
</span>
<span onclick="window.preferences.sources = 2; page(2);" class="btn btn-outline-light" style="max-width: 145px; display: flex; align-items: center; justify-content: center; gap: 8px;">
<i class="bi bi-layers"></i>
Both
</span>
</div>
<a class="small" href="#" onclick="start();" style="margin-top: 20px; text-align: center; display: block;">Skip and start immediately</a>
</div>
<div id="page-2" class="page" style="width: 100%; display: none;">
<h3 style="margin-bottom: 20px;">Which types of content should we play?</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 10px; margin: 0 20px;">
<span onclick="window.preferences.content = 0; start();" class="btn btn-outline-light" style="max-width: 145px; display: flex; align-items: center; justify-content: center; gap: 8px;">
<i class="bi bi-image"></i>
Images only
</span>
<span onclick="window.preferences.content = 1; start();" class="btn btn-outline-light" style="max-width: 145px; display: flex; align-items: center; justify-content: center; gap: 8px;">
<i class="bi bi-film"></i>
Videos only
</span>
<span onclick="window.preferences.content = 2; start();" class="btn btn-outline-light" style="max-width: 145px; display: flex; align-items: center; justify-content: center; gap: 8px;">
<i class="bi bi-collection"></i>
Both
</span>
</div>
<a class="small" href="#" onclick="start();" style="margin-top: 20px; text-align: center; display: block;">Skip and start immediately</a>
</div>
</div>
<div style="position: fixed; bottom: 0; left: 0; right: 0; height: 64px; padding: 0 20px; background-color: rgba(0, 0, 0, .25); display: flex; align-items: center; width: 100%;">
<div style="opacity: .5;" class="btn-group">
<span class="btn btn-outline-light" onclick="settings();" title="Settings">
<i class="bi bi-gear"></i>
</span>
<span class="btn btn-outline-light" onclick="location.reload();" title="Reload settings">
<i class="bi bi-arrow-clockwise"></i>
</span>
<span class="btn btn-outline-light" onclick="devtools();" title="Developer options">
<i class="bi bi-code"></i>
</span>
<span class="btn btn-outline-light" onclick="about();" title="About Intimate">
<i class="bi bi-info-circle"></i>
</span>
<span class="btn btn-outline-light" onclick="window.close();" title="Quit Intimate">
<i class="bi bi-box-arrow-left"></i>
</span>
</div>
</div>
<script>
const fs = require('fs');
window.preferences = {
sources: 0,
content: 2
}
function settings() {
require('electron/renderer').ipcRenderer.invoke("openConfig");
}
function about() {
require('electron/renderer').ipcRenderer.invoke("openAbout");
}
function devtools() {
require('electron/renderer').ipcRenderer.invoke("openDevtools");
}
function start() {
require('electron/renderer').ipcRenderer.send("start", window.preferences, config);
}
function setBackground(url) {
document.getElementById("bg-img").style.backgroundImage = 'url("' + url + '")';
document.getElementById("bg-cover").style.opacity = "0";
}
function page(id) {
Array.from(document.getElementsByClassName("page")).map(i => i.style.display = "none");
document.getElementById("page-" + id).style.display = "";
}
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\" option 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;
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"].map(i => {
if (!config.modules.derpibooru['faunerie_cache']) return i;
if (!fs.existsSync(config.modules.derpibooru['faunerie_cache'] + "/images/" + i['sha512_hash'].substring(0, 1) + "/" + i['sha512_hash'].substring(0, 2) + "/" + i['sha512_hash'].substring(0, 3) + "/10" + i['id'] + ".bin")) return i;
i['view_url'] = "pbip://" + config.modules.derpibooru['faunerie_cache'] + "/images/" + i['sha512_hash'].substring(0, 1) + "/" + i['sha512_hash'].substring(0, 2) + "/" + i['sha512_hash'].substring(0, 3) + "/10" + i['id'] + ".bin";
return i;
})[0]["view_url"];
console.log(derpibooru);
setBackground(derpibooru);
page(0);
});
}
</script>
</body>
</html>
|