From 3df650e314ac7df4ab4fa6cdd23ca548395119b4 Mon Sep 17 00:00:00 2001 From: Conrad Date: Wed, 22 Jan 2020 13:37:23 +0100 Subject: [PATCH] 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. --- README.md | 8 ++-- .../migrations/0007_remove_gamer_api_key.py | 17 +++++++ src/core/models.py | 1 - src/core/templates/profile/profile.html | 47 +++++++++++-------- src/core/templates/profile/settings.html | 24 +++++----- src/core/views.py | 4 +- 6 files changed, 62 insertions(+), 39 deletions(-) create mode 100644 src/core/migrations/0007_remove_gamer_api_key.py diff --git a/README.md b/README.md index 884733c..a582f03 100644 --- a/README.md +++ b/README.md @@ -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" diff --git a/src/core/migrations/0007_remove_gamer_api_key.py b/src/core/migrations/0007_remove_gamer_api_key.py new file mode 100644 index 0000000..03a0a2c --- /dev/null +++ b/src/core/migrations/0007_remove_gamer_api_key.py @@ -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', + ), + ] diff --git a/src/core/models.py b/src/core/models.py index 30cda4b..d7d14db 100644 --- a/src/core/models.py +++ b/src/core/models.py @@ -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) diff --git a/src/core/templates/profile/profile.html b/src/core/templates/profile/profile.html index 5e56147..5ec190a 100644 --- a/src/core/templates/profile/profile.html +++ b/src/core/templates/profile/profile.html @@ -1,38 +1,45 @@ -{% extends 'master.html' %} -{% load static %} - -{% block header %} +{% extends 'master.html' %} {% load static %} {% block header %} - -{% endblock %} - -{% block content %} + +{% endblock %} {% block content %}

-

{{ gamer.personaname }} {% if request.user.gamer == gamer %}(Your Profile){% endif %}

+

+ {{ gamer.personaname }} {% if request.user.gamer == gamer %}(Your Profile){% + endif %} +

Links

Info

Steam ID: {{ gamer.steamid }}

-

Profile: {% if gamer.profilestate %}Public Profile{% else %}Private Profile{% endif %}

-

Comments: {% if gamer.commentpermission %}Allowed{% else %}Denied{% endif %}

-

Locale: {% if gamer.loccountrycode %}{{ gamer.loccountrycode }}{% else %}Not provided{% endif %}

- {% if gamer.API_KEY %}

This is an API Key Sponsor!

{% endif %} +

+ Profile: {% if gamer.profilestate %}Public Profile{% else %}Private + Profile{% endif %} +

+

+ Comments: {% if gamer.commentpermission %}Allowed{% else %}Denied{% endif %} +

+

+ Locale: {% if gamer.loccountrycode %}{{ gamer.loccountrycode }}{% else %}Not + provided{% endif %} +

Badges

- {% for badge in gamer.badges.all %} - - {% empty %} - No badges earned yet. - {% endfor %} + {% for badge in gamer.badges.all %} + + {% empty %} No badges earned yet. {% endfor %}

Statistics

diff --git a/src/core/templates/profile/settings.html b/src/core/templates/profile/settings.html index b223b91..3e37ec9 100644 --- a/src/core/templates/profile/settings.html +++ b/src/core/templates/profile/settings.html @@ -1,20 +1,20 @@ -{% extends 'master.html' %} -{% load static %} - -{% block header %} +{% extends 'master.html' %} {% load static %} {% block header %} - -{% endblock %} - -{% block content %} + +{% endblock %} {% block content %}

Settings

- Find your trade URL! - {% if gamer.API_KEY %}Synchronize profile from Steam{% endif %} + Find your trade URL! + Synchronize profile from Steam
- {% csrf_token %} - {{ form.as_p }} + {% csrf_token %} {{ form.as_p }}
diff --git a/src/core/views.py b/src/core/views.py index 96a3801..7085cb5 100644 --- a/src/core/views.py +++ b/src/core/views.py @@ -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']