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",
"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() {
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();

View File

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

View File

@ -368,7 +368,7 @@ static const setting_t k_settings[] = {
.type = "string",
.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 } },
{ .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",
.type = "textarea",
.description = "Mappings from hostname to redirect path, one per line, as in: \"www.tildefriends.net=/~core/index/\"",