-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1ecd903
Showing
25 changed files
with
800 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Announcements | ||
* First announcement | ||
|
||
# Changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
name: PyPI Publish | ||
|
||
jobs: | ||
publish: | ||
name: Upload release to PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi-release | ||
url: https://pypi.org/p/django-bigredbutton | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.12" | ||
- name: Install latest version of Poetry | ||
run: | | ||
pipx install poetry | ||
ls /opt | ||
ls /opt/pipx_bin | ||
which poetry | ||
- name: Add Poetry to $PATH | ||
run: | | ||
ls /opt | ||
ls /opt/pipx_bin | ||
ls -l /opt/pipx_bin/poetry | ||
echo "/opt/pipx_bin" >> $GITHUB_PATH | ||
which poetry | ||
- name: Get Poetry version | ||
run: | | ||
poetry --version | ||
- name: Check pyproject.toml validity | ||
run: poetry check --no-interaction | ||
- name: Install deps | ||
run: | | ||
poetry config virtualenvs.in-project true | ||
poetry install --no-interaction | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
print-hash: true | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Create release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
autorelease: | ||
name: Create release | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.12" | ||
- name: Install latest version of Poetry | ||
run: | | ||
pipx install poetry | ||
ls /opt | ||
ls /opt/pipx_bin | ||
which poetry | ||
- name: Add Poetry to $PATH | ||
run: | | ||
echo "/opt" | ||
ls /opt | ||
echo "/opt/pipx" | ||
ls /opt/pipx | ||
echo "/opt/pipx_bin" | ||
ls /opt/pipx_bin | ||
ls -l /opt/pipx_bin/poetry | ||
echo "/opt/pipx_bin" >> $GITHUB_PATH | ||
which poetry | ||
- name: Get Poetry version | ||
run: | | ||
poetry --version | ||
- name: Add version to environment vars | ||
run: | | ||
PROJECT_VERSION=$(poetry version --short) | ||
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV | ||
- name: Check if tag version matches project version | ||
run: | | ||
TAG=$(git describe HEAD --tags --abbrev=0) | ||
echo $TAG | ||
echo $PROJECT_VERSION | ||
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi | ||
- name: Check pyproject.toml validity | ||
run: poetry check --no-interaction | ||
- name: Install deps | ||
run: | | ||
poetry config virtualenvs.in-project true | ||
poetry install --no-interaction | ||
- name: Run tests | ||
run: poetry run pytest -v | ||
- name: Build | ||
run: | | ||
poetry build | ||
- name: Release Notes | ||
run: | | ||
if (git describe HEAD~ --tags --abbrev=0); then | ||
git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md" | ||
else | ||
touch .github/RELEASE-TEMPLATE.md | ||
fi | ||
- name: Create Release Draft | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: ".github/RELEASE-TEMPLATE.md" | ||
draft: true | ||
fail_on_unmatched_files: true | ||
files: | | ||
dist/django_bigredbutton-${{env.PROJECT_VERSION}}-py3-none-any.whl | ||
dist/django_bigredbutton-${{env.PROJECT_VERSION}}.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: tests | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11", "3.12"] | ||
django-version: ["4.0", "4.1", "4.2"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# https://jacobian.org/til/github-actions-poetry/ | ||
- name: Cache poetry install | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local | ||
key: poetry-1.6.1-${{ matrix.python-version }}-${{ matrix.django-version }} | ||
- name: Install latest version of Poetry | ||
if: steps.cache-poetry.outputs.cache-hit != 'true' | ||
run: | | ||
pipx install poetry | ||
- name: Install and cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: pydeps-${{ hashFiles('pyproject.toml') }}-${{ matrix.python-version }}-${{ matrix.django-version }} | ||
- if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: | | ||
poetry config virtualenvs.in-project true | ||
poetry install --no-interaction --no-root | ||
- name: Run tests | ||
run: | | ||
poetry run pytest --cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.egg-info | ||
*.pyc | ||
.*cache | ||
.envrc | ||
.coverage | ||
.python-version | ||
poetry.lock | ||
.idea/ | ||
.tox/ | ||
build/ | ||
dist/ | ||
htmlcov/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: "v4.5.0" | ||
hooks: | ||
- id: trailing-whitespace # trims trailing whitespace | ||
args: [--markdown-linebreak-ext=md] | ||
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline | ||
- id: check-yaml # checks syntax of yaml files | ||
- id: check-json # checks syntax of json files | ||
- id: check-toml # checks syntax of toml files | ||
- id: check-added-large-files # prevent giant files from being committed | ||
- id: end-of-file-fixer | ||
- id: fix-encoding-pragma # removes "# -*- coding: utf-8 -*-" from python files (since we only support python 3) | ||
args: [--remove] | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- id: check-merge-conflict # check for files that contain merge conflict strings | ||
|
||
- repo: https://github.com/python-poetry/poetry | ||
rev: "1.6.1" | ||
hooks: | ||
- id: poetry-check | ||
# - id: poetry-install | ||
|
||
- repo: https://github.com/adamchainz/django-upgrade | ||
rev: "1.15.0" | ||
hooks: | ||
- id: django-upgrade | ||
args: [--target-version, "3.2"] | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: "v3.15.0" | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py37-plus] | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.1.3 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (C) 2018 Mohammad Javad Naderi | ||
Copyright (C) 2014 Bouke Haarsma | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include README.rst | ||
include LICENSE.txt | ||
include CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Django QSessions | ||
|
||
[![pypi](https://img.shields.io/pypi/v/django-bigredbutton.svg)](https://pypi.python.org/pypi/django-bigredbutton/) | ||
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/blag/django-bigredbutton/main.svg)](https://results.pre-commit.ci/latest/github/blag/django-bigredbutton/main) | ||
[![tests ci](https://github.com/blag/django-bigredbutton/workflows/tests/badge.svg)](https://github.com/blag/django-bigredbutton/actions) | ||
|
||
**django-bigredbutton** includes two Django views for listing the current | ||
user's sessions and signing out of all of the user's other sessions | ||
|
||
It can work with multiple session backends, but the included template is meant | ||
to work with [django-qsessions](https://pypi.org/project/django-qsessions). | ||
Overriding the included template should be all that is necessary to use it with | ||
[django-user-sessions](https://pypi.org/project/django-user-sessions). | ||
|
||
## Compatibility | ||
|
||
- Python: >= **3.12** | ||
- Django: >= **4.0** | ||
|
||
## Installation | ||
|
||
1. Install the latest version: | ||
|
||
```sh | ||
pip install django-bigredbutton | ||
``` | ||
|
||
```sh | ||
poetry add django-bigredbutton | ||
``` | ||
|
||
2. Add a session backend, like django-qsession or django-user-sessions. You can | ||
use the optional packaging shortcuts: | ||
|
||
```sh | ||
pip install 'django-bigredbutton[qsession]' | ||
``` | ||
|
||
```sh | ||
pip install 'django-bigredbutton[user-sessions]' | ||
``` | ||
|
||
But there may be additional steps required for each session backend. Refer | ||
to the documentation for your session backend package for their installation | ||
instructions. | ||
|
||
3. Add `bigredbutton` to `INSTALLED_APPS` in your project's `settings.py`, and | ||
set `BIGREDBUTTON_DELETE_SUCCESS_URL_NAME` to the URL name of your choice | ||
(it defaults to `list_sessions`). | ||
4. Register `bigredbutton` in your projects root URLConf: | ||
```python | ||
urlpatterns = [ | ||
... | ||
path("account/sessions/", include("bigredbutton.urls")), | ||
... | ||
] | ||
``` | ||
## Usage | ||
Run Django's development server and navigate to the configured root for | ||
`bigredbutton`. The URL in these instructions will be | ||
`http://localhost:8000/account/sessions/`. | ||
|
||
You will see a list of all of your current sessions. If you have more than one | ||
session (eg: you are signed in on more than one browser or device), you will | ||
see a big red "End All Other Sessions" button. That button will sign you out of | ||
all of your other sessions. | ||
|
||
## TODO | ||
|
||
I have intentionally kept this app very small to minimize the maintenance | ||
burden. But contributions are very welcome! | ||
|
||
## License | ||
|
||
MIT |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from django.apps import AppConfig | ||
from django.conf import settings | ||
from django.core.checks import Error, register | ||
from django.template import Engine, TemplateDoesNotExist | ||
|
||
|
||
class BigRedButtonConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'bigredbutton' | ||
|
||
@register() | ||
def check_session_engine(app_configs, **kwargs): | ||
errors = [] | ||
if session_engine := getattr(settings, "SESSION_ENGINE"): | ||
engine_name = session_engine.split('.')[0] | ||
engine = Engine.get_default() | ||
try: | ||
engine.find_template(f"bigredbutton/{engine_name}_list.html") | ||
except TemplateDoesNotExist: | ||
errors.append( | ||
Error( | ||
( | ||
"There is no session list template for your " | ||
f"selected session engine '{engine_name}'." | ||
), | ||
hint=( | ||
"Ensure that your selected session engine has a " | ||
"corresponding template: " | ||
"'bigredbutton/{session_engine}.html" | ||
), | ||
id="bigredbutton.E001", | ||
), | ||
) | ||
return errors |
Oops, something went wrong.