项目作者: nextzlog

项目描述 :
automatic acceptance & tabulation system for amateur radio contests
高级语言: JavaScript
项目地址: git://github.com/nextzlog/ats4.git
创建时间: 2017-04-02T09:15:56Z
项目社区:https://github.com/nextzlog/ats4

开源协议:GNU General Public License v3.0

下载


``` The JavaScript program referenced may be written as follows: ```js let sock; function access() { const uuid = document.getElementById('UUID').value; sock = new WebSocket('ws://localhost:9000' + uuid); sock.binaryType = 'arraybuffer'; sock.onmessage = function(msg) { const decoder = new TextDecoder(); const data = decoder.decode(new Uint8Array(msg.data)); const text = document.createTextNode(data); const node = document.createElement('div'); document.getElementById('messages').appendChild(node); node.appendChild(text); }; } function submit() { const encoder = new TextEncoder(); const QSOs = document.getElementById('QSOs').value; const trim = document.getElementById('trim').value; const data = new TextEncoder().encode(QSOs); const full = new (data.constructor)(data.length + 1); full[0] = parseInt(trim); full.set(data, 1); sock.send(full); } ``` ## Contribution Feel free to make issues at [nextzlog/todo](https://github.com/nextzlog/todo). Follow [@nextzlog](https://twitter.com/nextzlog) on Twitter. ## License ### Author [無線部開発班](https://nextzlog.dev) - JG1VPP - JJ2ULU - JH1GEB - JE6MDL - JO4EFC - JJ1IBY - JS2FVO ### Clauses - 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 .

ATS-4: Amateur-Radio Contest Administration System

image
image
image
image
image
image
badge

ATS-4 is an Automatic Acceptance & Tabulation System for Amateur-Radio Contests, based on QxSL.
Feel free to visit ALLJA1 ATS-4.

Features

  • provides a web interface for contest-log acceptance.
  • verifies the uploaded logs according to the contest rules implemented in Ruby.
  • supports many contests including UEC, ALLJA1, REAL-TIME, VUS, QRP, AREA-1 AM, etc.

Documents

Quick Start

Docker image is available.
Paste the entire following script into the terminal and run it.

  1. echo -n 'enter mail hostname: '
  2. read host
  3. echo -n 'enter mail username: '
  4. read user
  5. echo -n 'enter mail password: '
  6. read pass
  7. cat << EOS > docker-compose.yaml
  8. version: '3'
  9. services:
  10. ATS4:
  11. image: ghcr.io/nextzlog/ats4:master
  12. ports:
  13. - 9000:9000
  14. volumes:
  15. - ./ats/data:/ats/data
  16. - ./ats/logs:/ats/logs
  17. command: /ats/bin/ats4
  18. environment:
  19. TZ: Asia/Tokyo
  20. ATS4_MAIL_HOST: $host
  21. ATS4_MAIL_USER: $user
  22. ATS4_MAIL_PASS: $pass
  23. ATS4_MAIL_MOCK: false
  24. ATS4_RULE_FILE: /rules/ats.rb
  25. www:
  26. image: nginx:latest
  27. ports:
  28. - 80:80
  29. volumes:
  30. - ./proxy.conf:/etc/nginx/conf.d/default.conf
  31. EOS
  32. echo -n 'enter server domain: '
  33. read name
  34. cat << EOS > proxy.conf
  35. server {
  36. server_name $name;
  37. location / {
  38. proxy_pass http://ATS4:9000;
  39. location ~ /admin {
  40. allow 127.0.0.1;
  41. deny all;
  42. }
  43. }
  44. }
  45. EOS
  46. docker compose up -d

Then, point your browser to http://localhost and verify that ATS-4 is running.

Configuration

First, create docker-compose.yaml as follows:

  1. version: '3'
  2. services:
  3. ATS4:
  4. image: ghcr.io/nextzlog/ats4:master
  5. ports:
  6. - 9000:9000
  7. volumes:
  8. - ./ats/data:/ats/data
  9. - ./ats/logs:/ats/logs
  10. command: /ats/bin/ats4
  11. environment:
  12. TZ: Asia/Tokyo
  13. ATS4_MAIL_HOST: $host
  14. ATS4_MAIL_USER: $user
  15. ATS4_MAIL_PASS: $pass
  16. ATS4_MAIL_MOCK: false
  17. ATS4_RULE_FILE: /rules/ats.rb
  18. www:
  19. image: nginx:latest
  20. ports:
  21. - 80:80
  22. volumes:
  23. - ./proxy.conf:/etc/nginx/conf.d/default.conf

Then, follow the instructions below.

Proxy

Create proxy.conf as follows:

  1. server {
  2. server_name localhost;
  3. location / {
  4. proxy_pass http://ATS4:9000;
  5. location ~ /admin {
  6. allow 127.0.0.1;
  7. deny all;
  8. }
  9. }
  10. }

Make sure that unauthorized clients cannot access administration pages under /admin.
Expose port 80 of the container to the internet so that the administration page cannot be accessed.

Email

Configure environment variables in docker-compose.yaml as follows:

  1. environment:
  2. ATS4_MAIL_HOST: $host
  3. ATS4_MAIL_USER: $user
  4. ATS4_MAIL_PASS: $pass
  5. ATS4_MAIL_MOCK: false

Modify the settings properly.

Regulation

Configure environment variables in docker-compose.yaml as follows:

  1. environment:
  2. ATS4_RULE_FILE: /rules/ats.rb
  3. # ATS4_RULE_FILE: /rules/1am.rb
  4. # ATS4_RULE_FILE: /rules/ja1.rb
  5. # ATS4_RULE_FILE: /rules/uec.rb

Of course, you can specify different rules by mounting external Ruby files into the container.
See ats.rb for example.

Run

Finally, create a container as follows:

  1. $ docker compose up -d

Access 80 port of the container.

Stop

Stop and remove the container as follows:

  1. $ docker compose down

Update

Pull the latest image as follows:

  1. $ docker pull ghcr.io/nextzlog/ats4:master

Development Mode

You can change Scala code and configuration without restarting by starting ATS-4 in development mode as follows:

  1. $ sbt run

Then, access http://localhost:9000/admin/shell to develop contest rules interactively.
You can test the scoring algorithm by attaching QSO data to the web form.

Stream API

ATS-4 provides the streaming API for the REAL-TIME CONTEST.

Registration

Contest participants will register their account information with ATS-4 in advance.
ATS-4 returns a security key (UUID) by sending a GET request to http://localhost:8873?id=<UUID>.
Clients may retrieve the key by listening on the 8873 port and access /agent/<UUID>.

Upstream

When the contest starts, the client always connects to the server via WebSocket.
Each time a participant contacts another participant on air, the client sends the difference in the QSO records to the server.
Messages from the clients to the server must follow the format below.

position field
1st byte number of QSOs deleted
sequence header of the QSO data
sequence QSO entities to delete
sequence QSO entities to append

The second and subsequent bytes of the messages are formatted as a single electronic log file.
The format must be officially supported by the QXSL library.

Downstream

The server receives the QSO records, scores it, wait a few seconds, and then notifies all clients of the score update.
JSON messages from the server to the clients are formatted as follows:

  1. {
  2. "14MHz": [
  3. {"call": "JA1ZLO", "score": 200, "total": 2200},
  4. {"call": "JA1YWX", "score": 100, "total": 2100}
  5. ]
  6. }

Demonstration

A simple WebSocket client for ATS-4 may be written as follows:

```html
<!DOCTYPE html>



ATS-4



Streaming Demo