diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 052ac851..ccd047ea 100755 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at beardog@firemail.cc. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at beardog at mailbox.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/onionr/core.py b/onionr/core.py index 1b803395..c1b743e4 100755 --- a/onionr/core.py +++ b/onionr/core.py @@ -21,7 +21,8 @@ import sqlite3, os, sys, time, math, base64, tarfile, nacl, logger, json, netcon from onionrblockapi import Block import onionrutils, onionrcrypto, onionrproofs, onionrevents as events, onionrexceptions -import onionrblacklist, onionrusers +import onionrblacklist +from onionrusers import onionrusers import dbcreator, onionrstorage, serializeddata from etc import onionrvalues diff --git a/onionr/onionr.py b/onionr/onionr.py index b47e6be3..c79b6488 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -25,7 +25,7 @@ MIN_PY_VERSION = 6 if sys.version_info[0] == 2 or sys.version_info[1] < MIN_PY_VERSION: print('Error, Onionr requires Python 3.%s+' % (MIN_PY_VERSION,)) sys.exit(1) -import os, base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re, json, getpass, sqlite3 +import os, base64, random, getpass, shutil, time, platform, datetime, re, json, getpass, sqlite3 import webbrowser, uuid, signal from threading import Thread import api, core, config, logger, onionrplugins as plugins, onionrevents as events @@ -33,7 +33,8 @@ import onionrutils import netcontroller, onionrstorage from netcontroller import NetController from onionrblockapi import Block -import onionrproofs, onionrexceptions, onionrusers, communicator +import onionrproofs, onionrexceptions, communicator +from onionrusers import onionrusers try: from urllib3.contrib.socks import SOCKSProxyManager diff --git a/onionr/onionrblockapi.py b/onionr/onionrblockapi.py index 9f38b785..732071d3 100755 --- a/onionr/onionrblockapi.py +++ b/onionr/onionrblockapi.py @@ -18,8 +18,9 @@ along with this program. If not, see . ''' -import core as onionrcore, logger, config, onionrexceptions, nacl.exceptions, onionrusers +import core as onionrcore, logger, config, onionrexceptions, nacl.exceptions import json, os, sys, datetime, base64, onionrstorage +from onionrusers import onionrusers class Block: blockCacheOrder = list() # NEVER write your own code that writes to this! diff --git a/onionr/onionrusers/contactmanager.py b/onionr/onionrusers/contactmanager.py new file mode 100644 index 00000000..c44952b3 --- /dev/null +++ b/onionr/onionrusers/contactmanager.py @@ -0,0 +1,30 @@ +''' + Onionr - P2P Anonymous Storage Network + + Sets more abstract information related to a peer. Can be thought of as traditional 'contact' system +''' +''' + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import onionrusers + +class ContactManager(onionrusers.OnionrUser): + def set_info(self, key, value): + return + def add_contact(self): + return + def delete_contact(self): + return + \ No newline at end of file diff --git a/onionr/onionrusers.py b/onionr/onionrusers/onionrusers.py similarity index 100% rename from onionr/onionrusers.py rename to onionr/onionrusers/onionrusers.py diff --git a/onionr/static-data/www/ui/README.md b/onionr/static-data/www/ui/README.md deleted file mode 100755 index 451b08ed..00000000 --- a/onionr/static-data/www/ui/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Onionr UI - -## About - -The default GUI for Onionr - -## Setup - -To compile the application, simply execute the following: - -``` -python3 compile.py -``` - -If you are wanting to compile Onionr UI for another language, execute the following, replacing `[lang]` with the target language (supported languages include `eng` for English, `spa` para español, and `zho`为中国人): - -``` -python3 compile.py [lang] -``` - -## FAQ -### Why "compile" anyway? -This web application is compiled for a few reasons: -1. To make it easier to update; this way, we do not have to update the header in every file if we want to change something about it. -2. To make the application smaller in size; there is less duplicated code when the code like the header and footer can be stored in an individual file rather than every file. -3. For multi-language support; with the Python "tags" feature, we can reference strings by variable name, and based on a language file, they can be dynamically inserted into the page on compilation. -4. For compile-time customizations. - -### What exactly happens when you compile? -Upon compilation, files from the `src/` directory will be copied to `dist/` directory, header and footers will be injected in the proper places, and Python "tags" will be interpreted. - - -### How do Python "tags" work? -There are two types of Python "tags": -1. Logic tags (`<$ logic $>`): These tags allow you to perform logic at compile time. Example: `<$ import datetime; lastUpdate = datetime.datetime.now() $>`: This gets the current time while compiling, then stores it in `lastUpdate`. -2. Data tags (`<$= data $>`): These tags take whatever the return value of the statement in the tags is, and write it directly to the page. Example: `<$= 'This application was compiled at %s.' % lastUpdate $>`: This will write the message in the string in the tags to the page. - -**Note:** Logic tags take a higher priority and will always be interpreted first. - -### How does the language feature work? -When you use a data tag to write a string to the page (e.g. `<$= LANG.HELLO_WORLD $>`), the language feature simply takes dictionary of the language that is currently being used from the language map file (`lang.json`), then searches for the key (being the variable name after the characters `LANG.` in the data tag, like `HELLO_WORLD` from the example before). It then writes that string to the page. Language variables are always prefixed with `LANG.` and should always be uppercase (as they are a constant). - -### I changed a few things in the application and tried to view the updates in my browser, but nothing changed! -You most likely forgot to compile. Try running `python3 compile.py` and check again. If you are still having issues, [open up an issue](https://gitlab.com/beardog/Onionr/issues/new?issue[title]=Onionr UI not updating after compiling). \ No newline at end of file diff --git a/onionr/static-data/www/ui/common/default-icon.html b/onionr/static-data/www/ui/common/default-icon.html deleted file mode 100755 index 86ccf773..00000000 --- a/onionr/static-data/www/ui/common/default-icon.html +++ /dev/null @@ -1 +0,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dtnZu+ZnH3vr9a7V7iKW6WK0ge7nkON5Xauf8BVTW7CSDT5jdkRSS5LSY5I/oPaudw5TrjUuZOnX9lt2G4leUDBO7j8RWxaX1urj/AEWE+jp6+4NcCYDcaiyWaKijptX5vwPua0H0y/gVZcXicfeLZFZSj5mySZ6OmpwiEyRLl1+9C67SP8+tYuo61a6nFJAEktpPQ9DWXpFprGqbbd/MaMcFmToPr1rpD4OijVTN50zDH3RyfxqbtbE8sYvU/9k= diff --git a/onionr/static-data/www/ui/common/footer.html b/onionr/static-data/www/ui/common/footer.html deleted file mode 100755 index 0143c2d8..00000000 --- a/onionr/static-data/www/ui/common/footer.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - diff --git a/onionr/static-data/www/ui/common/header.html b/onionr/static-data/www/ui/common/header.html deleted file mode 100755 index 2a2b4f56..00000000 --- a/onionr/static-data/www/ui/common/header.html +++ /dev/null @@ -1,30 +0,0 @@ -<$= LANG.ONIONR_TITLE $> - - - - - - - - - - diff --git a/onionr/static-data/www/ui/common/onionr-reply-creator.html b/onionr/static-data/www/ui/common/onionr-reply-creator.html deleted file mode 100755 index aafc8557..00000000 --- a/onionr/static-data/www/ui/common/onionr-reply-creator.html +++ /dev/null @@ -1,31 +0,0 @@ - -
-
-
-
-
- -
-
- - - - -
- - -
-
-
-
-
- -
-
-
- diff --git a/onionr/static-data/www/ui/common/onionr-timeline-post.html b/onionr/static-data/www/ui/common/onionr-timeline-post.html deleted file mode 100755 index 67ec158c..00000000 --- a/onionr/static-data/www/ui/common/onionr-timeline-post.html +++ /dev/null @@ -1,32 +0,0 @@ - -
-
-
-
- -
-
-
- - -
- -
-
- -
- $content -
- -
- $liked - <$= LANG.POST_REPLY $> -
-
-
-
-
- diff --git a/onionr/static-data/www/ui/common/onionr-timeline-reply-creator.html b/onionr/static-data/www/ui/common/onionr-timeline-reply-creator.html deleted file mode 100755 index 4cb95b02..00000000 --- a/onionr/static-data/www/ui/common/onionr-timeline-reply-creator.html +++ /dev/null @@ -1,30 +0,0 @@ - -
-
-
-
-
-
- -
-
- - - - -
- - -
-
-
- -
-
-
- diff --git a/onionr/static-data/www/ui/common/onionr-timeline-reply.html b/onionr/static-data/www/ui/common/onionr-timeline-reply.html deleted file mode 100755 index cc8a312e..00000000 --- a/onionr/static-data/www/ui/common/onionr-timeline-reply.html +++ /dev/null @@ -1,31 +0,0 @@ - -
-
-
-
- -
-
-
- - -
- -
-
- -
- $content -
- -
- $liked - <$= LANG.POST_REPLY $> -
-
-
-
-
- diff --git a/onionr/static-data/www/ui/compile.py b/onionr/static-data/www/ui/compile.py deleted file mode 100755 index e991af08..00000000 --- a/onionr/static-data/www/ui/compile.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/python3 - -import shutil, os, re, json, traceback - -# get user's config -settings = {} -with open('config.json', 'r') as file: - settings = json.loads(file.read()) - -# "hardcoded" config, not for user to mess with -HEADER_FILE = 'common/header.html' -FOOTER_FILE = 'common/footer.html' -SRC_DIR = 'src/' -DST_DIR = 'dist/' -HEADER_STRING = '
' -FOOTER_STRING = '