From e21d59386c7fd2dc739158ef7007c5edffd02c86 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 7 Nov 2020 20:47:56 -0800 Subject: [PATCH 01/14] Don't show reshelve buttons on other people's shelves yikes --- bookwyrm/templates/snippets/shelf.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bookwyrm/templates/snippets/shelf.html b/bookwyrm/templates/snippets/shelf.html index 8629ed1a..1ca5ed60 100644 --- a/bookwyrm/templates/snippets/shelf.html +++ b/bookwyrm/templates/snippets/shelf.html @@ -66,9 +66,11 @@ {% include 'snippets/stars.html' with rating=ratings|dict_key:book.id %} {% endif %} + {% if shelf.user == request.user %} {% include 'snippets/shelf_selector.html' with current=shelf %} + {% endif %} {% endfor %} From 01f7d2ac44b7d9a301b3cf4d316619bd53cbcc05 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 7 Nov 2020 21:07:07 -0800 Subject: [PATCH 02/14] Updates nodeinfo and api info --- bookwyrm/wellknown.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bookwyrm/wellknown.py b/bookwyrm/wellknown.py index d670fb32..29cee707 100644 --- a/bookwyrm/wellknown.py +++ b/bookwyrm/wellknown.py @@ -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, }) From da5af56f720c9f063c864427faedd30bf3ac74ae Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 7 Nov 2020 21:17:52 -0800 Subject: [PATCH 03/14] Create codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..d35f90eb --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -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 From a6073caba0e4423ba8bd7bef30a7b7bca46dc56e Mon Sep 17 00:00:00 2001 From: Emil Date: Sun, 8 Nov 2020 17:02:01 +0100 Subject: [PATCH 04/14] Fixed typo in readme shleves -> shelves --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71b1a493..4d67bd85 100644 --- a/README.md +++ b/README.md @@ -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 From edc653e273c54afebf8ebc8dccebb9372398a1a1 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 8 Nov 2020 09:45:42 -0800 Subject: [PATCH 05/14] Fixes typo in edit user manually approve followers label --- bookwyrm/templates/edit_user.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/edit_user.html b/bookwyrm/templates/edit_user.html index a95cbca2..14d17024 100644 --- a/bookwyrm/templates/edit_user.html +++ b/bookwyrm/templates/edit_user.html @@ -37,7 +37,7 @@ {% endfor %}

-

- Notitications + Notifications {% if request.user|notification_count %} From 77b0a3b67f22f881f096ebe767cc53433f2ccc40 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 8 Nov 2020 12:25:05 -0800 Subject: [PATCH 07/14] Adds alt text to avatars --- bookwyrm/templates/snippets/avatar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/snippets/avatar.html b/bookwyrm/templates/snippets/avatar.html index ab621777..3d6e65cc 100644 --- a/bookwyrm/templates/snippets/avatar.html +++ b/bookwyrm/templates/snippets/avatar.html @@ -1,2 +1,2 @@ - +avatar for {{ user|username }} From 8f95c1e7284117705dbe10cfe65468cafe922dc4 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 8 Nov 2020 12:38:27 -0800 Subject: [PATCH 08/14] Clearer logo link to home page and missing filter import --- bookwyrm/templates/layout.html | 2 +- bookwyrm/templates/snippets/avatar.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index b1634ff1..6c3cd345 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -23,7 +23,7 @@