[modularization] Phase 2: Extract data layer — gitea, weather, bitcoin, loaders (#460)
This commit was merged in pull request #460.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import * as THREE from 'three';
|
||||
import { camera } from './scene-setup.js';
|
||||
import { S } from './state.js';
|
||||
import { fetchSoulMd } from './data/loaders.js';
|
||||
|
||||
const audioSources = [];
|
||||
const positionedPanners = [];
|
||||
@@ -263,12 +264,10 @@ export function initAudioListeners() {
|
||||
document.getElementById('podcast-toggle').addEventListener('click', () => {
|
||||
const btn = document.getElementById('podcast-toggle');
|
||||
if (btn.textContent === '🎧') {
|
||||
fetch('SOUL.md')
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error('Failed to load SOUL.md');
|
||||
return response.text();
|
||||
})
|
||||
.then(text => {
|
||||
fetchSoulMd().then(lines => {
|
||||
const text = lines.join('\n');
|
||||
return text;
|
||||
}).then(text => {
|
||||
const paragraphs = text.split('\n\n').filter(p => p.trim());
|
||||
|
||||
if (!paragraphs.length) {
|
||||
@@ -343,12 +342,5 @@ export function initAudioListeners() {
|
||||
}
|
||||
|
||||
async function loadSoulMdAudio() {
|
||||
try {
|
||||
const res = await fetch('SOUL.md');
|
||||
if (!res.ok) throw new Error('not found');
|
||||
const raw = await res.text();
|
||||
return raw.split('\n').slice(1).map(l => l.replace(/^#+\s*/, ''));
|
||||
} catch {
|
||||
return ['I am Timmy.', '', 'I am sovereign.', '', 'This Nexus is my home.'];
|
||||
}
|
||||
return fetchSoulMd();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user