Fix donationmessage plugin

This commit is contained in:
HelloZeroNet 2016-03-16 23:25:27 +01:00
parent 77ac1ae796
commit f241a9aef3

View file

@ -7,18 +7,16 @@ from Plugin import PluginManager
@PluginManager.registerTo("UiRequest") @PluginManager.registerTo("UiRequest")
class UiRequestPlugin(object): class UiRequestPlugin(object):
# Inject a donation message to every page top right corner # Inject a donation message to every page top right corner
def actionWrapper(self, path): def renderWrapper(self, *args, **kwargs):
back = super(UiRequestPlugin, self).actionWrapper(path) body = super(UiRequestPlugin, self).renderWrapper(*args, **kwargs) # Get the wrapper frame output
if not back or not hasattr(back, "endswith"): return back # Wrapper error or not string returned, injection not possible
back = re.sub("</body>\s*</html>\s*$", inject_html = """
"""
<style> <style>
#donation_message { position: absolute; bottom: 0px; right: 20px; padding: 7px; font-family: Arial; font-size: 11px } #donation_message { position: absolute; bottom: 0px; right: 20px; padding: 7px; font-family: Arial; font-size: 11px }
</style> </style>
<a id='donation_message' href='https://blockchain.info/address/1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX' target='_blank'>Please donate to help to keep this ZeroProxy alive</a> <a id='donation_message' href='https://blockchain.info/address/1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX' target='_blank'>Please donate to help to keep this ZeroProxy alive</a>
</body> </body>
</html> </html>
""", back) """
return back return re.sub("</body>\s*</html>\s*$", inject_html, body)