git ssb

0+

Grey the earthling / scuttleblog



Commit 7f52efdb80cbc9ef650fe516df888c342d967cdd

Rename userid to ssb_userid

To improve clarity in conf.py
Greg K Nicholson committed on 10/15/2017, 2:13:36 PM
Parent: 280029273cb8a3ad87628f4959116723aeab2681

Files changed

conf.pychanged
scuttleblog.pychanged
conf.pyView
@@ -1,3 +1,3 @@
1-userid='@JoiN9c9+xO0jgu0gg5yflTf+L1peLTBneFHjrKbmcKo=.ed25519'
1 +ssb_userid='@JoiN9c9+xO0jgu0gg5yflTf+L1peLTBneFHjrKbmcKo=.ed25519'
22 hugo_theme='ananke'
33
scuttleblog.pyView
@@ -39,10 +39,10 @@
3939 time.sleep(1)
4040 else:
4141 break
4242
43-def get_user_posts(userid):
44- user_posts_args = ['sbot', 'createUserStream', '--id', userid]
43 +def get_user_posts(ssb_userid):
44 + user_posts_args = ['sbot', 'createUserStream', '--id', ssb_userid]
4545 json_posts_args = ['json', '--group', '-c', 'this.value.content.type == "post"', '-c', 'this.value.content.root == null']
4646 user_posts_stream = subprocess.Popen(user_posts_args, stdout = subprocess.PIPE)
4747 user_posts_json = subprocess.check_output(json_posts_args, stdin = user_posts_stream.stdout)
4848 user_posts = json.loads(user_posts_json)
@@ -82,16 +82,16 @@
8282 os.makedirs(os.path.dirname(define_post_filename(post)), exist_ok=True)
8383 with open(define_post_filename(post), 'w') as f:
8484 f.write (format_post_file(post))
8585
86-def write_posts_from_user(userid):
87- posts = get_user_posts(userid)
86 +def write_posts_from_user(ssb_userid):
87 + posts = get_user_posts(ssb_userid)
8888 for post in posts:
8989 write_post_file(build_post_structure(post))
9090
9191
92-def get_user_metadata(userid):
93- user_metadata_args = ['sbot', 'links', '--source', userid, '--dest', userid, '--rel', 'about', '--values']
92 +def get_user_metadata(ssb_userid):
93 + user_metadata_args = ['sbot', 'links', '--source', ssb_userid, '--dest', ssb_userid, '--rel', 'about', '--values']
9494 json_metadata_args = ['json', '--deep-merge', '-c', 'this.value.content.type == "about"']
9595 user_metadata_stream = subprocess.Popen(user_metadata_args, stdout = subprocess.PIPE)
9696 user_metadata_json = subprocess.check_output(json_metadata_args, stdin = user_metadata_stream.stdout)
9797 user_metadata = json.loads(user_metadata_json)
@@ -106,18 +106,18 @@
106106 if 'description' in m['value']['content']:
107107 hugo_config['params']['subtitle'] = m['value']['content']['description'].replace('\n', ' ')
108108 return (hugo_config)
109109
110-def write_hugo_config_from_user(userid):
111- metadata = get_user_metadata(userid)
110 +def write_hugo_config_from_user(ssb_userid):
111 + metadata = get_user_metadata(ssb_userid)
112112 with open('hugo/config.json', 'w') as f:
113113 f.write (json.dumps(build_hugo_config(metadata), indent = 4))
114114 # TODO: add the user's image in the right place
115115
116116 def run_hugo():
117117 subprocess.run(['hugo', '-s', 'hugo'])
118118
119119 run_sbot()
120-write_posts_from_user(conf.userid)
121-write_hugo_config_from_user(conf.userid)
120 +write_posts_from_user(conf.ssb_userid)
121 +write_hugo_config_from_user(conf.ssb_userid)
122122 run_hugo()
123123

Built with git-ssb-web