Skip to content

Commit

Permalink
Merge branch 'main' into enhancement/issue-1627-1
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnieBLT authored Mar 8, 2024
2 parents 30b93ba + a52d525 commit cdfd85c
Show file tree
Hide file tree
Showing 30 changed files with 672 additions and 10,263 deletions.
88 changes: 45 additions & 43 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI/CD
name: CI/CD Optimized

on:
merge_group:
Expand All @@ -14,28 +14,53 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
pre-commit:
name: Run pre-commit
setup:
name: Setup and Cache Dependencies
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
actions: write

contents: read # Minimal permission for checking out code
outputs:
python-cache-dir: ${{ steps.poetry-cache.outputs.dir }}
steps:
- uses: actions/checkout@v4

- name: Cache pre-commit hooks
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit # Adjust the path based on where pre-commit stores its hooks.
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Check out Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5
with:
python-version: 3.11.2

- name: Get Poetry cache directory
id: poetry-cache
run: echo "::set-output name=dir::$(poetry config cache-dir)"

- name: Cache Poetry dependencies
uses: actions/cache@v3
with:
path: ${{ steps.poetry-cache.outputs.dir }}
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
pre-commit:
name: Run pre-commit
needs: setup
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
actions: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.2
- name: Run pre-commit
Expand All @@ -49,25 +74,19 @@ jobs:
security-events: write
actions: read
contents: read

strategy:
fail-fast: true
matrix:
language:
- 'javascript'
- 'python'

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
- uses: actions/checkout@v2
- uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- uses: github/codeql-action/autobuild@v2
- uses: github/codeql-action/analyze@v2

test:
name: Run Tests
Expand All @@ -78,30 +97,13 @@ jobs:
pull-requests: write
contents: write
actions: write

steps:
- name: Get Poetry cache
id: poetry-cache
run: echo "::set-output name=dir::$(poetry config cache-dir)"

- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ${{ steps.poetry-cache.outputs.dir }}
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- uses: nanasess/setup-chromedriver@v2
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11.2
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install
- name: Collect static files
run: poetry run python manage.py collectstatic --noinput
- run: pip install poetry
- run: poetry install
- run: poetry run python manage.py collectstatic --noinput
- name: Run tests
run: poetry run xvfb-run --auto-servernum python manage.py test -v 3 --failfast
1 change: 1 addition & 0 deletions blt/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
send_default_pii=True,
traces_sample_rate=1.0,
profiles_sample_rate=1.0,
release=os.environ.get("HEROKU_RELEASE_VERSION", default=""),
)

else:
Expand Down
10 changes: 10 additions & 0 deletions blt/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@
re_path(r"^terms/$", TemplateView.as_view(template_name="terms.html"), name="terms"),
re_path(r"^about/$", TemplateView.as_view(template_name="about.html"), name="about"),
re_path(r"^teams/$", TemplateView.as_view(template_name="teams.html"), name="teams"),
re_path(
r"^googleplayapp/$",
TemplateView.as_view(template_name="coming_soon.html"),
name="googleplayapp",
),
re_path(
r"^projects/$",
TemplateView.as_view(template_name="projects.html"),
Expand Down Expand Up @@ -483,6 +488,11 @@
name="update_bch_address",
),
re_path(r"^contributor-stats/$", ContributorStatsView.as_view(), name="contributor-stats"),
re_path(
r"^contributor-stats/today$",
ContributorStatsView.as_view(today=True),
name="today-contributor-stats",
),
]

if settings.DEBUG:
Expand Down
2 changes: 1 addition & 1 deletion contributors.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
"img":"https://avatars.githubusercontent.com/u/97744811?v=4",
"name":"Altafur Rahman",
"repository":"BLT | BLT-Flutter",
"short_description":"always want do something for the world☺",
"short_description":"always want to do something for the world☺",
"long_description":"Hi there, I'm Altafur Rahman Jisan! With a knack for Python and a dash of JavaScript, I turn code into comfort, crafting web experiences that feel like home. 🏡✨",
"location":"Chittagong, Bangladesh",
"twitter":"https://twitter.com/JisanAR03",
Expand Down
26 changes: 25 additions & 1 deletion website/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,33 @@ class UserAdmin(ImportExportModelAdmin):
)


class UserProfileAdmin(admin.ModelAdmin):
list_display = (
"id",
"user",
"user_avatar",
"get_title_display",
"description",
"winnings",
"issues_hidden",
"btc_address",
"bch_address",
"eth_address",
)
# add these and make them sortable
# follows = models.ManyToManyField("self", related_name="follower", symmetrical=False, blank=True)
# winnings = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True)
# issue_upvoted = models.ManyToManyField(Issue, blank=True, related_name="upvoted")
# issue_downvoted = models.ManyToManyField(Issue, blank=True, related_name="downvoted")
# issue_saved = models.ManyToManyField(Issue, blank=True, related_name="saved")
# issue_flaged = models.ManyToManyField(Issue, blank=True, related_name="flaged")
# subscribed_domains = models.ManyToManyField(Domain, related_name="user_subscribed_domains")
# subscribed_users = models.ManyToManyField(User, related_name="user_subscribed_users")


admin.site.register(ContributorStats)

admin.site.register(UserProfile)
admin.site.register(UserProfile, UserProfileAdmin)
admin.site.register(User, UserAdmin)

admin.site.register(Domain, DomainAdminPanel)
Expand Down
17 changes: 17 additions & 0 deletions website/migrations/0084_issue_cve_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.2 on 2024-03-06 20:42

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("website", "0083_alter_invitefriend_options_and_more"),
]

operations = [
migrations.AddField(
model_name="issue",
name="cve_id",
field=models.CharField(blank=True, max_length=16, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.0.2 on 2024-03-05 08:10

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("website", "0083_alter_invitefriend_options_and_more"),
]

operations = [
migrations.RenameField(
model_name="userprofile",
old_name="crypto_address",
new_name="bch_address",
),
migrations.AddField(
model_name="userprofile",
name="btc_address",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name="userprofile",
name="eth_address",
field=models.CharField(blank=True, max_length=100, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generated by Django 5.0.2 on 2024-03-07 05:58

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("website", "0084_contributorstats"),
("website", "0084_issue_cve_id"),
]

operations = []
12 changes: 12 additions & 0 deletions website/migrations/0085_merge_20240307_1217.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generated by Django 5.0.2 on 2024-03-07 06:47

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("website", "0084_contributorstats"),
("website", "0084_rename_crypto_address_userprofile_bch_address_and_more"),
]

operations = []
12 changes: 12 additions & 0 deletions website/migrations/0086_merge_20240308_1030.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generated by Django 5.0.2 on 2024-03-08 05:00

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("website", "0085_merge_0084_contributorstats_0084_issue_cve_id"),
("website", "0085_merge_20240307_1217"),
]

operations = []
5 changes: 4 additions & 1 deletion website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class Issue(models.Model):
is_hidden = models.BooleanField(default=False)
rewarded = models.PositiveIntegerField(default=0) # money rewarded by the company
reporter_ip_address = models.GenericIPAddressField(null=True, blank=True)
cve_id = models.CharField(max_length=16, null=True, blank=True)

def __unicode__(self):
return self.description
Expand Down Expand Up @@ -425,7 +426,9 @@ class UserProfile(models.Model):

subscribed_domains = models.ManyToManyField(Domain, related_name="user_subscribed_domains")
subscribed_users = models.ManyToManyField(User, related_name="user_subscribed_users")
crypto_address = models.CharField(max_length=100, null=True, blank=True)
btc_address = models.CharField(max_length=100, blank=True, null=True)
bch_address = models.CharField(max_length=100, blank=True, null=True)
eth_address = models.CharField(max_length=100, blank=True, null=True)

def avatar(self, size=36):
if self.user_avatar:
Expand Down
6 changes: 0 additions & 6 deletions website/static/vendor/jquery/jquery-1.10.2.min.js

This file was deleted.

4 changes: 0 additions & 4 deletions website/static/vendor/jquery/jquery-2.1.1.min.js

This file was deleted.

Loading

0 comments on commit cdfd85c

Please sign in to comment.