on master help sign in
Added extractor
commit78ebd8ce1c9ff29a8615514ac7e01b4b56b376fc authorneauoire <aliceffekt@gmail.com> dateWed 18 Mar 2020, 09:20 (7 years ago) parent69a250a
5 files changed+40−13
scripts/hallway.js+1−1 scripts/portal.js+4−4 scripts/sites.js+12−8 tools/extract_twtxt.js+22 tools/twtxt.json+1
scripts/hallway.js+1−1
@@ -215,7 +215,7 @@ function escapeHtml (unsafe) {
215215 return unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;')
216216}
217217
218−function cleanTags (unsafe){
218+function cleanTags (unsafe) {
219219 return unsafe.replace(/([^a-z0-9]+)/gi, '-')
220220}
221221
scripts/portal.js+4−4
@@ -18,11 +18,11 @@ function Portal (sites) {
1818
1919 const siteTypes = siteTypesArray.reduce((output, siteType) =>
2020 `${output}<a data-type="${siteType}" href="#" onclick="filterSites(event)">&lt;${siteType}&gt;</a>`,
21− '<a class="currentType" data-type="all" href="#" onclick="filterSites(event)">&lt;all&gt;</a>')
21+ '<a class="currentType" data-type="all" href="#" onclick="filterSites(event)">&lt;all&gt;</a>')
2222
2323 const siteLangs = siteLangsArray.reduce((output, siteLang) =>
2424 `${output}<a data-lang="${siteLang}" href="#" onclick="filterSites(event)">&lt;${siteLang}&gt;</a>`,
25− '<a class="currentLang" data-lang="all" href="#" onclick="filterSites(event)">&lt;all&gt;</a>')
25+ '<a class="currentLang" data-lang="all" href="#" onclick="filterSites(event)">&lt;all&gt;</a>')
2626
2727 const listItems = sites.reduce((acc, site, id) =>
2828 `${acc}<li ${_type(site)} ${_lang(site)} id='${id}'><a href='${site.url}'>${_name(site)}</a></li>`, '')
@@ -30,7 +30,7 @@ function Portal (sites) {
3030 }
3131
3232 function _name (site) {
33− return site.title || `${site.url.split('//')[1].replace(/\/+$/,'')}`
33+ return site.title || `${site.url.split('//')[1].replace(/\/+$/, '')}`
3434 }
3535
3636 function _type (site) {
@@ -71,7 +71,7 @@ function Portal (sites) {
7171 setTimeout(() => { window.location.href = target }, 3000)
7272 }
7373
74− this.navLangs = [... new Set(navigator.languages.map(lang => lang.split('-').shift()))]
74+ this.navLangs = [...new Set(navigator.languages.map(lang => lang.split('-').shift()))]
7575
7676 this.sitesMatchingLangs = this.sites
7777 .filter(site => site.langs && site.langs.some(lang => this.navLangs.includes(lang)))
scripts/sites.js+12−8
@@ -719,7 +719,7 @@ const sites = [
719719 contact: 'roy@royniang.com',
720720 feed: 'https://telecom.royniang.com/updates.txt',
721721 langs: ['en'],
722− title: 'roy niang',
722+ title: 'roy niang',
723723 type: 'portfolio',
724724 url: 'https://royniang.com',
725725 wiki: 'https://telecom.royniang.com/usefulnotes.ndtl'
@@ -729,7 +729,7 @@ const sites = [
729729 author: 'raul altosaar',
730730 contact: 'raul.altosaar@gmail.com',
731731 langs: ['en'],
732− title: 'raul altosaar',
732+ title: 'raul altosaar',
733733 type: 'portfolio',
734734 url: 'https://www.raul.earth/'
735735 },
@@ -810,10 +810,10 @@ const sites = [
810810 type: 'hybrid',
811811 url: 'https://parkimminent.com'
812812 },
813−
813+
814814 {
815815 author: 'aklsh',
816− contact:'akileshkannan@gmail.com',
816+ contact: 'akileshkannan@gmail.com',
817817 langs: ['en'],
818818 url: 'https://aklsh.github.io',
819819 type: 'hybrid'
@@ -835,7 +835,7 @@ const sites = [
835835 type: 'portfolio',
836836 url: 'https://simone.computer'
837837 },
838−
838+
839839 {
840840 author: 'xj9',
841841 contact: 'xj9@sunshinegardens.org',
@@ -847,7 +847,7 @@ const sites = [
847847 url: 'https://xj9.io',
848848 wiki: 'https://xj9.io/.well-known/webring/wiki.ndtl'
849849 },
850−
850+
851851 {
852852 contact: 'joe.jenett@jenett.org',
853853 langs: ['en'],
@@ -856,7 +856,7 @@ const sites = [
856856 type: 'blog',
857857 url: 'https://simply.personal.jenett.org'
858858 },
859−
859+
860860 {
861861 author: 'Wally',
862862 contact: 'qpfiffer+xxiivvwebring@gmail.com',
@@ -865,7 +865,7 @@ const sites = [
865865 type: 'blog',
866866 url: 'http://q.pfiffer.org/'
867867 },
868−
868+
869869 {
870870 author: 'ashpex',
871871 contact: 'ashpex@dismail.de',
@@ -883,3 +883,7 @@ No trailing slashes or commas!
883883Alphabetize your keys!
884884protocol://url.domain.ext
885885*/
886+
887+if (module && module.exports) {
888+ module.exports = sites
889+}
tools/extract_twtxt.jsnew file+22
@@ -0,0 +1,22 @@
1+'use strict'
2+
3+// extract twtxt feeds from sites.js
4+
5+const fs = require('fs')
6+const sites = require('../scripts/sites.js')
7+const record = { following: {} }
8+
9+for (const site of sites) {
10+ if (!site.author || !site.feed) { continue }
11+ record.following[site.author] = site.feed
12+}
13+
14+const json = JSON.stringify(record)
15+
16+fs.writeFile('twtxt.json', json, 'utf8', (err) => {
17+ if (err) {
18+ console.log('An error occured while writing JSON Object to File.')
19+ return console.log(err)
20+ }
21+ console.log('Done.')
22+})
tools/twtxt.jsonnew file+1
@@ -0,0 +1 @@
1+{"following":{"neauoire":"https://wiki.xxiivv.com/twtxt.txt","rho":"https://electro.pizza/twtxt.txt","joshavanier":"https://avanier.now.sh/tw.txt","kaemura":"https://kaemura.com/twttxt.txt","slisne":"https://liamcooke.com/merveilles/tw.txt","xvw":"https://xvw.github.io/twtxt/hallway.txt","lectronice":"https://lectronice.com/hallway/twtxt.txt","cblgh":"https://cblgh.org/twtxt.txt","jda0":"https://2d4.dev/tw.txt","wakest":"https://wake.st/twtxt.txt","drisc":"https://drisc.io/hallway/twtxt.txt","setphen":"https://phse.net/twtxt/merv.txt","kodedninja":"https://t.seed.hex22.org/twtxt.txt","m":"https://mboxed.github.io/sodatsu/tw.txt","tomupom":"https://a.tom.org.nz/twtxt.txt","teknari":"https://teknari.com/feed.xml","amorris":"https://feed.amorris.ca/hallway.txt","stuartpb":"https://twtxt.stuartpb.com/xxiivv.txt","serocell":"https://xxiii.co/twtxt.txt","kormyen":"https://kor.nz/twtxt.txt","quite":"https://lublin.se/twtxt.txt","eli_oat":"https://txt.eli.li/twtxt/twtxt.txt","azlen":"https://azlen.me/twtxt.txt","vega":"https://opinionatedguide.github.io/twtxt.txt","cmaughan":"https://chrismaughan.com/twtxt.txt","Fundor 333":"https://fundor333.com/twtxt.txt","dcb":"https://dotcomboom.somnolescent.net/twtxt.txt","icyphox":"https://icyphox.sh/twtxt.txt","roy niang":"https://telecom.royniang.com/updates.txt","eti":"https://y.eti.tf/twtxt.txt","Payson Wallach":"https://paysonwallach.com/blog/feed.xml","icco":"https://writing.natwelch.com/feed.atom","xj9":"https://xj9.io/.well-known/webring/tw.txt"}}