Astroport.ONE/templates/tw/$ _plugins_astroport_lightb...

2 lines
51 KiB
JSON
Raw Normal View History

2022-12-06 18:33:28 +01:00
[{"created":"20221204164729903","creator":"Boris","text":"{\n \"tiddlers\": {\n \"$:/plugins/astroport/lightbeams/friends.js\": {\n \"created\": \"20221130194918470\",\n \"creator\": \"Boris\",\n \"text\": \"/*\\\\\\ntitle: $:/plugins/astroport/lightbeams/homefeed.js\\ntype: application/javascript\\nmodule-type: macro\\nMacro to return the user's homefeed\\n\\\\*/\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\n/*\\nInformation about this macro\\n*/\\n\\nexports.name = \\\"friends\\\";\\n\\nexports.params = [\\n];\\n\\n\\nexports.run = async function() {\\n\\n\\tlet gchangeNode = 'https://data.gchange.fr'\\n\\tlet uri = '/like/record/_search'\\n\\tlet url = gchangeNode + uri\\n\\tlet playerId = $tw.wiki.getTiddler('$:/plugins/astroport/lightbeams/state/playerGchangeId').fields.text\\n\\n\\tconsole.log('playerId :', playerId)\\n\\n\\t//\\n\\t// Get ratings I received\\n\\t//\\n\\t\\n\\tlet params = {\\n\\t\\tsize : 150, \\n\\t\\tquery : {\\n\\t\\t\\tbool : {\\n\\t\\t\\t\\tmust : [\\n\\t\\t\\t\\t\\t{term : {kind : 'STAR'}}\\n\\t\\t\\t\\t], \\n\\t\\t\\t\\tfilter : [\\n\\t\\t\\t\\t\\t{term : {id : playerId}}\\n\\t\\t\\t\\t]\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n\\n\\tlet fetchOpts = {\\n\\n\\t\\tmethod: 'POST',\\n\\t\\theaders: {\\n\\t\\t\\t'Content-Type': 'application/json;charset=utf-8'\\n\\t\\t},\\n\\t\\tbody: JSON.stringify(params)\\n\\t}\\n\\n\\tlet response = await fetch(url, fetchOpts)\\n\\n\\tlet jsonData = await response.json()\\n\\n\\tconsole.log(jsonData)\\n\\n\\tlet starSenders = ''\\n\\n\\tfor (const record of jsonData.hits.hits) {\\n\\n\\t\\t// sender\\n\\t\\tstarSenders += record._source.issuer + \\\"\\\\n\\\"\\n\\n\\t\\t// receiver\\n\\t\\t// friendsList += record._source.id\\n\\t}\\n\\n\\tlet fields = {title: '$:/plugins/astroport/lightbeams/state/stars_senders', text: starSenders}\\n\\t$tw.wiki.addTiddler(new $tw.Tiddler(fields))\\n\\n\\n\\t//\\n\\t// Get ratings I sent\\n\\t//\\n\\n\\tparams = {\\n\\t\\tsize: 150, \\n\\n\\t\\tquery : {\\n\\t\\t\\tbool : {\\n\\t\\t\\t\\tmust : [\\n\\t\\t\\t\\t\\t{term : {kind : 'STAR'} }\\n\\t\\t\\t\\t], \\n\\t\\t\\t\\tfilter : [\\n\\t\\t\\t\\t\\t{term : {issuer : playerId}}\\n\\t\\t\\t\\t]\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n\\n\\tfetchOpts = {\\n\\n\\t\\tmethod: 'POST',\\n\\t\\theaders: {\\n\\t\\t\\t'Content-Type': 'application/json;charset=utf-8'\\n\\t\\t},\\n\\t\\tbody: JSON.stringify(params)\\n\\t}\\n\\n\\tresponse = await fetch(url, fetchOpts)\\n\\n\\tjsonData = await response.json()\\n\\n\\tconsole.log(jsonData)\\n\\n\\tlet starSendees = ''\\n\\n\\tfor (const record of jsonData.hits.hits) {\\n\\n\\t\\t// sender\\n\\t\\tstarSendees += record._source.id + \\\"\\\\n\\\"\\n\\t}\\n\\n\\tfields = {title: '$:/plugins/astroport/lightbeams/state/stars_sendees', text: starSendees}\\n\\t$tw.wiki.addTiddler(new $tw.Tiddler(fields))\\n}\\n\\n\\n})();\",\n \"tags\": \"\",\n \"title\": \"$:/plugins/astroport/lightbeams/friends.js\",\n \"modified\": \"20221204180955944\",\n \"modifier\": \"Boris\",\n \"type\": \"application/javascript\",\n \"module-type\": \"macro\"\n },\n \"$:/plugins/astroport/lightbeams/HomeFeed\": {\n \"created\": \"20221130140952175\",\n \"creator\": \"Boris\",\n \"text\": \"<!-- -->\",\n \"title\": \"$:/plugins/astroport/lightbeams/HomeFeed\",\n \"modified\": \"20221204165539922\",\n \"modifier\": \"Boris\",\n \"tags\": \"\"\n },\n \"$:/plugins/astroport/lightbeams/homefeed.js\": {\n \"created\": \"20221130144350767\",\n \"creator\": \"Boris\",\n \"text\": \"/*\\\\\\ntitle: $:/plugins/astroport/lightbeams/homefeed.js\\ntype: application/javascript\\nmodule-type: macro\\nMacro to return the user's homefeed\\n\\\\*/\\n\\n(function(){\\n\\n/*jslint node: true, browser: true */\\n/*global $tw: false */\\n\\\"use strict\\\";\\n\\n/*\\nInformation about this macro\\n*/\