Skip to content

Commit

Permalink
Revert "Finish final documentation, update README for new version, re…
Browse files Browse the repository at this point in the history
…move dead code."
  • Loading branch information
pdaian committed May 4, 2015
1 parent 177af5d commit a702fae
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 1,212 deletions.
28 changes: 11 additions & 17 deletions README.md
Expand Up @@ -17,11 +17,12 @@ The first step to installing FreeJournal is to ensure you have:
If you are on Windows, you can still browse one of many existing FreeJournal nodes.
Consult a list on our website.

To install database, documentation, and other library requirements, run
``sudo pip install -r requirements.txt`` on the root directory.
Run python install.py in bitmessage/ and in freenet/
to install the required prerequisites, then modify config.py to
change your local node settings.

After this, you should perform the required Freenet and Bitmessage setup using:
``sudo ./freejournal_cli.py install all`` on a Debian-compatible distribution.
To install database, documentation, and other library requirements, run
``pip install -r requirements.txt`` on the root directory.

## Generating Documentation

Expand All @@ -35,27 +36,20 @@ To generate API documentation, simply run

Modify the following example commands to create and publish a collection:
```
./freejournal_cli.py putcollection whee 1,2,3 "This is a TEST" "nothing to see here" "nothing,to" btc123
./freejournal-cli putcollection whee 1,2,3 "This is a TEST" "nothing to see here" "nothing,to" btc123
Collection inserted with address/ID [BM-2cVBBDezMcgoAHMkNzMswkc3xZRMFFvKeV
./freejournal_cli.py publishcollection whee BM-2cVBBDezMcgoAHMkNzMswkc3xZRMFFvKeV
./freejournal-cli publishcollection whee BM-2cVBBDezMcgoAHMkNzMswkc3xZRMFFvKeV
```

For more command usage instructions, run ``./freejournal_cli.py`` with no arguments.
... more coming soon

## Running FreeJournal Unit Tests

Simply ``coverage run --omit=*/python?.?/*,*/site-packages/*,*__init__*,test_*,*Freenet* -m unittest discover unittests``
in the root directory after installing the required prerequisites to run all tests with coverage.

## Running FreeJournal - The Network

To start pulling and pushing collections to and from the network, use the following two commands:

``./freejournal_cli.py keepalive`` and ``./freejournal_cli.py listen``

Simply `python run_tests.py` in the root directory after installing the required
prerequisites.

## Running FreeJournal - Web interface

After configuring the web interface in config.py, use `./freejournal_cli.py webapp` to run an insecure
After configuring the web interface in config.py, use `./freejournal-cli webapp` to run an insecure
development server. Hardened deployments should use the advanced deployment guides on the Flask
website.
File renamed without changes.
113 changes: 113 additions & 0 deletions controllers/api.py
@@ -0,0 +1,113 @@

import datetime
class Resource(object):
signature = None
timeCreated = None
description = ""
def __init__(self, signature, description):
self.originalSender = originalSender
self.signature = signature
self.timeCreated = datetime.datetime.now.time()
self.description = description

class Document(Resource):
title = ""
description = ""
timestamp = None
payload = None
documentHash = None
freeNetAddress = None
collectionAddress = None
def __init__(self, signature, description, payload, title, timestamp, collectionAddress):
Resource.__init__(self,signature,timeCreated,description)
self.title = title
self.timestamp = timestamp
self.payload = payload
self.documentHash = hash(payload)
self.collectionAddress = collectionAddress

class Collection(Resource):
title = ""
keywords = []
merkleHash = None
documents = []
btcID = None
collectionAddress
def __init__(self,signature,description, btcID, keywords, collectionAddress):
Resource.__init__(self,signature,description)
self.btcID = btcID
self.keywords = keywords
self.collectionAddress = collectionAddress

def addDocument(document):
documents.add(document)


'''
Inward Facing
This function retrives the document associated with the supplied SHA256 hash.
Every document has a unique documentHash that can be used to uniquely identify
and retrieve the indexing information (and subsequently) the document from
other nodes on the BitMessage Network.
To find the document assuming the information is not indexed locally, the
calling node will have to query (over bitmessage) the other nodes for its
existence. If one of the nodes has recieved the information in the past
TTL (usually 2 days), the node will broadcast the indexing information for the
document, allowing the request for indexing info to be completed.
Once the original node has the indexing information (the path to the data itself),
the node will connect to freenode and use the supplied index to retrieve the payload.
'''
def getDocument(hash):
return None


'''
Outward Facing
Create document is the outward facing function to add a document to the FreeJournal Network
To do this controllers, the document is first uploaded to FreeNet. Once there, the file
is associated with a freeNetAddress (like a URL) which is stored with the additional indexing
information and is distrubted (via a broadcast on Bitmessage) to the FreeJournal network.
signature - The private-key signed hash of the document, proving its authenticity. If
the decrypted(with the collections public key) data is equal to the hash of
the payload, we know the data is assured authenticity
description - a description of the contents of the document being uploaded
payload - The binary/text data that is to be uploaded\
title - The title of the document
timestamp - The Bitcoin signed time stamp, assuring the document's timeliness/existence
collectionAddress - The address of the collection the document is being published to.
This address is the BitMessage broadcast address for the collection
'''
def createDocument(signature, description, payload, title, timestamp, collectionAddress):
return Document(signature,description,payload,title,timestamp,collectionAddress)


'''
Outward Facing
Create collection is the function nodes use to create new collections to publish documents to.
To do this a Bitmessage broadcast address is supplied, as well as a signature to identify the
users that have the right to write to the collection.
signature - The private-key signed hash of the collectionAddress, proving its authenticity.
Note, since there is no payload for the initial createCollection, a signed hash
of the collectionAddress will act as the initial signature. The signature will
have to be verified immediately upon creation
description - description of the collection that is being createDocument
btcID - bitcoin transaction ID used to verify the collection
keywords - a String-list of keywords associated with the collectoin used for internal indexing
collectionAddress - The address of the collection. The address is the public broadcast address
for the BitMessage protocol.
'''
def createCollection(signature, description, btcID, keywords, collectionAddress):
return COllection(signature, description, btcID, keywords, collectionAddress)

'''
Inward Facing
This function is used by FreeJournal nodes to retrieve an entire collection that is not
on their local machine. To do this the randomNone and password are combined in order to
regenerate a Public/Private key pair. This keypair is associated with the collection and
the other nodes can be queried accordingly.
'''
def importCollection(randomNonce, password):
Binary file removed docs/final/FreeJournal.pdf
Binary file not shown.

0 comments on commit a702fae

Please sign in to comment.