Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathanvdc/res-publica
An election website for online democracies (like SimDemocracy).
https://github.com/jonathanvdc/res-publica
python typescript
Last synced: about 9 hours ago
JSON representation
An election website for online democracies (like SimDemocracy).
- Host: GitHub
- URL: https://github.com/jonathanvdc/res-publica
- Owner: jonathanvdc
- Created: 2020-06-24T15:40:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-23T18:40:14.000Z (over 1 year ago)
- Last Synced: 2023-09-23T22:59:18.346Z (over 1 year ago)
- Topics: python, typescript
- Language: TypeScript
- Homepage: https://simdemocracy.org
- Size: 1.4 MB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Res Publica (the SimDem election website)
[SimDemocracy](https://www.reddit.com/r/SimDemocracy/) is an online community where citizens can participate in a simulated democracy, passing laws to change its nature. A key part of SimDemocracy is elections: We elect members of parliament and a president, and we also vote on referendums. Res Publica (this project) is SimDemocracy's election website. It supports the following scenarios:
* Registered voters can cast their ballots in elections and see past election results.
* Admins can set up elections, register voters and unregister voters.## Build Instructions
### Dependencies
To build Res Publica, you will need a recent version of `npm` (e.g., 6.14.4) and a recent version of Python 3 (e.g., 3.8.5). Make sure you also have pip3. Res Publica's server is designed to run on Linux systems but may run on other operating systems too.
### Change the homepage URL (Optional)
If you intend to host Res Publica at a non-root URL, go to the `front-end` directory. Change the `"homepage": "/"` field in `package.json` to the URL at which you mean to host the website. For instance, if you want to host at `/sdvote/` instead of at `/`, put `"homepage": "/sdvote/"`.
### Configure Res Publica
Navigate to the `back-end` directory. Create a file called `config.json` that contains your credentials for hosting the site. The contents of a `config.json` should look like the example below, with real web app credentials and bot credentials.
```json
{
"webapp-credentials": {
"client_id": "client ID",
"client_secret": "client secret",
"redirect_uri": "https://www.your-web-page.com/reddit-auth",
"user_agent": "simdem-voting-booth-v0.0.1"
},
"bot-credentials": {
"client_id": "client ID",
"client_secret": "client secret",
"username": "your-bot-for-scraping-CFCs",
"password": "password",
"user_agent": "simdem-voting-booth-bot-v0.0.1"
},
"host": {
"debug": false,
"port": 5000
},
"voter-requirements": [
{
"operator": ">=",
"lhs": "redditor.age",
"rhs": 60
},
{
"operator": ">=",
"lhs": "redditor.total_karma",
"rhs": 25
}
],
"default-permissions": {
"authenticated": {
"vote": ["view", "cast"],
"usermanagement": ["view"]
},
"authenticated-admin": {
"vote": ["view", "cast"],
"election": ["create", "edit", "cancel"],
"usermanagement": ["view", "add", "remove"]
},
"authenticated-developer": {
"vote": ["view", "cast"],
"election": ["create", "edit", "cancel", "view-suspicious-ballots"],
"usermanagement": ["view", "add", "remove"],
"administration": ["edit-permissions", "upgrade-server"]
}
},
"login_expiry": 2592000,
"flask-logs": false
}
```With the server configured, the only thing left for us to do is to appoint an admin (that's us!). Create a directory called `data` and in that directory create a file called `device-index.json` containing the following text, where `your-reddit-account` is your Reddit account name. If your Reddit account is, e.g., u/spez, then the Reddit account name you should enter is just "spez".
```json
{
"devices": {},
"permissions": {
"vote": {
"view": ["another-users-account"]
}
},
"admins": [
"your-reddit-account"
],
"developers": [
"your-reddit-account"
],
"registered-voters": [
"your-reddit-account"
]
}
```### Run the server
With the `config.json` in place, run the server like so:
```
python3 ./server-manager.py config.json
```Congratulations! If all went well, you should now have your very own instance of Res Publica.