1
0
mirror of https://github.com/creyD/asiimov.git synced 2026-06-12 00:52:23 +02:00

Removed API KEY Feature

While this would easily avoid the api key limit, Valve wouldn't like this, as it isn't the purpose of the keys.
This commit is contained in:
2020-01-22 13:37:23 +01:00
parent 8d925c8f6a
commit 3df650e314
6 changed files with 62 additions and 39 deletions

View File

@@ -4,13 +4,13 @@ A free, intuitive, open source CS:GO item trading platform.
## Goals
- You can authenticate with your steam account
- (done) You can authenticate with your steam account
- You can create 'offers' using your items as a base
- A border colour indicates if the item is still in your inventory
- You can manually renew an offer page to check if the item is still in the inventory (if we know the api key)
- You can manually renew an offer page to check if the item is still in the inventory
- You can send trade offers (preferably with the items preselected or even completely automated)
- You have a profile with some badges to get your profile semi verified (email, steam api key, trade link)
- Everything is available for free (given you login with steam and provide the api key)
- You have a profile with some badges to get your profile semi verified (email, trade link...)
- Everything is available for free
- Items should be displayed with: Item ID, Inspect Link, Pattern Index (...) NO PRICES! We don't want to anger Valve!
- Simple user design, minimalistic, less pages more features
- (optional) You can mark your inventory items as "for trade" or "holding on to this"

View File

@@ -0,0 +1,17 @@
# Generated by Django 3.0.2 on 2020-01-22 12:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20200119_1240'),
]
operations = [
migrations.RemoveField(
model_name='gamer',
name='API_KEY',
),
]

View File

@@ -95,7 +95,6 @@ class Gamer(models.Model):
# Asiimov specific information
inventory = models.ManyToManyField(ItemInstance) # Temporary storage of items for improving site performance
API_KEY = models.CharField(max_length=32, null=True) # Optionally use the API KEY of the user
badges = models.ManyToManyField(Badge)
system_user = models.OneToOneField(User, on_delete=models.CASCADE)
offer_count = models.IntegerField(default=0)

View File

@@ -1,38 +1,45 @@
{% extends 'master.html' %}
{% load static %}
{% block header %}
{% extends 'master.html' %} {% load static %} {% block header %}
<!-- Adding custom style sheet for profile-->
<link rel="stylesheet" href="{% static 'css/profile.css' %}">
{% endblock %}
{% block content %}
<link rel="stylesheet" href="{% static 'css/profile.css' %}" />
{% endblock %} {% block content %}
<div class="content_block">
<p><img src="{{ gamer.avatar }}" /></p>
<h2>{{ gamer.personaname }} {% if request.user.gamer == gamer %}(Your Profile){% endif %}</h2>
<h2>
{{ gamer.personaname }} {% if request.user.gamer == gamer %}(Your Profile){%
endif %}
</h2>
<h3>Links</h3>
<ul>
<a href="{{ gamer.profileurl }}" target="_blank"><li>Steam</li></a>
<a href="{% url 'profile_inventory' gamer.steamid%}"><li>Inventory</li></a>
<a href="http://csgo.exchange/id/{{ gamer.steamid }}"><li>csgo.exchange</li></a>
{% if gamer.tradeurl %}<a href="{{ gamer.tradeurl }}" target="_blank"><li>Trade</li></a>{% endif %}
<a href="http://csgo.exchange/id/{{ gamer.steamid }}"
><li>csgo.exchange</li></a
>
{% if gamer.tradeurl %}<a href="{{ gamer.tradeurl }}" target="_blank"
><li>Trade</li></a
>{% endif %}
</ul>
<h3>Info</h3>
<p>Steam ID: {{ gamer.steamid }}</p>
<p>Profile: {% if gamer.profilestate %}Public Profile{% else %}Private Profile{% endif %}</p>
<p>Comments: {% if gamer.commentpermission %}Allowed{% else %}Denied{% endif %}</p>
<p>Locale: {% if gamer.loccountrycode %}{{ gamer.loccountrycode }}{% else %}Not provided{% endif %}</p>
{% if gamer.API_KEY %}<p style="color: red">This is an API Key Sponsor!</p>{% endif %}
<p>
Profile: {% if gamer.profilestate %}Public Profile{% else %}Private
Profile{% endif %}
</p>
<p>
Comments: {% if gamer.commentpermission %}Allowed{% else %}Denied{% endif %}
</p>
<p>
Locale: {% if gamer.loccountrycode %}{{ gamer.loccountrycode }}{% else %}Not
provided{% endif %}
</p>
<h3>Badges</h3>
<p>
{% for badge in gamer.badges.all %}
<img src="{{ badge.icon }}" placeholder="{{ badge.name }}">
{% empty %}
No badges earned yet.
{% endfor %}
<img src="{{ badge.icon }}" placeholder="{{ badge.name }}" />
{% empty %} No badges earned yet. {% endfor %}
</p>
<h3>Statistics</h3>

View File

@@ -1,20 +1,20 @@
{% extends 'master.html' %}
{% load static %}
{% block header %}
{% extends 'master.html' %} {% load static %} {% block header %}
<!-- Adding custom style sheet for profile-->
<link rel="stylesheet" href="{% static 'css/profile.css' %}">
{% endblock %}
{% block content %}
<link rel="stylesheet" href="{% static 'css/profile.css' %}" />
{% endblock %} {% block content %}
<div class="content_block">
<h2>Settings</h2>
<a href="http://steamcommunity.com/id/me/tradeoffers/privacy#trade_offer_access_url" target="_blank">Find your trade URL!</a>
{% if gamer.API_KEY %}<a href="{% url 'profile_update' gamer.steamid %}">Synchronize profile from Steam</a>{% endif %}
<a
href="http://steamcommunity.com/id/me/tradeoffers/privacy#trade_offer_access_url"
target="_blank"
>Find your trade URL!</a
>
<a href="{% url 'profile_update' gamer.steamid %}"
>Synchronize profile from Steam</a
>
<form role="from" method="post" action="{% url 'me_settings' %}">
{% csrf_token %}
{{ form.as_p }}
{% csrf_token %} {{ form.as_p }}
<button type="submit">Set Trade URL</button>
</form>
</div>

View File

@@ -153,9 +153,9 @@ def profile_inventory(request, steamID):
@login_required
def profile_update(request, steamID):
if (request.user.steamid == steamID and request.user.gamer.API_KEY) or request.user.is_staff:
if request.user.steamid == steamID or request.user.is_staff:
the_gamer = get_object_or_404(Gamer, steamid=steamID)
info = getUserInfo(steamID, API_KEY=request.user.gamer.API_KEY or None)
info = getUserInfo(steamID)
the_gamer.communityvisibilitystate = (True if info['communityvisibilitystate'] == 3 else False)
the_gamer.profilestate = info['profilestate']
the_gamer.personaname = info['personaname']