Selaa lähdekoodia

Merge remote-tracking branch 'upstream/main'

Micrufun 2 vuotta sitten
vanhempi
commit
8f78d16045

+ 17 - 0
.github/workflows/pre-commit.yml

@@ -0,0 +1,17 @@
+name: pre-commit
+
+on:
+  pull_request:
+  push:
+    branches:
+      - main
+
+jobs:
+  pre-commit:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v3
+    - uses: actions/setup-python@v3
+    - uses: pre-commit/action@v3.0.0
+      with:
+        token: ${{ secrets.GITHUB_TOKEN }}

+ 3 - 3
.pre-commit-config.yaml

@@ -1,15 +1,15 @@
 repos:
   - repo: https://github.com/pycqa/flake8
-    rev: 3.7.9
+    rev: 6.0.0
     hooks:
       - id: flake8
   - repo: https://github.com/pycqa/isort
-    rev: 5.5.4
+    rev: 5.12.0
     hooks:
       - id: isort
         args: ["--profile", "black"]
   - repo: https://github.com/psf/black
-    rev: 22.3.0
+    rev: 23.1.0
     hooks:
       - id: black
         language_version: python3

+ 1 - 4
README.md

@@ -1,11 +1,8 @@
 # MediaCMS
 
-[![Code Quality: Cpp](https://img.shields.io/lgtm/grade/python/g/mediacms-io/mediacms.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/mediacms-io/mediacms/context:python)
-[![Code Quality: Cpp](https://img.shields.io/lgtm/grade/javascript/g/mediacms-io/mediacms.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/mediacms-io/mediacms/context:javascript)
-<br/>
 [![GitHub license](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://raw.githubusercontent.com/mediacms-io/mediacms/main/LICENSE.txt)
 [![Releases](https://img.shields.io/github/v/release/mediacms-io/mediacms?color=green)](https://github.com/mediacms-io/mediacms/releases/)
-[![DockerHub](https://img.shields.io/docker/pulls/mediacms/mediacms)](https://hub.docker.com/repository/docker/mediacms/mediacms/)
+[![DockerHub](https://img.shields.io/docker/pulls/mediacms/mediacms)](https://hub.docker.com/r/mediacms/mediacms)
 
 
 

+ 0 - 1
actions/migrations/0001_initial.py

@@ -4,7 +4,6 @@ from django.db import migrations, models
 
 
 class Migration(migrations.Migration):
-
     initial = True
 
     dependencies = []

+ 0 - 1
actions/migrations/0002_mediaaction_media.py

@@ -5,7 +5,6 @@ from django.db import migrations, models
 
 
 class Migration(migrations.Migration):
-
     initial = True
 
     dependencies = [

+ 0 - 1
actions/migrations/0003_auto_20201201_0712.py

@@ -6,7 +6,6 @@ from django.db import migrations, models
 
 
 class Migration(migrations.Migration):
-
     initial = True
 
     dependencies = [

+ 0 - 1
cms/custom_pagination.py

@@ -18,7 +18,6 @@ class FastPaginationWithoutCount(PageNumberPagination):
     django_paginator_class = FasterDjangoPaginator
 
     def get_paginated_response(self, data):
-
         return Response(
             OrderedDict(
                 [

+ 4 - 0
deploy/docker/nginx_http_only.conf

@@ -16,6 +16,10 @@ server {
 
     location /media {
         alias /home/mediacms.io/mediacms/media_files ;
+        add_header 'Access-Control-Allow-Origin' '*';
+        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
+        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
     }
 
     location / {

+ 4 - 2
docs/admins_docs.md

@@ -460,7 +460,9 @@ to be written
 Through the admin section - http://your_installation/admin/
 
 ## 12. Video transcoding
-Add / remove resolutions and profiles through http://your_installation/admin/encodeprofile
+Add / remove resolutions and profiles by modifying the database table of `Encode profiles` through https://your_installation/admin/files/encodeprofile/
+
+For example, the `Active` state of any profile can be toggled to enable or disable it.
 
 ## 13. How To Add A Static Page To The Sidebar
 
@@ -725,4 +727,4 @@ In [3]: for media in Media.objects.filter(media_type='video', sprites=''):
    ...:     produce_sprite_from_video(media.friendly_token)
 ```
 
-this will re-create the sprites for videos that the task failed. 
+this will re-create the sprites for videos that the task failed. 

+ 1 - 1
files/feeds.py

@@ -102,7 +102,7 @@ class SearchRSSFeed(Feed):
     description = "Latest Media RSS feed"
 
     def link(self, obj):
-        return f"/rss/search"
+        return "/rss/search"
 
     def get_object(self, request):
         category = request.GET.get("c", "")

+ 0 - 1
files/methods.py

@@ -358,7 +358,6 @@ def show_related_media_author(media, request, limit):
 
 
 def show_related_media_calculated(media, request, limit):
-
     """Return a list of related media based on ML recommendations
     A big todo!
     """

+ 0 - 1
files/migrations/0001_initial.py

@@ -10,7 +10,6 @@ import files.models
 
 
 class Migration(migrations.Migration):
-
     initial = True
 
     dependencies = []

+ 0 - 1
files/migrations/0002_auto_20201201_0712.py

@@ -8,7 +8,6 @@ from django.db import migrations, models
 
 
 class Migration(migrations.Migration):
-
     initial = True
 
     dependencies = [

+ 0 - 1
files/migrations/0003_auto_20210927_1245.py

@@ -4,7 +4,6 @@ from django.db import migrations, models
 
 
 class Migration(migrations.Migration):
-
     dependencies = [
         ('files', '0002_auto_20201201_0712'),
     ]

+ 0 - 4
files/models.py

@@ -320,7 +320,6 @@ class Media(models.Model):
         self.__original_uploaded_poster = self.uploaded_poster
 
     def save(self, *args, **kwargs):
-
         if not self.title:
             self.title = self.media_file.path.split("/")[-1]
 
@@ -378,7 +377,6 @@ class Media(models.Model):
         # will run only when a poster is uploaded for the first time
         if self.uploaded_poster and self.uploaded_poster != self.__original_uploaded_poster:
             with open(self.uploaded_poster.path, "rb") as f:
-
                 # set this otherwise gets to infinite loop
                 self.__original_uploaded_poster = self.uploaded_poster
 
@@ -586,9 +584,7 @@ class Media(models.Model):
 
         # attempt to break media file in chunks
         if self.duration > settings.CHUNKIZE_VIDEO_DURATION and chunkize:
-
             for profile in profiles:
-
                 if profile.extension == "gif":
                     profiles.remove(profile)
                     encoding = Encoding(media=self, profile=profile)

+ 0 - 1
files/tasks.py

@@ -272,7 +272,6 @@ def encode_media(
     #    return False
 
     with tempfile.TemporaryDirectory(dir=settings.TEMP_DIRECTORY) as temp_dir:
-
         tf = create_temp_file(suffix=".{0}".format(profile.extension), dir=temp_dir)
         tfpass = create_temp_file(suffix=".{0}".format(profile.extension), dir=temp_dir)
         ffmpeg_commands = produce_ffmpeg_commands(

+ 1 - 1
frontend/src/static/js/components/video-player/VideoPlayer.jsx

@@ -192,7 +192,7 @@ export function VideoPlayer(props) {
       document.addEventListener('visibilitychange', initPlayer);
     }
 
-    player.player.one('loadedmetadata', () => {       
+    player && player.player.one('loadedmetadata', () => {
       const urlParams = new URLSearchParams(window.location.search);
       const paramT = Number(urlParams.get('t'));
       const timestamp = !isNaN(paramT) ? paramT : 0;

+ 9 - 21
requirements.txt

@@ -1,33 +1,21 @@
 Django==3.1.12
 djangorestframework==3.12.2
 django-allauth==0.44.0
-
 psycopg2-binary==2.8.6
-
 uwsgi==2.0.19.1
-
 django-redis==4.12.1
 celery==4.4.7
-
 drf-yasg==1.20.0
-
 Pillow==8.2.0
-django-imagekit
-
-markdown
-django-filter
-
-filetype
-django-mptt
-
-django-crispy-forms
-
+django-imagekit==4.1.0
+markdown==3.3.6
+django-filter==21.1
+filetype==1.0.10
+django-mptt==0.13.4
+django-crispy-forms==1.13.0
 requests==2.25.0
-
-django-celery-email
-m3u8
-
-django-ckeditor
+django-celery-email==3.0.0
+m3u8==1.0.0
+django-ckeditor==6.2.0
 django-debug-toolbar==3.2.4
-
 django-login-required-middleware==0.6.1

+ 0 - 1
users/migrations/0001_initial.py

@@ -10,7 +10,6 @@ from django.db import migrations, models
 
 
 class Migration(migrations.Migration):
-
     initial = True
 
     dependencies = [

+ 0 - 1
users/views.py

@@ -176,7 +176,6 @@ Sender email: %s\n
 
 
 class UserList(APIView):
-
     permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
     parser_classes = (JSONParser, MultiPartParser, FormParser, FileUploadParser)
 

+ 1 - 1
version.py

@@ -1 +1 @@
-1.6
+2.0