Work on block api, finish later
parent
93338e3fb9
commit
e95feb06db
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env python3
|
||||
'''
|
||||
Onionr - P2P Microblogging Platform & Social network.
|
||||
Onionr - P2P Microblogging Platform & Social network.
|
||||
|
||||
This file contains both the OnionrCommunicate class for communcating with peers
|
||||
and code to operate as a daemon, getting commands from the command queue database (see core.Core.daemonQueue)
|
||||
This file contains both the OnionrCommunicate class for communcating with peers
|
||||
and code to operate as a daemon, getting commands from the command queue database (see core.Core.daemonQueue)
|
||||
'''
|
||||
'''
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
'''
|
||||
Onionr - P2P Microblogging Platform & Social network.
|
||||
|
||||
This class contains the OnionrBlocks class which is a class for working with Onionr blocks
|
||||
'''
|
||||
'''
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import core as onionrcore
|
||||
|
||||
class Block:
|
||||
def __init__(self, hash = None, core = None):
|
||||
self.hash = hash
|
||||
self.core = core
|
||||
|
||||
if self.getCore() is None:
|
||||
self.core = onionrcore.Core()
|
||||
if not self.getHash() is None:
|
||||
self.update()
|
||||
|
||||
# logic
|
||||
|
||||
def update(self, data = None, file = None):
|
||||
'''
|
||||
Loads data from a block in to the current object.
|
||||
|
||||
Inputs:
|
||||
- data (str):
|
||||
- if None: will load from file by hash
|
||||
- else: will load from `data` string
|
||||
- file (str):
|
||||
- if None: will load from file specified in this parameter
|
||||
- else: will load from wherever block is stored by hash
|
||||
|
||||
Outputs:
|
||||
- (bool): indicates whether or not the operation was successful
|
||||
'''
|
||||
|
||||
return False
|
||||
|
||||
def delete(self):
|
||||
return False
|
||||
|
||||
def save(self):
|
||||
return False
|
||||
|
||||
# getters
|
||||
|
||||
def getHash(self):
|
||||
return self.hash
|
||||
|
||||
def getCore(self):
|
||||
return self.core
|
||||
|
||||
def getType(self):
|
||||
return self.btype
|
||||
|
||||
def getMetadata(self):
|
||||
return self.bmetadata
|
||||
|
||||
def getContent(self):
|
||||
return self.bcontent
|
||||
|
||||
def getDate(self):
|
||||
return self.date
|
||||
|
||||
def isValid(self):
|
||||
return self.valid
|
||||
|
||||
def isSigned(self):
|
||||
return self.signed
|
||||
|
||||
def getSigner(self):
|
||||
return self.signer
|
||||
|
||||
# setters
|
||||
|
||||
def setType(self, btype):
|
||||
self.btype = btype
|
||||
return self
|
||||
|
||||
def setContent(self, bcontent):
|
||||
self.bcontent = bcontent
|
||||
return self
|
||||
|
||||
# static
|
||||
|
||||
ORDER_DATE = 0
|
||||
ORDER_ALPHABETIC = 1
|
||||
|
||||
def getBlocks(type = None, signer = None, order = ORDER_DATE, reverse = False):
|
||||
return None
|
||||
|
||||
def exists(hash):
|
||||
return None
|
|
@ -1,26 +0,0 @@
|
|||
'''
|
||||
Onionr - P2P Microblogging Platform & Social network.
|
||||
|
||||
This class contains the OnionrBlocks class which is a class for working with Onionr blocks
|
||||
'''
|
||||
'''
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
import json
|
||||
class OnionrBlocks:
|
||||
def __init__(self, coreInstance):
|
||||
return
|
||||
def metadataGenerate(self):
|
||||
return
|
||||
|
|
@ -1,5 +1,21 @@
|
|||
'''
|
||||
This is the future Onionr plugin manager. TODO: Add better description.
|
||||
Onionr - P2P Microblogging Platform & Social network.
|
||||
|
||||
This plugin acts as a plugin manager, and allows the user to install other plugins distributed over Onionr.
|
||||
'''
|
||||
'''
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
# useful libraries
|
||||
|
|
Loading…
Reference in New Issue