diff --git a/admin_page_server.py b/admin_page_server.py
index 6ab53db..2c97b3f 100644
--- a/admin_page_server.py
+++ b/admin_page_server.py
@@ -1,21 +1,3 @@
-# DWC Network Server Emulator
-# Copyright (C) 2014 SMTDDR
-# Copyright (C) 2014 kyle95wm
-# Copyright (C) 2014 AdmiralCurtiss
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-
from twisted.web import server, resource
from twisted.internet import reactor
from twisted.internet.error import ReactorAlreadyRunning
@@ -26,7 +8,6 @@ import collections
import json
import time
import datetime
-import os.path
import logging
import other.utils as utils
import gamespy
@@ -45,25 +26,19 @@ logger = utils.create_logger(logger_name, logger_filename, -1, logger_output_to_
#
# NOTE: Must use double-quotes or json module will fail
# NOTE2: Do not check the .json file into public git!
-
adminpageconf = None
-admin_username = None
-admin_password = None
-
-if os.path.exists('adminpageconf.json'):
- try:
- adminpageconf = json.loads(file('adminpageconf.json').read().strip())
- admin_username = str(adminpageconf['username'])
- admin_password = str(adminpageconf['password'])
- except Exception as e:
- logger.log(logging.WARNING, "Couldn't read adminpageconf.json. Admin page will not be available.")
- logger.log(logging.WARNING, str(e))
- adminpageconf = None
- admin_username = None
- admin_password = None
-else:
- logger.log(logging.INFO, "adminpageconf.json not found. Admin page will not be available.")
-
+try:
+ adminpageconf = file('adminpageconf.json').read().strip()
+except Exception,e:
+ logger.log(logging.INFO,"ERROR reading adminpageconf.json: "+str(e))
+ logger.log(logging.INFO," *** WARN: adminpageconf.json could not be read. Creating one with default values")
+ adminpageconf = '{"username":"admin","password":"opensesame"}'
+ fd = open('adminpageconf.json','w')
+ fd.write(adminpageconf)
+ fd.close()
+adminpageconf = json.loads(adminpageconf)
+admin_username = str(adminpageconf['username'])
+admin_password = str(adminpageconf['password'])
class AdminPage(resource.Resource):
isLeaf = True
@@ -71,29 +46,6 @@ class AdminPage(resource.Resource):
def __init__(self,adminpage):
self.adminpage = adminpage
- def get_header(self, title = None):
- if not title:
- title = 'AltWfc Admin Page'
- s = (
- ''
- '