To be able to more easily deal with same-origin issues, due to some course assets being loaded in an iframe, we're adding the ability to specify file extensions that should be excluded from URL canonicalization. The default value is simply 'html', which means we won't rewrite asset links that point to files ending in .html. Thus, they'll be loaded from the same origin as the parent page, and voila, no SOP issues.
28 lines
1.2 KiB
Python
28 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
('static_replace', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='AssetExcludedExtensionsConfig',
|
|
fields=[
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')),
|
|
('enabled', models.BooleanField(default=False, verbose_name='Enabled')),
|
|
('excluded_extensions', models.TextField(default=b'html', help_text=b'The file extensions to exclude from canonicalization. No leading period required. Values should be space separated i.e. "html svg css"')),
|
|
('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')),
|
|
],
|
|
),
|
|
]
|