Resolve miscellaneous TODOS

Fixes #2
This commit is contained in:
Mouse Reeve 2020-02-10 22:10:05 -08:00
parent 55f5735b33
commit 0f1240ca1f
3 changed files with 9 additions and 9 deletions

View file

@ -6,6 +6,7 @@ from Crypto.Hash import SHA256
from datetime import datetime from datetime import datetime
import json import json
import requests import requests
from urllib.parse import urlparse
from fedireads import models from fedireads import models
from fedireads import incoming from fedireads import incoming
@ -32,7 +33,8 @@ def get_or_create_remote_user(actor):
# the webfinger format for the username. # the webfinger format for the username.
# TODO: get the user's domain in a better way # TODO: get the user's domain in a better way
username = '%s@%s' % (actor.split('/')[-1], actor.split('/')[2]) actor_parts = urlparse(actor)
username = '%s@%s' % (actor_parts.path.split('/')[-1], actor_parts.netloc)
shared_inbox = data.get('endpoints').get('sharedInbox') if \ shared_inbox = data.get('endpoints').get('sharedInbox') if \
data.get('endpoints') else None data.get('endpoints') else None

View file

@ -1,4 +1,4 @@
# Generated by Django 3.0.2 on 2020-02-01 00:22 # Generated by Django 3.0.2 on 2020-02-11 05:57
from django.conf import settings from django.conf import settings
import django.contrib.auth.models import django.contrib.auth.models
@ -7,6 +7,7 @@ import django.contrib.postgres.fields.jsonb
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
import django.utils.timezone import django.utils.timezone
import fedireads.models
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -189,7 +190,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='fedireads.Activity')), ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='fedireads.Activity')),
('name', models.CharField(max_length=255)), ('name', models.CharField(max_length=255)),
('rating', models.IntegerField(default=0)), ('rating', models.IntegerField(default=0, validators=[fedireads.models.validate_rating])),
('review_content', models.TextField()), ('review_content', models.TextField()),
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')), ('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
], ],

View file

@ -4,7 +4,6 @@ import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
@ -14,8 +13,8 @@ SECRET_KEY = '7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
# TODO: this hsould be populated at runtime at least for debug mode # TODO: this should be populated at runtime at least for debug mode
DOMAIN = 'a4522b16.ngrok.io' DOMAIN = 'af064ab4.ngrok.io'
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
OL_URL = 'https://openlibrary.org' OL_URL = 'https://openlibrary.org'
@ -44,7 +43,6 @@ MIDDLEWARE = [
ROOT_URLCONF = 'fedireads.urls' ROOT_URLCONF = 'fedireads.urls'
# TODO: how tf do I switch to jinja2
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
@ -120,5 +118,4 @@ USE_TZ = True
STATIC_URL = '/static/' STATIC_URL = '/static/'
MEDIA_URL = '/images/' MEDIA_URL = '/images/'
# TODO: this super doesn't work when I do a join on BASE_DIR MEDIA_ROOT = os.path.join(BASE_DIR, 'images/')
MEDIA_ROOT = '/Users/mouse/Personal/fedireads/images/'