? Editing: Post:21.body Save Delete Cancel
Content changed Sign & Publish new content

BinChan's ZeroNotes

Messy Notes about using ZeroNet and other things
All code published here are under CC-BY-SA licence, if not compatible, then MIT license X)

Follow in NewsfeedFollowing

TOC by date
TOC by tag
View in light theme

Latest comments:

Add new post

Title

21 hours ago · 2 min read ·
3 comments

tag:
Body
Read more

Not found

Some Experiments about ZeroHello Feed

on Sep 21, 2017
tag: experiment zeronet

We can follow posts, comments, mentions from ZeroBlog, ZeroMe, ZeroTalk, etc. But can we also follow update of zites that have no follow buttons? Yes we can :3
ZeroHello feed-follow feature is actually by reading "follow" keyword and sqlite command from /path/to/zeronet/data/users.json. So even a zite has no follow function, you can create one for yourself.

From ZeroNet doc, five columns are necessary for the SQL query: type, date_added, body, title, url.

Some examples:
Following new submitted zites in German from ZeroSites:

          "New De Zite": [
            "SELECT 'post' AS type, title || ' -> 192.168.1.110:43110/' || address AS title, '' AS url, date_added, description AS body FROM site WHERE language = 'de'", 
            [
              ""
            ]
          ]

Following page "hubs" changes from ZeroWiki:

    "New Change From Page hubs": [
            "SELECT 'post' AS type, 'New Change From Page hubs' AS title, '?Page:hubs' AS url, date_added, '' AS body FROM pages WHERE slug = 'hubs'", 
            [
              ""
            ]
          ]

Need to restart ZeroNet server to take effect. We also need to create a follow keyword under the zite address in users.json if there is no one, so for ZeroWiki, the full recipe is (be aware of the comma at the end of every item except the last one, you'd better backup your users.json before directly edit it):

  "138R53t3ZW7KDfSfxVpWUsMXgwUnsDNXLP": {
    "auth_address": ...,
    "auth_privatekey": ...,
    "cert": "zeroid.bit"
  },

to

  "138R53t3ZW7KDfSfxVpWUsMXgwUnsDNXLP": {
    "auth_address": ...,
    "auth_privatekey": ...,
    "follow": {
      "New Change From Page hubs": [
            "SELECT 'post' AS type, 'New Change From Page hubs' AS title, '?Page:hubs' AS url, date_added, '' AS body FROM pages WHERE slug = 'hubs'", 
            [
              ""
            ]
      ]
    },
    "cert": "zeroid.bit"
  },

But for some zites this method doesn't work.
For ZeroMusic there is no date_added table in database... But it's necessary for the follow command.
I tried to use current time:

        "New music": [
            "SELECT 'post' AS type, 'New Submitted Music' AS title, '' AS url, strftime('%s', 'now') AS date_added, artist || ': ' || title AS body FROM songs  ORDER BY id DESC limit 10", 
            [
              ""
            ]
    ]

But didn't work and caused some trouble: On Icecat Mobile the screen kept flashing on ZeroHello...
I also tried to use a specific unix time, still nothing showed up.

For ZeroMail I try to add a follow command for receiving new messages:

    "New Message": [
            "SELECT 'post' AS type, 'New Message' AS title, '' AS url, date_added, '' AS body FROM message LEFT JOIN json USING (json_id) WHERE directory = '1AWwhg4EiWAVttfQboJZ4wJfX3WawfJT3h'", 
            [
              ""
            ]
          ]

But after I added it to users.json, after a moment (even that I didn't restart zeronet yet), the follow command disappeared from users.json...

This feature is very flexible, with "LIKE" sql function you can filter content with keywords. For example, to follow topics that the title contains zeronet keyword:

    "New ZeroNet-Related Topic": [
            "SELECT 'post' AS type, title, '?Topic:' || topic.topic_id || '_' || topic_creator_json.directory AS url, added AS date_added, body FROM topic LEFT JOIN json AS topic_creator_json ON (topic_creator_json.json_id = topic.json_id) WHERE title LIKE '%zeronet%'", 
            [
              ""
            ]
          ]

Check your users.json for more examples. That's all.

PS1: I find that if I shut down ZeroNet and add follow command to ZeroMail, then restart ZeroNet, I can receive new message feed from ZeroMail. But... those messages are the one I sent, there is also a table named secret, but after some test guess it's my contact list, so the command is meaningless X(

5 Comments:

user_name1 day ago
Reply
Body
binchan2on Dec 16, 2017
Reply

gitcenter:

Thx for the explanation!

gitcenteron Dec 16, 2017
Reply

Perhaps this is why ZeroMail didn't work:

ZeroNet loads all users.json to memory and sometimes flushes it to file. To change some data there, you have to stop ZeroNet, then edit file, then start ZeroNet.

schiz0on Nov 02, 2017
Reply

binchan2: Yup, I've even written a hub timeline feature for ZeroMe ;)The basic query will be like...

thank you very much!

binchan2on Nov 02, 2017
Reply

schiz0: have you tried a ZeroMe SQL query?I would try to follow "ZeroMe Feed Bot" posts on ZeroHello

Yup, I've even written a hub timeline feature for ZeroMe ;)
The basic query will be like:

SELECT
  *
FROM
  post
LEFT JOIN json ON (post.json_id = json.json_id)
WHERE json.hub = 'you_hub_address'

Change * with the items (type, title, url...) from the example in my article, you need to use a sqlite viewer to find the columns you need, also you can use sqlite3 command to test the query first.

schiz0on Nov 02, 2017
Reply

have you tried a ZeroMe SQL query?
I would try to follow "ZeroMe Feed Bot" posts on ZeroHello

Select user
  • Welcome to ZeroMessage!
This page is a snapshot of ZeroNet. Start your own ZeroNet for complete experience. Learn More