MCPcopy Create free account
hub / github.com/MathMan05/Fermi / queryBlog

Method queryBlog

src/webpage/localuser.ts:327–362  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

325 this.trace.push(
326 ...json.map((trace) => {
327 return {trace, time: new Date()};
328 }),
329 );
330 }
331 async queryBlog() {
332 //TODO remove this soon
333 if (true as false) return;
334 const prefs = getPreferences();
335 const bstate = prefs.showBlogUpdates;
336 if (bstate === undefined) {
337 const pop = new Dialog("");
338 pop.options.addText(I18n.blog.wantUpdates());
339 const opts = pop.options.addOptions("", {ltr: true});
340 opts.addButtonInput("", I18n.yes(), async () => {
341 prefs.showBlogUpdates = true;
342 await setPreferences(prefs);
343 this.queryBlog();
344 pop.hide();
345 });
346 opts.addButtonInput("", I18n.no(), async () => {
347 prefs.showBlogUpdates = false;
348 await setPreferences(prefs);
349 this.queryBlog();
350 pop.hide();
351 });
352 pop.show();
353 } else if (bstate) {
354 const post = (await this.getPosts()).items[0];
355 this.perminfo.localuser ??= {};
356 if (this.perminfo.localuser.mostRecent !== post.url) {
357 this.perminfo.localuser.mostRecent = post.url;
358 const pop = new Dialog(post.title);
359 //TODO implement images for the rendering of this
360 pop.options.addText(post.content_html);
361 pop.options.addButtonInput("", I18n.blog.gotoPost(), () => {
362 window.open(post.url);
363 pop.hide();
364 });
365 pop.show();

Callers 1

gottenReadyMethod · 0.95

Calls 9

hideMethod · 0.95
showMethod · 0.95
getPostsMethod · 0.95
getPreferencesFunction · 0.90
setPreferencesFunction · 0.90
openMethod · 0.80
addTextMethod · 0.45
addOptionsMethod · 0.45
addButtonInputMethod · 0.45

Tested by

no test coverage detected