Fix small bug with description and authors
parent
b1e9e61430
commit
15d0e7c6fd
|
@ -25,7 +25,7 @@ import sys
|
||||||
if sys.version_info[0] == 2 or sys.version_info[1] < 5:
|
if sys.version_info[0] == 2 or sys.version_info[1] < 5:
|
||||||
print('Error, Onionr requires Python 3.4+')
|
print('Error, Onionr requires Python 3.4+')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
import os, base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re, json
|
import os, base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re, json, getpass
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import api, core, config, logger, onionrplugins as plugins, onionrevents as events
|
import api, core, config, logger, onionrplugins as plugins, onionrevents as events
|
||||||
import onionrutils
|
import onionrutils
|
||||||
|
|
|
@ -181,6 +181,7 @@ def pluginToBlock(plugin, import_block = True):
|
||||||
data = base64.b64encode(open(zipfile, 'rb').read())
|
data = base64.b64encode(open(zipfile, 'rb').read())
|
||||||
|
|
||||||
author = getpass.getuser()
|
author = getpass.getuser()
|
||||||
|
description = 'Default plugin description'
|
||||||
info = {"name" : plugin}
|
info = {"name" : plugin}
|
||||||
try:
|
try:
|
||||||
if os.path.exists(directory + 'info.json'):
|
if os.path.exists(directory + 'info.json'):
|
||||||
|
@ -188,11 +189,11 @@ def pluginToBlock(plugin, import_block = True):
|
||||||
if 'author' in info:
|
if 'author' in info:
|
||||||
author = info['author']
|
author = info['author']
|
||||||
if 'description' in info:
|
if 'description' in info:
|
||||||
author = info['description']
|
description = info['description']
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
metadata = {'author' : author, 'date' : str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')), 'name' : plugin, 'info' : info, 'compiled-by' : plugin_name, 'content' : data.decode('utf-8')}
|
metadata = {'author' : author, 'date' : str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')), 'name' : plugin, 'info' : info, 'compiled-by' : plugin_name, 'content' : data.decode('utf-8'), 'description' : description}
|
||||||
|
|
||||||
hash = pluginapi.get_core().insertBlock(json.dumps(metadata), header = 'plugin', sign = True)
|
hash = pluginapi.get_core().insertBlock(json.dumps(metadata), header = 'plugin', sign = True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue