Skip to content

Commit

Permalink
Merge branch 'main' into ip_blocker
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarthak5598 authored Aug 13, 2024
2 parents 6c96a97 + 923ecdb commit 5528254
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 28 deletions.
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ pydantic = "^2.7.3"
pydantic_core = "^2.18.4"
langchain = "^0.2.12"
langchain-community = "^0.2.11"
langchain-core = "^0.2.29"
langchain-core = "^0.2.30"
langchain-openai = "^0.1.21"
unstructured = "^0.15.1"
Markdown = "^3.6"
faiss-cpu = "^1.8.0"
openai = "^1.40.3"
openai = "^1.40.6"
psutil = "^5.9.8"
python-bitcoinrpc = "^1.0"
sendgrid = "^6.11.0"
Expand Down
48 changes: 44 additions & 4 deletions website/static/js/validate-btc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function validateBCH(address) {
* Params: BCH Address
* ***/
if (address == null || address == "" || address == " ") {
return false;
return "empty";
}
if (address.startsWith("bitcoincash:")) {
address = address.slice(12);
Expand All @@ -50,7 +50,7 @@ function validateEthereum(address) {
let regex = new RegExp(/^(0x)?[0-9a-fA-F]{40}$/);

if (address == null || address == "" || address == " ") {
return false;
return "empty";
} else if (regex.test(address) == true) {
return true;
} else {
Expand All @@ -65,13 +65,53 @@ function validateBitCoin(address) {
* ***/
let regex = new RegExp(/^(bc1|[13])[a-km-zA-HJ-NP-Z1-9]{25,34}$/);
if (address == null || address == "" || address == " ") {
return false;
return "empty";
} else if (regex.test(address) == true) {
return true;
} else {
return false;
}
}

// async function CryptoEditForm(crypto, selected_c) {
// if(selected_c == "BTC"){
// selected_c = "Bitcoin"
// var isValidAddress = validateBitCoin(crypto);
// }else if(selected_c == "BCH"){
// selected_c = "BitcoinCash"
// var isValidAddress = validateBCH(crypto);
// }else if(selected_c == "ETH"){
// selected_c = "Ethereum"
// var isValidAddress = validateEthereum(crypto);
// }else{
// $.notify("Please select a Crypto Address", {
// style: "custom",
// className: "danger"
// });
// return;
// }
// if(isValidAddress == true){
// const data = {
// selected_crypto: selected_c,
// new_address: crypto
// };
// const request = await fetch("/update_bch_address/", {
// method: 'POST',
// headers: {
// "Content-Type": "application/json"
// },
// body: JSON.stringify(data),
// });
// if(request.status == 200){
// window.location.reload();
// }
// }else{
// $.notify("Please enter a valid Crypto Address", {
// style: "custom",
// className: "danger"
// });
// }
// }
// TEST THE VALIDATORS
// BitCoin VALIDATOR
// Uncomment the below code
Expand Down Expand Up @@ -140,4 +180,4 @@ function validateBitCoin(address) {

// for(var i=0; i<ethAddresses.length; i++){
// console.log(`${ethAddresses[i]} - ${validateEthereum(ethAddresses[i])}`)
// }
// }
22 changes: 11 additions & 11 deletions website/templates/includes/crypto_donation.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
width="32px"
height="32px">
<div class="ml-3" id="crypto">
{% if object.user.userprofile.btc_address %}
{% include "./tiny-cards.html" with insideIFCondition=True left="BTC" right=object.user.userprofile.btc_address lessWidth=True %}
{% if user.userprofile.btc_address %}
{% include "./tiny-cards.html" with insideIFCondition=True left="BTC" right=user.userprofile.btc_address|slice:":40" lessWidth=True editCrypto=True %}
{% endif %}
{% if object.user.userprofile.bch_address %}
{% include "./tiny-cards.html" with insideIFCondition=True left="BCH" right=object.user.userprofile.bch_address lessWidth=True %}
{% if user.userprofile.bch_address %}
{% include "./tiny-cards.html" with insideIFCondition=True left="BCH" right=user.userprofile.bch_address|slice:":40" lessWidth=True editCrypto=True %}
{% endif %}
{% if object.user.userprofile.eth_address %}
{% include "./tiny-cards.html" with insideIFCondition=True left="ETH" right=object.user.userprofile.eth_address lessWidth=True %}
{% if user.userprofile.eth_address %}
{% include "./tiny-cards.html" with insideIFCondition=True left="ETH" right=user.userprofile.eth_address|slice:":40" lessWidth=True editCrypto=True %}
{% endif %}
</div>
<div class="hidden" id="no-crypto">
{% include "./tiny-cards.html" with left="BCH" right="qr5yccf7j4dpjekyz3vpawgaarl352n7yv5d5mtzzc" lessWidth=True %}
<div class="hidden max-sm:w-[100%] max-sm:overflow-hidden" id="no-crypto">
{% include "./tiny-cards.html" with left="BCH" right="qr5yccf7j4dpjekyz3vpawgaarl352n7yv5d5mtzzc" lessWidth=True editCrypto=True %}
<i class="ml-[3%] text-[12px]">No Address, will go to BLT Donation</i>
</div>
</div>
</div>
<script>
function loadQRCode(){
var btc_address = "{{object.user.userprofile.btc_address}}";
var bch_address = "{{object.user.userprofile.bch_address}}";
var eth_address = "{{object.user.userprofile.eth_address}}";
var btc_address = "{{user.userprofile.btc_address}}";
var bch_address = "{{user.userprofile.bch_address}}";
var eth_address = "{{user.userprofile.eth_address}}";

if(btc_address != "None" && btc_address != ""){
document.getElementById('crypto-qr-image').src = `https://api.qrserver.com/v1/create-qr-code/?data=${btc_address}&size=400x300`;
Expand Down
9 changes: 6 additions & 3 deletions website/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
</form>
{% endif %}
</div>
<div class="flex items-center justify-between w-[17vw] max-sm:w-[100vw]">
<div class="flex items-center justify-between w-[17vw] max-sm:w-[70vw]">
<span class="text-[25px] font-['Poppins']">{{ my_score|default:0 }} <span class="text-[19px] text-[#909090]">{% trans "POINTS" %}</span></span>
{% if request.user != user and request.user.is_authenticated %}
<span class="text-[25px]"></span>
Expand Down Expand Up @@ -365,14 +365,14 @@
</a>
<div class="mb-2 text-xl">
{{ activity.user|default:"Anonymous" }}
found a bug on <a href="{% url 'domain' slug=activity.domain_name %}">{{ activity.domain_title }}</a> {{ activity.created|timesince }}
found a bug on <a href="{% url 'domain' slug=activity.domain_name %}">{{ activity.domain_title }}</a> - {{ activity.created|timesince }}
ago
</div>
<a class="text-lg"
href="{{ activity.url }}"
target="_blank"
rel="noopener noreferrer">
<div>{{ activity.url }}</div>
<div>{{ activity.url|truncatechars:30 }}</div>
</a>
<a class="whitespace-nowrap mb-1 text-xl"
href="{{ activity.get_absolute_url }}#comments">
Expand Down Expand Up @@ -802,6 +802,7 @@ <h3>Bookmarks:</h3>
style: "custom",
className: "success"
});
window.location.reload();
}
else{
$.notify("Permission Denied", {
Expand Down Expand Up @@ -880,5 +881,7 @@ <h3>Bookmarks:</h3>
}
});
});

</script>
<script src="{% static 'js/validate-btc.js' %}"></script>
{% endblock content %}
1 change: 0 additions & 1 deletion website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4231,7 +4231,6 @@ def get_context_data(self, **kwargs):
context["bookmarked"] = self.request.user.userprofile.issue_saved.filter(
pk=self.object.id
).exists()

context["screenshots"] = IssueScreenshot.objects.filter(issue=self.object).all()
context["status"] = Issue.objects.filter(id=self.object.id).get().status
context["github_issues_url"] = (
Expand Down

0 comments on commit 5528254

Please sign in to comment.