forked from mirrors/bookwyrm
Merge branch 'main' into production
This commit is contained in:
commit
4424acc5c2
10 changed files with 204 additions and 126 deletions
68
.github/workflows/codeql-analysis.yml
vendored
Normal file
68
.github/workflows/codeql-analysis.yml
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
# ******** NOTE ********
|
||||
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ main ]
|
||||
schedule:
|
||||
- cron: '18 6 * * 3'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript', 'python' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more...
|
||||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
|
@ -34,7 +34,7 @@ Since the project is still in its early stages, not everything here is fully imp
|
|||
- Differentiate local and federated reviews and rating
|
||||
- Track reading activity
|
||||
- Shelve books on default "to-read," "currently reading," and "read" shelves
|
||||
- Create custom shleves
|
||||
- Create custom shelves
|
||||
- Store started reading/finished reading dates
|
||||
- Update followers about reading activity (optionally, and with granular privacy controls)
|
||||
- Federation with ActivityPub
|
||||
|
|
|
@ -99,13 +99,13 @@
|
|||
{% csrf_token %}
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
||||
<div class="field">
|
||||
<label class="label" for="start_date">
|
||||
<label class="label">
|
||||
Started reading
|
||||
<input type="date" name="start_date" class="input" id="id_start_date-{{ readthrough.id }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="finish_date">
|
||||
<label class="label">
|
||||
Finished reading
|
||||
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ readthrough.id }}" value="{{ readthrough.finish_date | date:"Y-m-d" }}">
|
||||
</label>
|
||||
|
@ -150,11 +150,11 @@
|
|||
</div>
|
||||
|
||||
<div class="block">
|
||||
<h3>Tags</h3>
|
||||
<form name="tag" action="/tag/" method="post">
|
||||
<label for="tags" class="is-3">Tags</label>
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input class="input" type="text" name="name">
|
||||
<input id="tags" class="input" type="text" name="name">
|
||||
<button class="button" type="submit">Add tag</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
{% endfor %}
|
||||
</p>
|
||||
<p class="block">
|
||||
<label class="checkbox label" for="id_manually_approve_followers">
|
||||
<label class="checkbox label" for="id_manually_approves_followers">
|
||||
Manually approve followers:
|
||||
{{ form.manually_approves_followers }}
|
||||
</label>
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href="/">
|
||||
<img class="image logo" src="/static/images/logo-small.png" alt="BookWyrm">
|
||||
<img class="image logo" src="/static/images/logo-small.png" alt="Home page">
|
||||
</a>
|
||||
<form class="navbar-item" action="/search/">
|
||||
<div class="field is-grouped">
|
||||
<input class="input" type="text" name="q" placeholder="Search for a book or user" value="{{ query }}">
|
||||
<input aria-label="Search for a book or user" id="search-input" class="input" type="text" name="q" placeholder="Search for a book or user" value="{{ query }}">
|
||||
<button class="button" type="submit">
|
||||
<span class="icon icon-search">
|
||||
<span class="is-sr-only">search</span>
|
||||
|
@ -89,7 +89,7 @@
|
|||
<div class="tags has-addons">
|
||||
<span class="tag is-medium">
|
||||
<span class="icon icon-bell">
|
||||
<span class="is-sr-only">Notitications</span>
|
||||
<span class="is-sr-only">Notifications</span>
|
||||
</span>
|
||||
</span>
|
||||
{% if request.user|notification_count %}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
<img class="avatar image {% if large %}is-96x96{% else %}is-32x32{% endif %}" src="{% if user.avatar %}/images/{{ user.avatar }}{% else %}/static/images/default_avi.jpg{% endif %}">
|
||||
{% load fr_display %}
|
||||
<img class="avatar image {% if large %}is-96x96{% else %}is-32x32{% endif %}" src="{% if user.avatar %}/images/{{ user.avatar }}{% else %}/static/images/default_avi.jpg{% endif %}" alt="avatar for {{ user|username }}">
|
||||
|
||||
|
|
50
bookwyrm/templates/snippets/finish_reading_modal.html
Normal file
50
bookwyrm/templates/snippets/finish_reading_modal.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{% load fr_display %}
|
||||
<div>
|
||||
<input class="toggle-control" type="checkbox" name="finish-reading-{{ uuid }}" id="finish-reading-{{ uuid }}">
|
||||
<div class="modal toggle-content hidden">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Finish "{{ book.title }}"</p>
|
||||
<label class="delete" for="finish-reading-{{ uuid }}" aria-label="close" role="button"></label>
|
||||
</header>
|
||||
{% active_read_through book user as readthrough %}
|
||||
<form name="finish-reading" action="/finish-reading" method="post">
|
||||
<section class="modal-card-body">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
Started reading
|
||||
<input type="date" name="start_date" class="input" id="finish_id_start_date-{{ uuid }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
Finished reading
|
||||
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<div class="columns">
|
||||
<div class="column field">
|
||||
<label for="post-status">
|
||||
<input type="checkbox" name="post-status" class="checkbox" checked>
|
||||
Post to feed
|
||||
</label>
|
||||
{% include 'snippets/privacy_select.html' %}
|
||||
</div>
|
||||
<div class="column">
|
||||
<button type="submit" class="button is-success">Save</button>
|
||||
<label for="finish-reading-{{ uuid }}" class="button" role="button">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</div>
|
||||
<label class="modal-close is-large" for="finish-reading-{{ uuid }}" aria-label="close" role="button"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -9,13 +9,15 @@
|
|||
<span>Read</span> <span class="icon icon-check"></span>
|
||||
</button>
|
||||
{% elif active_shelf.identifier == 'reading' %}
|
||||
<label class="button is-small" for="finish-reading-{{ uuid }}">
|
||||
<label class="button is-small" for="finish-reading-{{ uuid }}" role="button" tabindex="0">
|
||||
I'm done!
|
||||
</label>
|
||||
{% include 'snippets/finish_reading_modal.html' %}
|
||||
{% elif active_shelf.identifier == 'to-read' %}
|
||||
<label class="button is-small" for="start-reading-{{ uuid }}">
|
||||
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
|
||||
Start reading
|
||||
</label>
|
||||
{% include 'snippets/start_reading_modal.html' %}
|
||||
{% else %}
|
||||
<form name="shelve" action="/shelve/" method="post">
|
||||
{% csrf_token %}
|
||||
|
@ -26,19 +28,22 @@
|
|||
{% endif %}
|
||||
|
||||
<div class="dropdown is-hoverable">
|
||||
<div class="button dropdown-trigger is-small">
|
||||
<div class="dropdown-trigger">
|
||||
<button class="button is-small" aria-haspopup="true" aria-controls="dropdown-menu-{{ uuid }}">
|
||||
<span class="icon icon-arrow-down"><span class="is-sr-only">More shelves</span></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="dropdown-menu">
|
||||
<div class="dropdown-menu" id="dropdown-menu-{{ uuid }}" role="menu">
|
||||
<ul class="dropdown-content">
|
||||
{% for shelf in request.user.shelf_set.all %}
|
||||
<li>
|
||||
{% if shelf.identifier == 'reading' and active_shelf.identifier != 'reading' %}
|
||||
<div class="dropdown-item pt-0 pb-0">
|
||||
<label class="button is-small" for="start-reading-{{ uuid }}">
|
||||
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
|
||||
{{ shelf.name }}
|
||||
</label>
|
||||
{% include 'snippets/start_reading_modal.html' %}
|
||||
</div>
|
||||
{% else %}
|
||||
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
|
||||
|
@ -57,94 +62,5 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input class="toggle-control" type="checkbox" name="start-reading-{{ uuid }}" id="start-reading-{{ uuid }}">
|
||||
<div class="modal toggle-content hidden">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Start "{{ book.title }}"</p>
|
||||
<label class="delete" for="start-reading-{{ uuid }}" aria-label="close"></label>
|
||||
</header>
|
||||
<form name="start-reading" action="/start-reading" method="post">
|
||||
<section class="modal-card-body">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<div class="field">
|
||||
<label class="label" for="start_date">
|
||||
Started reading
|
||||
<input type="date" name="start_date" class="input" id="start_id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<div class="columns">
|
||||
<div class="column field">
|
||||
<label for="post-status">
|
||||
<input type="checkbox" name="post-status" class="checkbox" checked>
|
||||
Post to feed
|
||||
</label>
|
||||
{% include 'snippets/privacy_select.html' %}
|
||||
</div>
|
||||
<div class="column">
|
||||
<button class="button is-success" type="submit">Save</button>
|
||||
<label for="start-reading-{{ uuid }}" class="button">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</div>
|
||||
<label class="modal-close is-large" for="start-reading-{{ uuid }}" aria-label="close"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input class="toggle-control" type="checkbox" name="finish-reading-{{ uuid }}" id="finish-reading-{{ uuid }}">
|
||||
<div class="modal toggle-content hidden">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Finish "{{ book.title }}"</p>
|
||||
<label class="delete" for="finish-reading-{{ uuid }}" aria-label="close"></label>
|
||||
</header>
|
||||
{% active_read_through book user as readthrough %}
|
||||
<form name="finish-reading" action="/finish-reading" method="post">
|
||||
<section class="modal-card-body">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
||||
<div class="field">
|
||||
<label class="label" for="start_date">
|
||||
Started reading
|
||||
<input type="date" name="start_date" class="input" id="finish_id_start_date-{{ uuid }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="finish_date">
|
||||
Finished reading
|
||||
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<div class="columns">
|
||||
<div class="column field">
|
||||
<label for="post-status">
|
||||
<input type="checkbox" name="post-status" class="checkbox" checked>
|
||||
Post to feed
|
||||
</label>
|
||||
{% include 'snippets/privacy_select.html' %}
|
||||
</div>
|
||||
<div class="column">
|
||||
<button type="submit" class="button is-success">Save</button>
|
||||
<label for="finish-reading-{{ uuid }}" class="button">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</div>
|
||||
<label class="modal-close is-large" for="finish-reading-{{ uuid }}" aria-label="close"></label>
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
|
40
bookwyrm/templates/snippets/start_reading_modal.html
Normal file
40
bookwyrm/templates/snippets/start_reading_modal.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<div>
|
||||
<input class="toggle-control" type="checkbox" name="start-reading-{{ uuid }}" id="start-reading-{{ uuid }}">
|
||||
<div class="modal toggle-content hidden">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Start "{{ book.title }}"</p>
|
||||
<label class="delete" for="start-reading-{{ uuid }}" aria-label="close" role="button" tabindex="0"></label>
|
||||
</header>
|
||||
<form name="start-reading" action="/start-reading" method="post">
|
||||
<section class="modal-card-body">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
Started reading
|
||||
<input type="date" name="start_date" class="input" id="start_id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<div class="columns">
|
||||
<div class="column field">
|
||||
<label for="post-status">
|
||||
<input type="checkbox" name="post-status" class="checkbox" checked>
|
||||
Post to feed
|
||||
</label>
|
||||
{% include 'snippets/privacy_select.html' %}
|
||||
</div>
|
||||
<div class="column">
|
||||
<button class="button is-success" type="submit">Save</button>
|
||||
<label for="start-reading-{{ uuid }}" class="button" role="button" tabindex="0">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</div>
|
||||
<label class="modal-close is-large" for="start-reading-{{ uuid }}" aria-label="close"></label>
|
||||
</div>
|
||||
</div>
|
|
@ -71,6 +71,8 @@ def nodeinfo(request):
|
|||
local=True,
|
||||
last_active_date__gt=six_months_ago
|
||||
).count()
|
||||
|
||||
site = models.SiteSettings.get()
|
||||
return JsonResponse({
|
||||
'version': '2.0',
|
||||
'software': {
|
||||
|
@ -88,33 +90,34 @@ def nodeinfo(request):
|
|||
},
|
||||
'localPosts': status_count,
|
||||
},
|
||||
'openRegistrations': True,
|
||||
'openRegistrations': site.allow_registration,
|
||||
})
|
||||
|
||||
|
||||
def instance_info(request):
|
||||
''' what this place is TODO: should be settable/editable '''
|
||||
''' let's talk about your cool unique instance '''
|
||||
if request.method != 'GET':
|
||||
return HttpResponseNotFound()
|
||||
|
||||
user_count = models.User.objects.count()
|
||||
status_count = models.Status.objects.count()
|
||||
user_count = models.User.objects.filter(local=True).count()
|
||||
status_count = models.Status.objects.filter(user__local=True).count()
|
||||
|
||||
site = models.SiteSettings.get()
|
||||
return JsonResponse({
|
||||
'uri': DOMAIN,
|
||||
'title': 'BookWyrm',
|
||||
'short_description': 'Social reading, decentralized',
|
||||
'description': '',
|
||||
'email': 'mousereeve@riseup.net',
|
||||
'title': site.name,
|
||||
'short_description': '',
|
||||
'description': site.instance_description,
|
||||
'version': '0.0.1',
|
||||
'stats': {
|
||||
'user_count': user_count,
|
||||
'status_count': status_count,
|
||||
},
|
||||
'thumbnail': '', # TODO: logo thumbnail
|
||||
'thumbnail': 'https://%s/static/images/logo.png' % DOMAIN,
|
||||
'languages': [
|
||||
'en'
|
||||
],
|
||||
'registrations': True,
|
||||
'registrations': site.allow_registration,
|
||||
'approval_required': False,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue