forked from HelloZeroNet/ZeroNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 0.3.6, Rev879, Fix sidebar error on description missing, New …
…trayicon, New favicon, Disable some functions on MultiUser proxies, New homepage, Replace only the last ? in SQL queries, Alwaays grant ADMIN permission to homepage site, Announce before publish if no peers, configSet, serverShutdown, ADMIN WebsocketAPI command, Stop Tor client before updating, Ignore peer ip packing error, Ignore db files from git, Fix safari ajax error when UiPassword enabled
- Loading branch information
1 parent
f7eaf7b
commit 687a848
Showing
15 changed files
with
144 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ __pycache__/ | |
|
||
# Data dir | ||
data/* | ||
.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from Plugin import PluginManager | ||
import re | ||
|
||
@PluginManager.registerTo("UiWebsocket") | ||
class UiWebsocketPlugin(object): | ||
def actionFeedFollow(self, to, feeds): | ||
self.user.setFeedFollow(self.site.address, feeds) | ||
self.response(to, "ok") | ||
|
||
def actionFeedListFollow(self, to): | ||
feeds = self.user.sites[self.site.address].get("follow", {}) | ||
self.response(to, feeds) | ||
|
||
def actionFeedQuery(self, to): | ||
from Site import SiteManager | ||
rows = [] | ||
for address, site_data in self.user.sites.iteritems(): | ||
feeds = site_data.get("follow") | ||
if not feeds: | ||
continue | ||
for name, query_set in feeds.iteritems(): | ||
site = SiteManager.site_manager.get(address) | ||
try: | ||
query, params = query_set | ||
if ":params" in query: | ||
query = query.replace(":params", ",".join(["?"]*len(params))) | ||
res = site.storage.query(query+" ORDER BY date_added DESC LIMIT 10", params) | ||
else: | ||
res = site.storage.query(query+" ORDER BY date_added DESC LIMIT 10") | ||
except Exception, err: # Log error | ||
self.log.error("%s feed query %s error: %s" % (address, name, err)) | ||
continue | ||
for row in res: | ||
row = dict(row) | ||
row["site"] = address | ||
row["feed_name"] = name | ||
rows.append(row) | ||
return self.response(to, rows) | ||
|
||
|
||
@PluginManager.registerTo("User") | ||
class UserPlugin(object): | ||
# Set queries that user follows | ||
def setFeedFollow(self, address, feeds): | ||
site_data = self.getSiteData(address) | ||
site_data["follow"] = feeds | ||
self.save() | ||
return site_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import NewsfeedPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters