#!/usr/bin/env python3
""" =============================== |
| PlainDiscuss |
| |
| Licensed under the AGPLv3 license |
| Copyright (C) 2022, OctoSpacc |
| =============================== """
import json
from ast import literal_eval
from flask import Flask, request, send_file
#from APIConfig import *
App = Flask(__name__)
def ReadFile(p):
try:
with open(p, 'r') as f:
return f.read()
except Exception:
print("Error reading file {}".format(p))
return None
def WriteFile(p, c):
try:
with open(p, 'w') as f:
f.write(c)
return True
except Exception:
print("Error writing file {}".format(p))
return False
def SetConfig():
Config = {
'Development': False,
'Port': 8080}
File = ReadFile('Config.json')
if File:
File = json.loads(File)
for i in File:
if i in File and File[i]:
Config[i] = File[i]
return Config
def GetComments():
return [0,0,0]
def PatchHTML():
Base = ReadFile('Source/Main.html')
FormMain = ReadFile('Source/Form.Main.html')
FormComment = ReadFile('Source/Form.Comment.html')
Comments = ''
for i in GetComments():
Comments += "\n