Skip to content

Commit

Permalink
open source
Browse files Browse the repository at this point in the history
  • Loading branch information
daisycamber committed Jan 26, 2025
1 parent 7f38a9c commit 4f10542
Show file tree
Hide file tree
Showing 20 changed files with 507 additions and 195 deletions.
652 changes: 477 additions & 175 deletions backup.log

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backup_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Sun Jan 26 12:08:30 AM PST 2025
Sun Jan 26 12:36:55 PM PST 2025
2 changes: 1 addition & 1 deletion backup_init_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Sun Jan 26 12:00:01 AM PST 2025
Sun Jan 26 12:00:01 PM PST 2025
2 changes: 1 addition & 1 deletion config/crontab
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
0 0 1 * * sudo certbot renew --quiet
#*/5 * * * * /home/team/lotteh/venv/bin/python /home/team/lotteh/routine_caption.py
#0 */3 * * * /home/team/lotteh/venv/bin/python /home/team/lotteh/upload_post.py
#* * * * * /home/team/lotteh/venv/bin/python /home/team/lotteh/crypto_trading.py
* * * * * /home/team/lotteh/venv/bin/python /home/team/lotteh/crypto_trading.py
#*/30 * * * * /home/team/lotteh/venv/bin/python /home/team/lotteh/process_recordings.py
0 */12 * * * sh -c "sudo backup > /home/team/lotteh/backup.log" team
#*/10 * * * * sudo systemctl start apache2
Expand Down
Binary file modified crypto/__pycache__/binance.cpython-312.pyc
Binary file not shown.
Binary file modified crypto/__pycache__/forms.cpython-312.pyc
Binary file not shown.
Binary file modified crypto/__pycache__/signals.cpython-312.pyc
Binary file not shown.
8 changes: 4 additions & 4 deletions crypto/signals.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import talib
import numpy as np

alt = False
alt = True
digits = 0

def fix(digit):
return round(digit * 1.0/24 * 6, 2)
return round(digit/2.0, 2)

FAST_PERIOD = 12 if not alt else fix(12)
SLOW_PERIOD = 26 if not alt else fix(26)
SIGNAL_PERIOD = 9 if not alt else fix(9)
RSI_PERIOD = 3 if not alt else fix(9)
SIGNAL_PERIOD = 7 if not alt else fix(7)
RSI_PERIOD = 7 if not alt else fix(7)
RSI_OVERBOUGHT = 45
RSI_OVERSOLD = 55

Expand Down
Binary file modified feed/__pycache__/email.cpython-312.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion feed/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def send_photo_email(user, post):
from django.conf import settings
from django.template.loader import render_to_string
from feed.models import Post
import datetime
photo_url = post.get_image_url()
html_message = render_to_string('feed/photo_email.html', {
'site_name': settings.SITE_NAME,
Expand All @@ -29,6 +30,7 @@ def send_photos_email(user, posts):
from django.conf import settings
from django.template.loader import render_to_string
from feed.models import Post
import datetime
photo_urls = []
files = []
from barcode.tests import document_scanned
Expand All @@ -47,7 +49,7 @@ def send_photos_email(user, posts):
post = photo
if post.date_auction > timezone.now() - datetime.timedelta(days=31*3):
messages = messages + [post.auction_message]
if not messages: messages[0] = 'Thank you again for your purchase.'
if not messages: messages += ['Thank you again for your purchase.']
html_message = render_to_string('feed/photo_email.html', {
'site_name': settings.SITE_NAME,
'user': user,
Expand Down
Binary file modified payments/__pycache__/cart.cpython-312.pyc
Binary file not shown.
Binary file modified payments/__pycache__/square.cpython-312.pyc
Binary file not shown.
Binary file modified payments/__pycache__/verify.cpython-312.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions payments/cart.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ def process_cart_purchase(user, cart, private=False):
posts = []
for item in cart.replace('+', ',').split(','):
s = item.split('=')
if len(s) < 2: continue
uid = s[0]
quant = s[1]
post = Post.objects.filter(uuid=uid, date_auction__lte=timezone.now()).first()
if not post.private:
if post and not post.private:
if not post.paid_file:
post.recipient = user
post.save()
else:
post.paid_users.add(user)
post.save()
posts = posts + [post]
elif post.private and document_scanned(user) and private:
elif post and post.private and document_scanned(user) and private:
if not post.paid_file:
post.recipient = user
post.save()
Expand Down
2 changes: 1 addition & 1 deletion payments/square.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ def verify_payment(id):
res = False
j = requests.get('https://connect.squareup.com/v2/orders/{}'.format(id), headers=headers).json()
print(json.dumps(j))
if j['order']['state'] == 'COMPLETED':
if 'order' in j.keys() and j['order']['state'] == 'OPEN':
res = True
return res
15 changes: 10 additions & 5 deletions payments/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def verify_payments():
import requests, json, datetime
from .models import Invoice
from django.utils import timezone
invoices = Invoice.objects.filter(timestamp__gte=timezone.now() - datetime.timedelta(hours=24), completed=False).order_by('-timestamp')
invoices = Invoice.objects.filter(timestamp__gte=timezone.now() - datetime.timedelta(hours=1), completed=False).order_by('-timestamp')
for invoice in invoices:
res = False
if invoice.processor == 'paypal':
Expand All @@ -12,19 +12,24 @@ def verify_payments():
from payments.square import verify_payment
if verify_payment(invoice.number):
res = True
print('Payment verified')
if res:
print('Updating payment')
user = invoice.user
from django.contrib.auth.models import User
from django.conf import settings
from feed.models import Post
from payments.cart import get_card_cost
from payments.cart import get_cart_cost
from django.http import HttpResponse
product = invoice.product
price = invoice.price
if product == 'cart' and (get_cart_cost(invoice.cart) if invoice.cart else 0) != int(price): return
if product == 'post' and Post.objects.filter(uuid=invoice.pid).first().price != str(price): return
if product == 'membership' and invoice.vendor.vendor_profile.subscription_fee != price: return
# if product == 'cart' and (get_cart_cost(invoice.cart) if invoice.cart else 0) != int(price): return
# if product == 'post' and Post.objects.filter(uuid=invoice.pid).first().price != str(price): return
# if product == 'membership' and invoice.vendor.vendor_profile.subscription_fee != price: return
vendor = invoice.vendor
from payments.cart import process_cart_purchase
if invoice.product == 'cart':
process_cart_purchase(user, invoice.cart)
if invoice.product == 'post':
from feed.models import Post
post = Post.objects.get(author=vendor, id=invoice.pid)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ sqlparse
streamlit
stripe
sympy
ta-lib
tb-nightly
tenacity
tensorboard
Expand Down
1 change: 1 addition & 0 deletions scripts/resetvenv
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pip3 install -r reqs.txt --use-deprecated=legacy-resolver --use-pep517
pip3 install --upgrade requests
pip3 install googletrans==3.1.0a0
pip3 install --upgrade "nudenet>=3.4.2"
pip3 install ta-lib==0.5.0
cd $DIR
./scripts/patchvenv
for f in $(ls venv/*/*); do
Expand Down
Binary file modified users/__pycache__/forms.cpython-312.pyc
Binary file not shown.
8 changes: 4 additions & 4 deletions users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ class Meta:
'bash': 'Email username'
}
widgets = {
'status': forms.Textarea(attrs={'rows':3}),
'bio': forms.Textarea(attrs={'rows':5}),
'wishlist': forms.Textarea(attrs={'rows':1}),
'shop_url': forms.Textarea(attrs={'rows':1}),
'status': forms.Textarea(attrs={'rows':3}),
'bio': forms.Textarea(attrs={'rows':5}),
'wishlist': forms.TextInput,
'shop_url': forms.TextInput,
}

class ResendActivationEmailForm(forms.Form):
Expand Down

0 comments on commit 4f10542

Please sign in to comment.