-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #447 from codeshard/codeshard/poetry
feat: added improvements
- Loading branch information
Showing
84 changed files
with
2,525 additions
and
670 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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
venv/ | ||
.env* | ||
db.sqlite3 | ||
.github | ||
.github/ | ||
.git/ | ||
.idea/ | ||
.venv/ |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without 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
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,8 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ProxylistConfig(AppConfig): | ||
name = "apps.proxylist" | ||
|
||
def ready(self) -> None: | ||
import apps.proxylist.signals # noqa |
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions
3
proxylist/management/commands/clear_stats.py → ...xylist/management/commands/clear_stats.py
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
File renamed without changes.
3 changes: 1 addition & 2 deletions
3
...management/commands/poll_subscriptions.py → ...management/commands/poll_subscriptions.py
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
3 changes: 1 addition & 2 deletions
3
...t/management/commands/reduce_checks_by.py → ...t/management/commands/reduce_checks_by.py
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
5 changes: 2 additions & 3 deletions
5
...management/commands/remove_low_quality.py → ...management/commands/remove_low_quality.py
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
3 changes: 1 addition & 2 deletions
3
...list/management/commands/update_status.py → ...list/management/commands/update_status.py
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
5 changes: 2 additions & 3 deletions
5
proxylist/metrics.py → app/shadowmere/apps/proxylist/metrics.py
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
File renamed without 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 |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("proxylist", "0001_initial"), | ||
] | ||
|
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
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("proxylist", "0003_alter_proxy_url"), | ||
] | ||
|
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
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
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
30 changes: 30 additions & 0 deletions
30
app/shadowmere/apps/proxylist/migrations/0008_proxy_location_country_alter_proxy_url.py
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,30 @@ | ||
# Generated by Django 4.0.4 on 2022-06-06 12:09 | ||
|
||
from django.db import migrations, models | ||
from utils import validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("proxylist", "0007_proxy_ip_address_proxy_location_country_code"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="proxy", | ||
name="location_country", | ||
field=models.CharField(default="", max_length=50), | ||
), | ||
migrations.AlterField( | ||
model_name="proxy", | ||
name="url", | ||
field=models.CharField( | ||
max_length=1024, | ||
unique=True, | ||
validators=[ | ||
validators.validate_sip002, | ||
validators.validate_proxy_can_connect, | ||
], | ||
), | ||
), | ||
] |
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
26 changes: 26 additions & 0 deletions
26
app/shadowmere/apps/proxylist/migrations/0010_subscription_alter_proxy_url.py
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,26 @@ | ||
# Generated by Django 4.1.7 on 2023-03-04 14:37 | ||
|
||
from django.db import migrations, models | ||
from utils import validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("proxylist", "0009_proxy_port"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Subscription", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("url", models.URLField(unique=True)), | ||
("kind", models.CharField(choices=[("1", "plain"), ("2", "base64")], default="1", max_length=10)), | ||
], | ||
), | ||
migrations.AlterField( | ||
model_name="proxy", | ||
name="url", | ||
field=models.CharField(max_length=1024, unique=True, validators=[validators.proxy_validator]), | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
app/shadowmere/apps/proxylist/migrations/0011_alter_subscription_kind.py
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,17 @@ | ||
# Generated by Django 4.1.7 on 2023-03-04 14:44 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("proxylist", "0010_subscription_alter_proxy_url"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="subscription", | ||
name="kind", | ||
field=models.CharField(choices=[("PLAIN", "plain"), ("BASE64", "base64")], default="PLAIN", max_length=10), | ||
), | ||
] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 43 additions & 0 deletions
43
...e/apps/proxylist/migrations/0018_alter_proxy_ip_address_alter_proxy_is_active_and_more.py
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,43 @@ | ||
# Generated by Django 5.0.6 on 2024-06-08 18:23 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('proxylist', '0017_tasklog_details'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='proxy', | ||
name='ip_address', | ||
field=models.CharField(blank=True, db_index=True, max_length=100, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='proxy', | ||
name='is_active', | ||
field=models.BooleanField(db_index=True, default=False), | ||
), | ||
migrations.AlterField( | ||
model_name='proxy', | ||
name='location', | ||
field=models.CharField(blank=True, max_length=100, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='proxy', | ||
name='location_country', | ||
field=models.CharField(blank=True, db_index=True, max_length=50, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='proxy', | ||
name='location_country_code', | ||
field=models.CharField(blank=True, db_index=True, max_length=3, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='proxy', | ||
name='port', | ||
field=models.IntegerField(db_index=True, default=0), | ||
), | ||
] |
File renamed without 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,53 @@ | ||
from django.db import models | ||
from django.utils.timezone import now | ||
from django_prometheus.models import ExportModelOperationsMixin | ||
from utils.validators import proxy_validator | ||
|
||
|
||
class Proxy(ExportModelOperationsMixin("proxy"), models.Model): | ||
url = models.CharField( | ||
max_length=1024, | ||
unique=True, | ||
validators=[ | ||
proxy_validator, | ||
], | ||
) | ||
location = models.CharField(max_length=100, blank=True, null=True) | ||
location_country_code = models.CharField(max_length=3, blank=True, null=True, db_index=True) | ||
location_country = models.CharField(max_length=50, blank=True, null=True, db_index=True) | ||
ip_address = models.CharField(max_length=100, blank=True, null=True, db_index=True) | ||
port = models.IntegerField(default=0, db_index=True) | ||
is_active = models.BooleanField(default=False, db_index=True) | ||
last_checked = models.DateTimeField(auto_now=True) | ||
last_active = models.DateTimeField(blank=True, default=now) | ||
times_checked = models.IntegerField(default=0) | ||
times_check_succeeded = models.IntegerField(default=0) | ||
|
||
def __str__(self): | ||
return f"{self.location} ({self.url})" | ||
|
||
|
||
class Subscription(models.Model): | ||
class SubscriptionKind(models.TextChoices): | ||
PLAIN = "PLAIN", "plain" | ||
BASE64 = "BASE64", "base64" | ||
|
||
url = models.URLField(null=False, unique=True) | ||
kind = models.CharField(choices=SubscriptionKind.choices, default=SubscriptionKind.PLAIN, max_length=10) | ||
alive = models.BooleanField(default=True) | ||
alive_timestamp = models.DateTimeField(default=now) | ||
enabled = models.BooleanField(default=True) | ||
error_message = models.CharField(max_length=10000, default="") | ||
|
||
def __str__(self): | ||
return f"{self.url} - {self.kind}" | ||
|
||
|
||
class TaskLog(models.Model): | ||
name = models.CharField(max_length=100) | ||
details = models.CharField(max_length=1000, default="") | ||
start_time = models.DateTimeField(auto_now=False) | ||
finish_time = models.DateTimeField(auto_now=False) | ||
|
||
def __str__(self): | ||
return f"{self.name} - {self.finish_time}" |
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,14 @@ | ||
from rest_framework import pagination | ||
from rest_framework.response import Response | ||
|
||
|
||
class ProxiesPagination(pagination.PageNumberPagination): | ||
def get_paginated_response(self, data): | ||
return Response( | ||
{ | ||
"count": self.page.paginator.count, | ||
"total_pages": self.page.paginator.num_pages, | ||
"current_page": self.page.number, | ||
"results": data, | ||
} | ||
) |
2 changes: 1 addition & 1 deletion
2
proxylist/permissions.py → app/shadowmere/apps/proxylist/permissions.py
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
Oops, something went wrong.