1
0
mirror of https://github.com/etesync/server synced 2024-11-22 00:38:07 +00:00

fix: move django_etebase module from toplevel to under etebase_server

This is in preparation for creating a python package, which should only
occupy the "etebase_server" name in the global module namespace.
This commit is contained in:
Xiretza 2022-05-08 16:32:29 +02:00
parent 9d6e0ae60a
commit ada5181a7e
62 changed files with 34 additions and 33 deletions

View File

@ -151,7 +151,7 @@ Instead of having to create Django users manually when signup up Etebase users,
For example, this makes sense when putting an Etebase server in production.
However, this does come with the added risk that everybody with access to your server will be able to sign up.
In order to set it up, comment out the line `ETEBASE_CREATE_USER_FUNC = "django_etebase.utils.create_user_blocked"` in `server/settings.py` and restart your Etebase server.
In order to set it up, comment out the line `ETEBASE_CREATE_USER_FUNC = "etebase_server.django.utils.create_user_blocked"` in `server/settings.py` and restart your Etebase server.
# License

View File

@ -2,4 +2,5 @@ from django.apps import AppConfig
class DjangoEtebaseConfig(AppConfig):
name = "django_etebase"
name = "etebase_server.django"
label = "django_etebase"

View File

@ -4,7 +4,7 @@ from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_etebase.models
from etebase_server.django.models import chunk_directory_path
class Migration(migrations.Migration):
@ -85,7 +85,7 @@ class Migration(migrations.Migration):
),
(
"chunkFile",
models.FileField(max_length=150, unique=True, upload_to=django_etebase.models.chunk_directory_path),
models.FileField(max_length=150, unique=True, upload_to=chunk_directory_path),
),
(
"item",

View File

@ -3,7 +3,7 @@
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_etebase.models
from etebase_server.django.models import generate_stoken_uid
class Migration(migrations.Migration):
@ -21,7 +21,7 @@ class Migration(migrations.Migration):
"uid",
models.CharField(
db_index=True,
default=django_etebase.models.generate_stoken_uid,
default=generate_stoken_uid,
max_length=43,
unique=True,
validators=[

View File

@ -2,7 +2,7 @@
import django.core.validators
from django.db import migrations, models
import django_etebase.models
from etebase_server.django.models import generate_stoken_uid
class Migration(migrations.Migration):
@ -62,7 +62,7 @@ class Migration(migrations.Migration):
name="uid",
field=models.CharField(
db_index=True,
default=django_etebase.models.generate_stoken_uid,
default=generate_stoken_uid,
max_length=43,
unique=True,
validators=[

View File

@ -2,7 +2,7 @@
from django.db import migrations
from django_etebase.models import AccessLevels
from etebase_server.django.models import AccessLevels
def change_access_level_to_int(apps, schema_editor):

View File

@ -2,4 +2,4 @@ from django.apps import AppConfig
class TokenAuthConfig(AppConfig):
name = "django_etebase.token_auth"
name = "etebase_server.django.token_auth"

View File

@ -3,7 +3,7 @@
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
from django_etebase.token_auth import models as token_auth_models
from etebase_server.django.token_auth import models as token_auth_models
class Migration(migrations.Migration):

View File

@ -6,8 +6,8 @@ from fastapi.security import APIKeyHeader
from django.utils import timezone
from django.db.models import QuerySet
from django_etebase import models
from django_etebase.token_auth.models import AuthToken, get_default_expiry
from etebase_server.django import models
from etebase_server.django.token_auth.models import AuthToken, get_default_expiry
from etebase_server.myauth.models import UserType, get_typed_user_model
from .exceptions import AuthenticationFailed
from .utils import get_object_or_404

View File

@ -6,7 +6,7 @@ from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.trustedhost import TrustedHostMiddleware
from fastapi.staticfiles import StaticFiles
from django_etebase import app_settings
from etebase_server.django import app_settings
from .exceptions import CustomHttpException
from .msgpack import MsgpackResponse

View File

@ -1,7 +1,7 @@
import typing as t
import aioredis
from django_etebase import app_settings
from etebase_server.django import app_settings
class RedisWrapper:

View File

@ -14,11 +14,11 @@ from django.db import transaction
from django.utils.functional import cached_property
from fastapi import APIRouter, Depends, status, Request
from django_etebase import app_settings, models
from django_etebase.token_auth.models import AuthToken
from django_etebase.models import UserInfo
from django_etebase.signals import user_signed_up
from django_etebase.utils import create_user, get_user_queryset, CallbackContext
from etebase_server.django import app_settings, models
from etebase_server.django.token_auth.models import AuthToken
from etebase_server.django.models import UserInfo
from etebase_server.django.signals import user_signed_up
from etebase_server.django.utils import create_user, get_user_queryset, CallbackContext
from etebase_server.myauth.models import UserType, get_typed_user_model
from ..exceptions import AuthenticationFailed, transform_validation_error, HttpError
from ..msgpack import MsgpackRoute

View File

@ -7,7 +7,7 @@ from django.db import transaction, IntegrityError
from django.db.models import Q, QuerySet
from fastapi import APIRouter, Depends, status, Request, BackgroundTasks
from django_etebase import models
from etebase_server.django import models
from etebase_server.myauth.models import UserType
from .authentication import get_authenticated_user
from .websocket import get_ticket, TicketRequest, TicketOut

View File

@ -4,8 +4,8 @@ from django.db import transaction, IntegrityError
from django.db.models import QuerySet
from fastapi import APIRouter, Depends, status, Request
from django_etebase import models
from django_etebase.utils import get_user_queryset, CallbackContext
from etebase_server.django import models
from etebase_server.django.utils import get_user_queryset, CallbackContext
from etebase_server.myauth.models import UserType, get_typed_user_model
from .authentication import get_authenticated_user
from ..exceptions import HttpError, PermissionDenied

View File

@ -4,7 +4,7 @@ from django.db import transaction
from django.db.models import QuerySet
from fastapi import APIRouter, Depends, status
from django_etebase import models
from etebase_server.django import models
from etebase_server.myauth.models import UserType, get_typed_user_model
from .authentication import get_authenticated_user
from ..msgpack import MsgpackRoute

View File

@ -3,7 +3,7 @@ from django.db import transaction
from django.shortcuts import get_object_or_404
from fastapi import APIRouter, Request, status
from django_etebase.utils import get_user_queryset, CallbackContext
from etebase_server.django.utils import get_user_queryset, CallbackContext
from .authentication import SignupIn, signup_save
from ..msgpack import MsgpackRoute
from ..exceptions import HttpError

View File

@ -8,8 +8,8 @@ from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect, status
import nacl.encoding
import nacl.utils
from django_etebase import models
from django_etebase.utils import CallbackContext, get_user_queryset
from etebase_server.django import models
from etebase_server.django.utils import CallbackContext, get_user_queryset
from etebase_server.myauth.models import UserType, get_typed_user_model
from ..dependencies import get_collection_queryset, get_item_queryset

View File

@ -3,7 +3,7 @@ import typing as t
from django.db.models import QuerySet
from fastapi import status
from django_etebase.models import Stoken
from etebase_server.django.models import Stoken
from .exceptions import HttpError

View File

@ -10,8 +10,8 @@ from pydantic import BaseModel as PyBaseModel
from django.db.models import Model, QuerySet
from django.core.exceptions import ObjectDoesNotExist
from django_etebase import app_settings
from django_etebase.models import AccessLevels
from etebase_server.django import app_settings
from etebase_server.django.models import AccessLevels
from etebase_server.myauth.models import UserType, get_typed_user_model
from .exceptions import HttpError, HttpErrorOut

View File

@ -55,8 +55,8 @@ INSTALLED_APPS = [
"django.contrib.messages",
"django.contrib.staticfiles",
"etebase_server.myauth.apps.MyauthConfig",
"django_etebase.apps.DjangoEtebaseConfig",
"django_etebase.token_auth.apps.TokenAuthConfig",
"etebase_server.django.apps.DjangoEtebaseConfig",
"etebase_server.django.token_auth.apps.TokenAuthConfig",
]
MIDDLEWARE = [
@ -167,7 +167,7 @@ if any(os.path.isfile(x) for x in config_locations):
if "database-options" in config:
DATABASES["default"]["OPTIONS"] = config["database-options"]
ETEBASE_CREATE_USER_FUNC = "django_etebase.utils.create_user_blocked"
ETEBASE_CREATE_USER_FUNC = "etebase_server.django.utils.create_user_blocked"
# Efficient file streaming (for large files)
SENDFILE_BACKEND = "etebase_fastapi.sendfile.backends.simple"