Commit 4cac144a by Corey Koval

Access token optional

parent 7accf0a5
...@@ -46,6 +46,7 @@ Click the power button to enable/disable. ...@@ -46,6 +46,7 @@ Click the power button to enable/disable.
- ~Create a single line file named ```accesstoken.txt```~ - ~Create a single line file named ```accesstoken.txt```~
- Turns out you can use a public token, you just can't use Cesium Assets. - Turns out you can use a public token, you just can't use Cesium Assets.
Most people don't need to use assets. Most people don't need to use assets.
- The token is optional with --access_token=accesstoken.txt
- [Extended XML KerberosSDR Software](https://github.com/ckoval7/kerberossdr) - [Extended XML KerberosSDR Software](https://github.com/ckoval7/kerberossdr)
- This is available for both Qt4 (original version) and Qt5 (Ubuntu 20.04+). Just check out the appropriate branch. - This is available for both Qt4 (original version) and Qt5 (Ubuntu 20.04+). Just check out the appropriate branch.
......
...@@ -667,8 +667,6 @@ def server_static(filepath): ...@@ -667,8 +667,6 @@ def server_static(filepath):
@get('/cesium') @get('/cesium')
def cesium(): def cesium():
response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0') response.set_header('Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0')
with open('accesstoken.txt', "r") as tokenfile:
access_token = tokenfile.read().replace('\n', '')
return template('cesium.tpl', return template('cesium.tpl',
{'access_token':access_token, {'access_token':access_token,
'epsilon':ms.eps, 'epsilon':ms.eps,
...@@ -1161,6 +1159,7 @@ if __name__ == '__main__': ...@@ -1161,6 +1159,7 @@ if __name__ == '__main__':
Only applies when clustering is turned on. This creates larger CZML files.""",action="store_true") Only applies when clustering is turned on. This creates larger CZML files.""",action="store_true")
parser.add_option("-o", "--offline", dest="disable", help="Starts program with receiver turned off.", parser.add_option("-o", "--offline", dest="disable", help="Starts program with receiver turned off.",
action="store_false", default=True) action="store_false", default=True)
parser.add_option("--access_token", dest="token_file", help="Cesium Access Token File", metavar="FILE")
parser.add_option("--ip", dest="ipaddr", help="IP Address to serve from. Default 127.0.0.1", parser.add_option("--ip", dest="ipaddr", help="IP Address to serve from. Default 127.0.0.1",
metavar="IP ADDRESS", type="str", default="127.0.0.1") metavar="IP ADDRESS", type="str", default="127.0.0.1")
parser.add_option("--port", dest="port", help="Port number to serve from. Default 8080", parser.add_option("--port", dest="port", help="Port number to serve from. Default 8080",
...@@ -1185,6 +1184,14 @@ if __name__ == '__main__': ...@@ -1185,6 +1184,14 @@ if __name__ == '__main__':
ms.receiving = options.disable ms.receiving = options.disable
ms.plotintersects = options.plotintersects ms.plotintersects = options.plotintersects
if options.token_file:
tokenfile = options.token_file
with open(tokenfile, "r") as token:
access_token = token.read().replace('\n', '')
print(access_token)
else:
access_token = None
web = threading.Thread(target=start_server,args=(options.ipaddr, options.port)) web = threading.Thread(target=start_server,args=(options.ipaddr, options.port))
web.daemon = True web.daemon = True
web.start() web.start()
...@@ -1193,6 +1200,7 @@ if __name__ == '__main__': ...@@ -1193,6 +1200,7 @@ if __name__ == '__main__':
dbwriter.daemon = True dbwriter.daemon = True
dbwriter.start() dbwriter.start()
try: try:
############################################### ###############################################
# Reds receivers from the database first, then # Reds receivers from the database first, then
......
...@@ -42,8 +42,10 @@ ...@@ -42,8 +42,10 @@
var receiversDataSource = new Cesium.CzmlDataSource(); var receiversDataSource = new Cesium.CzmlDataSource();
var aoiDataSource = new Cesium.CzmlDataSource(); var aoiDataSource = new Cesium.CzmlDataSource();
% if access_token:
// Your access token can be found at: https://cesium.com/ion/tokens. // Your access token can be found at: https://cesium.com/ion/tokens.
Cesium.Ion.defaultAccessToken = '{{access_token}}'; Cesium.Ion.defaultAccessToken = '{{access_token}}';
% end
var viewer = new Cesium.Viewer('cesiumContainer', { var viewer = new Cesium.Viewer('cesiumContainer', {
homeButton: false, homeButton: false,
timeline: false, timeline: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment