Skip to content

Commit

Permalink
Rename SuperWASP to STING.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchote committed Jul 12, 2024
1 parent 0d9def0 commit c3cd48a
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 115 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ CREATE TABLE `dashboard_sessions` (

The `dashboard_config` table is expected to contain three rows:

| `id` | `keyname` | Description |
| ---- | ------------ | -------------- |
| `1` | `SECRET_KEY` | A complex random value used for encrypting cookies and other data. This should be a string of at least 40 random characters.|
| `2` | `GITHUB_CLIENT_ID` | Part of the GitHub authentication support. This should be set to the "Client ID" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. |
| `3` | `GITHUB_CLIENT_SECRET` | Part of the GitHub authentication support. This should be set to the "Client Secret" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. |
| `4` | `WEBCAM_SUPERWASP_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. |
| `5` | `WEBCAM_W1M_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. |
| `6` | `WEBCAM_CLASP_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. |
| `id` | `keyname` | Description |
|------|-----------------------------| -------------- |
| `1` | `SECRET_KEY` | A complex random value used for encrypting cookies and other data. This should be a string of at least 40 random characters.|
| `2` | `GITHUB_CLIENT_ID` | Part of the GitHub authentication support. This should be set to the "Client ID" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. |
| `3` | `GITHUB_CLIENT_SECRET` | Part of the GitHub authentication support. This should be set to the "Client Secret" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. |
| `4` | `WEBCAM_STING_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. |
| `5` | `WEBCAM_W1M_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. |
| `6` | `WEBCAM_CLASP_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. |
| `7` | `WEBCAM_HALFMETRE_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. |

Once that is working, you can configure the dashboard and web-serving infrastructure to run at startup using:
```
Expand Down
4 changes: 2 additions & 2 deletions dashboard.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ server {
proxy_pass http://10.2.6.48/axis-cgi/mjpg/video.cgi?resolution=1280x960&fps=10;
}

location /video/superwasp {
location /video/sting {
set $args "";
proxy_pass http://10.2.6.172/axis-cgi/mjpg/video.cgi?resolution=1280x960&fps=10;
}
Expand Down Expand Up @@ -81,7 +81,7 @@ server {
proxy_set_header Connection "upgrade";
}

location /microphone/superwasp {
location /microphone/sting {
proxy_pass http://10.2.6.169:9000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
Expand Down
70 changes: 35 additions & 35 deletions dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
'clip': 'ddashboard-HALFMETRE-clip.jpg',
}

SUPERWASP_GENERATED_DATA = {
STING_GENERATED_DATA = {
'cam1/thumb': 'dashboard-1-thumb.jpg',
'cam1/clip': 'dashboard-1-clip.jpg',
'cam2/thumb': 'dashboard-2-thumb.jpg',
Expand Down Expand Up @@ -251,20 +251,20 @@ def clasp_generated_data(path):
abort(404)


@app.route('/superwasp/')
def superwasp_dashboard():
@app.route('/sting/')
def sting_dashboard():
account = get_user_account()
if 'satellites' not in account['permissions']:
return redirect(url_for('site_overview'))

return render_template('superwasp.html', user_account=get_user_account())
return render_template('sting.html', user_account=get_user_account())


@app.route('/data/superwasp/<path:path>')
def superwasp_generated_data(path):
@app.route('/data/sting/<path:path>')
def sting_generated_data(path):
account = get_user_account()
if 'satellites' in account['permissions'] and path in SUPERWASP_GENERATED_DATA:
return send_from_directory(GENERATED_DATA_DIR, SUPERWASP_GENERATED_DATA[path])
if 'satellites' in account['permissions'] and path in STING_GENERATED_DATA:
return send_from_directory(GENERATED_DATA_DIR, STING_GENERATED_DATA[path])
abort(404)


Expand Down Expand Up @@ -351,7 +351,7 @@ def site_overview():
SiteCamera('goto2', 'GOTO 2', authorised=authorised_goto, video=True, audio=True, light=True, infrared=True),
SiteCamera('halfmetre', 'Half Metre', authorised=authorised_halfmetre, video=True, audio=True, light=True, infrared=True),
SiteCamera('w1m', 'W1m', authorised=authorised_onemetre, video=True, audio=True, light=True, infrared=True),
SiteCamera('superwasp', 'SuperWASP', authorised=authorised_satellites, video=True, audio=True, light=True, infrared=True),
SiteCamera('sting', 'STING', authorised=authorised_satellites, video=True, audio=True, light=True, infrared=True),
SiteCamera('clasp', 'CLASP', authorised=authorised_satellites, video=True, audio=True, light=True, infrared=True)
]

Expand All @@ -363,15 +363,15 @@ def site_overview():
@app.route('/camera/<path:camera>')
def camera_image(camera):
authorised = len(get_user_account()['permissions']) > 0
if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'superwasp', 'clasp']):
if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'sting', 'clasp']):
return send_from_directory(os.path.join(GENERATED_DATA_DIR, 'cameras'), camera + '.jpg')
abort(404)


@app.route('/camera/<path:camera>/thumb')
def camera_thumb(camera):
authorised = len(get_user_account()['permissions']) > 0
if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'superwasp', 'clasp']):
if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'sting', 'clasp']):
return send_from_directory(os.path.join(GENERATED_DATA_DIR, 'cameras'), camera + '_thumb.jpg')
abort(404)

Expand Down Expand Up @@ -407,20 +407,20 @@ def switch_light(light, state):
if light == 'goto2' and 'goto' in account['permissions']:
return _toggle_leds(daemons.goto_dome2_gtecs_power, 'leds', account, state)

if light == 'superwasp' and 'satellites' in account['permissions']:
return _toggle_leds(daemons.superwasp_power, 'light', account, state)
if light == 'sting' and 'satellites' in account['permissions']:
return _toggle_leds(daemons.sting_power, 'light', account, state)

if (light in ['halfmetre', 'serverroom']) and 'satellites' in account['permissions']:
return _toggle_leds(daemons.halfmetre_power, 'ilight' if light == 'halfmetre' else 'clight', account, state)

if light == 'clasp' and 'satellites' in account['permissions']:
return _toggle_leds(daemons.clasp_power, 'light', account, state)

if light == 'superwaspir' and 'satellites' in account['permissions']:
return _toggle_webcam_ir('10.2.6.172', app.config['WEBCAM_SUPERWASP_PASSWORD'], state == 'on')
if light == 'stingir' and 'satellites' in account['permissions']:
return _toggle_webcam_ir('10.2.6.172', app.config['WEBCAM_STING_PASSWORD'], state == 'on')

if light == 'halfmetreir' and 'satellites' in account['permissions']:
return _toggle_webcam_ir('10.2.6.118', app.config['WEBCAM_SUPERWASP_PASSWORD'], state == 'on')
return _toggle_webcam_ir('10.2.6.118', app.config['WEBCAM_HALFMETRE_PASSWORD'], state == 'on')

if light == 'w1mir' and 'w1m' in account['permissions']:
return _toggle_webcam_ir('10.2.6.208', app.config['WEBCAM_W1M_PASSWORD'], state == 'on')
Expand Down Expand Up @@ -507,27 +507,27 @@ def halfmetre_log():
})


@app.route('/data/superwasp/log')
def superwasp_log():
@app.route('/data/sting/log')
def sting_log():
account = get_user_account()
if 'satellites' not in account['permissions']:
abort(404)

return fetch_log_messages({
'powerd@superwasp': 'power',
'lmountd@superwasp': 'mount',
'superwasp_dome': 'dome',
'opsd@superwasp': 'ops',
'pipelined@superwasp': 'pipeline',
'qhy_camd@swasp-cam1': 'cam1',
'qhy_camd@swasp-cam2': 'cam2',
'qhy_camd@swasp-cam3': 'cam3',
'qhy_camd@swasp-cam4': 'cam4',
'diskspaced@superwasp_cam1': 'disk_das1',
'diskspaced@superwasp_cam2': 'disk_das2',
'diskspaced@superwasp_cam3': 'disk_das3',
'diskspaced@superwasp_cam4': 'disk_das4',
'dehumidifierd@superwasp': 'dehumidifier',
'powerd@sting': 'power',
'lmountd@sting': 'mount',
'sting_dome': 'dome',
'opsd@sting': 'ops',
'pipelined@sting': 'pipeline',
'qhy_camd@sting-cam1': 'cam1',
'qhy_camd@sting-cam2': 'cam2',
'qhy_camd@sting-cam3': 'cam3',
'qhy_camd@sting-cam4': 'cam4',
'diskspaced@sting_cam1': 'disk_das1',
'diskspaced@sting_cam2': 'disk_das2',
'diskspaced@sting_cam3': 'disk_das3',
'diskspaced@sting_cam4': 'disk_das4',
'dehumidifierd@sting': 'dehumidifier',
'lensheaterd': 'lensheater'
})

Expand Down Expand Up @@ -656,13 +656,13 @@ def goto_dashboard_data():
return response


@app.route('/data/superwasp/')
def superwasp_dashboard_data():
@app.route('/data/sting/')
def sting_dashboard_data():
account = get_user_account()
if 'satellites' not in account['permissions']:
abort(404)

response = send_from_directory(GENERATED_DATA_DIR, 'superwasp.json.gz')
response = send_from_directory(GENERATED_DATA_DIR, 'sting.json.gz')
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Content-Encoding'] = 'gzip'
return response
Expand Down
4 changes: 2 additions & 2 deletions dashboard/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
('w1m-dashboard', url_for('w1m_dashboard'), 'w1m', 'W1m'),
('halfmetre-dashboard', url_for('halfmetre_dashboard'), 'halfmetre', '0.5m'),
('clasp-dashboard', url_for('clasp_dashboard'), 'satellites', 'CLASP'),
('superwasp-dashboard', url_for('superwasp_dashboard'), 'satellites', 'SuperWASP'),
('sting-dashboard', url_for('sting_dashboard'), 'satellites', 'STING'),
] %}
<!doctype html>
<html lang="en" data-bs-theme="dark">
Expand Down Expand Up @@ -67,7 +67,7 @@
background-color: #000000 !important;
}

.superwasp-thumb-panel {
.sting-thumb-panel {
padding: 0 !important;
height: 88px;
width: 132px;
Expand Down
2 changes: 1 addition & 1 deletion dashboard/templates/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
<div class="col-lg-3 col-md-6 col-xs-12 g-2">
<div class="list-group rounded-0">
<span class="list-group-item" data-index='["superwasp_ops"]' data-generator="rockitStatus" data-bs-toggle="tooltip" data-bs-placement="left">SuperWASP</span>
<span class="list-group-item" data-index='["sting_ops"]' data-generator="rockitStatus" data-bs-toggle="tooltip" data-bs-placement="left">STING</span>
<span class="list-group-item" data-index='["clasp_ops"]' data-generator="rockitStatus" data-bs-toggle="tooltip" data-bs-placement="left">CLASP</span>
<span class="list-group-item" data-index='["onemetre_ops"]' data-generator="rockitStatus" data-bs-toggle="tooltip" data-bs-placement="left">W1m</span>
<span class="list-group-item" data-index='["halfmetre_ops"]' data-generator="rockitStatus" data-bs-toggle="tooltip" data-bs-placement="left">0.5m</span>
Expand Down
Loading

0 comments on commit c3cd48a

Please sign in to comment.