intro: The default app is intro, and complete intro changes the default app to ssb.

This commit is contained in:
Cory McWilliams 2025-05-21 18:48:29 -04:00
parent 17694f5646
commit 89622697d5
5 changed files with 50 additions and 51 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "📦", "emoji": "📦",
"previous": "&To+YNrnau33KxhwpnZK7ctSLK/S/2KgEHJXYxffCels=.sha256" "previous": "&jv/hWMidzVn7apsmPSWQRETz/saDQ79EPGgWVv+qPt0=.sha256"
} }

View File

@ -1,5 +1,13 @@
import * as tfrpc from '/tfrpc.js';
async function main() { async function main() {
await app.setDocument(utf8Decode(getFile('index.html'))); await app.setDocument(utf8Decode(getFile('index.html')));
} }
tfrpc.register(async function complete() {
if ((await core.globalSettingsGet('index')) == '/~core/intro/') {
return await core.globalSettingsSet('index', '/~core/ssb/');
}
});
main(); main();

View File

@ -41,7 +41,7 @@
<div>~😎 Tilde Friends.</div> <div>~😎 Tilde Friends.</div>
</div> </div>
<footer> <footer>
<button class="w3-button w3-yellow" onclick="show(1)">Next</button> <button class="w3-button w3-yellow proceed">Next</button>
</footer> </footer>
</div> </div>
<div class="slide w3-card-4 w3-gray" style="width: 90%"> <div class="slide w3-card-4 w3-gray" style="width: 90%">
@ -59,7 +59,7 @@
</li> </li>
</ul> </ul>
<footer class="w3-center w3-xlarge w3-padding"> <footer class="w3-center w3-xlarge w3-padding">
<button class="w3-button w3-yellow" onclick="show(1)">Onward</button> <button class="w3-button w3-yellow proceed">Onward</button>
</footer> </footer>
</div> </div>
<div class="slide w3-gray" style="width: 90%"> <div class="slide w3-gray" style="width: 90%">
@ -101,9 +101,7 @@
target="_blank" target="_blank"
>See scuttlebutt.nz</a >See scuttlebutt.nz</a
> >
<button class="w3-button w3-yellow" onclick="show(1)"> <button class="w3-button w3-yellow proceed">Got It</button>
Got It
</button>
</footer> </footer>
</div> </div>
</div> </div>
@ -172,9 +170,7 @@
</ul> </ul>
</div> </div>
<footer class="w3-center w3-xlarge w3-padding"> <footer class="w3-center w3-xlarge w3-padding">
<a class="w3-button w3-yellow" target="_top" href="/~core/ssb/" <button class="w3-button w3-yellow" id="complete">Let's Go!</button>
>Let's Go!</a
>
</footer> </footer>
</div> </div>
</div> </div>
@ -183,42 +179,21 @@
class="w3-text-white w3-xlarge w3-center w3-flex" class="w3-text-white w3-xlarge w3-center w3-flex"
style="width: 100%; flex: 0 1; flex-direction: row; align-items: center" style="width: 100%; flex: 0 1; flex-direction: row; align-items: center"
> >
<div <div class="w3-jumbo" id="left" style="flex: 1 0; cursor: pointer">
class="w3-jumbo"
onclick="show(-1)"
style="flex: 1 0; cursor: pointer"
>
&#10094; &#10094;
</div> </div>
<span <span class="w3-badge dot w3-border w3-hover-yellow"></span>
class="w3-badge dot w3-border w3-hover-yellow" <span class="w3-badge dot w3-border w3-hover-yellow"></span>
onclick="set(0)" <span class="w3-badge dot w3-border w3-hover-yellow"></span>
></span> <span class="w3-badge dot w3-border w3-hover-yellow"></span>
<span <span class="w3-badge dot w3-border w3-hover-yellow"></span>
class="w3-badge dot w3-border w3-hover-yellow" <div class="w3-jumbo" style="flex: 1 0; cursor: pointer" id="right">
onclick="set(1)"
></span>
<span
class="w3-badge dot w3-border w3-hover-yellow"
onclick="set(2)"
></span>
<span
class="w3-badge dot w3-border w3-hover-yellow"
onclick="set(3)"
></span>
<span
class="w3-badge dot w3-border w3-hover-yellow"
onclick="set(4)"
></span>
<div
class="w3-jumbo"
style="flex: 1 0; cursor: pointer"
onclick="show(1)"
>
&#10095; &#10095;
</div> </div>
</div> </div>
<script> <script type="module">
import * as tfrpc from '/static/tfrpc.js';
let index = 0; let index = 0;
function set(i) { function set(i) {
show(i - index); show(i - index);
@ -238,15 +213,32 @@
dot.classList.remove('w3-white'); dot.classList.remove('w3-white');
} }
} }
for (let left of document.getElementsByClassName('w3-left')) { document.getElementById('left').style.visibility =
left.style.visibility = index == 0 ? 'hidden' : 'visible'; index == 0 ? 'hidden' : 'visible';
} document.getElementById('right').style.visibility =
for (let right of document.getElementsByClassName('w3-right')) { index == slides.length - 1 ? 'hidden' : 'visible';
console.log(index, slides.length - 1);
right.style.visibility =
index == slides.length - 1 ? 'hidden' : 'visible';
}
} }
let dots = [...document.getElementsByClassName('dot')];
for (let dot of dots) {
dot.onclick = () => set(dots.indexOf(dot));
}
for (let button of document.getElementsByClassName('proceed')) {
button.onclick = () => show(1);
}
document.getElementById('left').onclick = () => show(-1);
document.getElementById('right').onclick = () => show(1);
document.getElementById('complete').onclick = function () {
console.log('completing');
tfrpc.rpc.complete().then(function () {
console.log('completed');
let a = document.createElement('a');
a.href = '/~core/ssb/';
a.target = '_top';
document.body.appendChild(a);
a.click();
});
};
window.addEventListener('keyup', function (event) { window.addEventListener('keyup', function (event) {
if (event.key == 'ArrowLeft') { if (event.key == 'ArrowLeft') {
show(-1); show(-1);

View File

@ -2202,8 +2202,7 @@ static void _tf_ssb_db_resolve_index_work(tf_ssb_t* ssb, void* user_data)
if (!request->path) if (!request->path)
{ {
/* From default global settings. */ request->path = tf_strdup(tf_util_get_default_global_setting_string("index"));
request->path = tf_strdup("/~core/ssb/");
} }
} }

View File

@ -368,7 +368,7 @@ static const setting_t k_settings[] = {
.type = "string", .type = "string",
.description = "If connecting by HTTP and HTTPS is configured, Location header prefix (ie, \"http://example.com\")", .description = "If connecting by HTTP and HTTPS is configured, Location header prefix (ie, \"http://example.com\")",
.default_value = { .kind = k_kind_string, .string_value = NULL } }, .default_value = { .kind = k_kind_string, .string_value = NULL } },
{ .name = "index", .type = "string", .description = "Default path.", .default_value = { .kind = k_kind_string, .string_value = "/~core/ssb/" } }, { .name = "index", .type = "string", .description = "Default path.", .default_value = { .kind = k_kind_string, .string_value = "/~core/intro/" } },
{ .name = "index_map", { .name = "index_map",
.type = "textarea", .type = "textarea",
.description = "Mappings from hostname to redirect path, one per line, as in: \"www.tildefriends.net=/~core/index/\"", .description = "Mappings from hostname to redirect path, one per line, as in: \"www.tildefriends.net=/~core/index/\"",