From ba0d75c25065155909b303a32933ba40853bd9d1 Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 17 Feb 2022 11:11:36 +0100 Subject: [PATCH 01/13] restored discord OAuth, not working in local, let's test on preprod if the url problem is solved --- bot.py | 104 ------------------- src/accounts/templates/accounts/edit.html | 116 +++++++++++++--------- 2 files changed, 69 insertions(+), 151 deletions(-) delete mode 100644 bot.py diff --git a/bot.py b/bot.py deleted file mode 100644 index 574efc5..0000000 --- a/bot.py +++ /dev/null @@ -1,104 +0,0 @@ -import os -import discord -import discord.utils -import urllib.request, json -import asyncio -import json -import logging - -TOKEN = os.getenv('DISCORD_TOKEN') -GUILD = '42ctf' - -intents = discord.Intents.all() -client = discord.Client(intents=intents) - -db_file = open('members.json', 'r') -users = json.load(db_file) -db_file.close() - -logging.basicConfig(filename='bot.log', format='%(asctime)s %(message)s', level=logging.INFO) - -guild = '' -roles = {} - -def get_rank(token): - url = urllib.request.urlopen("https://www.42ctf.org/accounts/rank/" + token) - data = json.loads(url.read().decode()) - rank = data['rank'] - return rank - -async def watch_roles(): - global users - await client.wait_until_ready() # ensures cache is loaded - while not client.is_closed(): - for member_id, token in users.items(): - if (token == "0000"): - continue - member = discord.utils.get(guild.members, id=int(member_id)) - rank = get_rank(token) - if rank == 1 and roles['top1'] not in member.roles: - await member.add_roles(roles['top1']) - await member.remove_roles(roles['top10']) - await member.remove_roles(roles['top50']) - elif rank > 1 and rank <= 10 and roles['top10'] not in member.roles: - await member.add_roles(roles['top10']) - await member.remove_roles(roles['top1']) - await member.remove_roles(roles['top50']) - elif rank > 10 and rank <= 50 and roles['top50'] not in member.roles: - await member.add_roles(roles['top50']) - await member.remove_roles(roles['top10']) - await member.remove_roles(roles['top1']) - elif rank > 50: - await member.remove_roles(roles['top1']) - await member.remove_roles(roles['top10']) - await member.remove_roles(roles['top50']) - await asyncio.sleep(60) - -@client.event -async def on_ready(): - global guild, roles - guild = discord.utils.get(client.guilds, name=GUILD) - roles['top10'] = discord.utils.get(guild.roles, id=801787467064672286) - roles['top1'] = discord.utils.get(guild.roles, id=798638767359524875) - roles['top50'] = discord.utils.get(guild.roles, id=803729539145924649) - - logging.info('%s is connected to the following guild: %s(id: %d)', client.user, guild.name, guild.id) - client.loop.create_task(watch_roles()) - -@client.event -async def on_message(message): - global guild, roles - - if message.author == client.user: - return - - if '!connect' in message.content: - try: - user_token = message.content.split(' ')[1] - member = discord.utils.get(guild.members, name=message.author.name) - rank = get_rank(user_token) - users[str(member.id)] = user_token - logging.info("MESSAGE: from %s with token %s", message.author.name, user_token) - with open('members.json', 'w') as json_file: - json.dump(users, json_file) - if rank == 1: - await member.add_roles(roles['top1']) - response = "Congratulations, you're now Top 1. But for how long ?" - - elif (rank <= 10): - await member.add_roles(roles['top10']) - response = "You've been granted the Top 10 role. Now, go away and flag !" - - elif rank <= 50: - await member.add_roles(roles['top50']) - response = "You've been granted the Top 50 role. Now, go away and flag !" - - else: - response = "No role for you now, but I'll keep watching you." - except IndexError: - response = 'usage: !connect 42ctf_token' - await message.author.create_dm() - await message.author.dm_channel.send(response) - - -client.run(TOKEN) \ No newline at end of file diff --git a/src/accounts/templates/accounts/edit.html b/src/accounts/templates/accounts/edit.html index 07eaba6..0e1c474 100644 --- a/src/accounts/templates/accounts/edit.html +++ b/src/accounts/templates/accounts/edit.html @@ -2,67 +2,89 @@ {% block content %} {% load i18n %}
-
-
-
-

Edit info

-
-
-
- {{ u_form.non_field_errors }} - {% if error is not None %} +
+
+
+

Edit info

+
+
+
+ {{ u_form.non_field_errors }} + {% if error is not None %} {{ error }} - {% elif success is not None %} + {% elif success is not None %} {{ success }} - {% endif %} -
-
+ {% endif %} + +
+ {%csrf_token%} + + {{ u_form.username.errors}} + {{u_form.username}} +
+ + {{ u_form.email.errors}} + {{u_form.email}} +
+
+ + {{p_form.portfolio_site}} +
+
Token + +
+ +
+ +
+
+
+ +
+
+

{% trans "Connected accounts" %}

+
+
+
+ {% if user.userprofileinfo.discord_id|length > 0 %} +
{%csrf_token%} - - {{ u_form.username.errors}} - {{u_form.username}} -
- - {{ u_form.email.errors}} - {{u_form.email}} -
-
- - {{p_form.portfolio_site}} -
-
Token - -
- -
- + + + {% else %} +
+ {%csrf_token%} + +
+ {% endif %} +
-
- -{% endblock %} - +
+{% endblock %} \ No newline at end of file -- 2.40.1 From 3d24fe9b3b840a3ede040976304620b82b466a4b Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 17 Feb 2022 12:03:52 +0100 Subject: [PATCH 02/13] tentative for fixing url redirect --- src/accounts/views/connection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/accounts/views/connection.py b/src/accounts/views/connection.py index edfa18b..1711b00 100644 --- a/src/accounts/views/connection.py +++ b/src/accounts/views/connection.py @@ -4,6 +4,7 @@ from django.views.decorators.http import require_POST from django.views.defaults import bad_request from django.urls import reverse from django.shortcuts import redirect +from django.contrib.sites.models import Site import os oauth = OAuth() @@ -23,8 +24,9 @@ oauth.register( def connect(request): if request.user.userprofileinfo.discord_id: return bad_request(request, "Already connected") + site = Site.objects.get_current() redirect_uri = reverse('accounts:connections-connect-discord-authorize') - redirect_uri = request.build_absolute_uri(redirect_uri) + redirect_uri = "https://" + site.domain + redirect_uri print(redirect_uri) return oauth.discord.authorize_redirect(request, redirect_uri) -- 2.40.1 From 0d734e98b1e322ddf80a1b8858d702c3339f2e13 Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 17 Feb 2022 12:19:52 +0100 Subject: [PATCH 03/13] removed language code in redirect_uri --- src/accounts/views/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/accounts/views/connection.py b/src/accounts/views/connection.py index 1711b00..f8da2ab 100644 --- a/src/accounts/views/connection.py +++ b/src/accounts/views/connection.py @@ -26,7 +26,7 @@ def connect(request): return bad_request(request, "Already connected") site = Site.objects.get_current() redirect_uri = reverse('accounts:connections-connect-discord-authorize') - redirect_uri = "https://" + site.domain + redirect_uri + redirect_uri = "https://" + site.domain + redirect_uri[2:] # remove language code print(redirect_uri) return oauth.discord.authorize_redirect(request, redirect_uri) -- 2.40.1 From a7de7b80543009ccb45e7bc5924f522bf1977a1f Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 17 Feb 2022 12:21:17 +0100 Subject: [PATCH 04/13] removed language code in redirect_uri --- src/accounts/views/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/accounts/views/connection.py b/src/accounts/views/connection.py index f8da2ab..8446b11 100644 --- a/src/accounts/views/connection.py +++ b/src/accounts/views/connection.py @@ -26,7 +26,7 @@ def connect(request): return bad_request(request, "Already connected") site = Site.objects.get_current() redirect_uri = reverse('accounts:connections-connect-discord-authorize') - redirect_uri = "https://" + site.domain + redirect_uri[2:] # remove language code + redirect_uri = "https://" + site.domain + redirect_uri[3:] # remove language code print(redirect_uri) return oauth.discord.authorize_redirect(request, redirect_uri) -- 2.40.1 From a0b76903a79fbe139f7355faffe740c32b3ab005 Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 17 Feb 2022 12:40:40 +0100 Subject: [PATCH 05/13] added endpoint API for bot --- src/accounts/urls.py | 1 + src/accounts/views/views.py | 45 +++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/accounts/urls.py b/src/accounts/urls.py index abf5ec9..2ba5a2b 100644 --- a/src/accounts/urls.py +++ b/src/accounts/urls.py @@ -14,4 +14,5 @@ urlpatterns = [ path('connections/connect/discord/authorize', views.connection.authorize, name='connections-connect-discord-authorize'), path('connections/disconnect/discord', views.connection.disconnect, name='connections-disconnect-discord'), path('delete_account/', views.delete_account, name='delete_account'), + path('api/bot/', views.api_bot, name='api_bot'), ] diff --git a/src/accounts/views/views.py b/src/accounts/views/views.py index 806ad75..f81a05b 100644 --- a/src/accounts/views/views.py +++ b/src/accounts/views/views.py @@ -16,6 +16,7 @@ from secrets import token_hex from accounts.models import UserProfileInfo from django.contrib.auth.models import timezone +import os from . import connection @@ -155,17 +156,6 @@ def profile(request, user_name): return render(request,'accounts/profile.html', {'user':user_obj, 'solves':solves,'solved':solved,'catsDatas': catsDatas, 'pointDatas': pointDatas, 'rank': rank, 'score' : somme, 'member' : member, 'cats':cats}) -def rank(request, token): - all_users = UserProfileInfo.objects.filter(score__gt=0).select_related().order_by('-score', 'last_submission_date', 'user__username') - - rank = 1 - for elem in all_users: - if elem.token == token: - break - rank += 1 - data = {"rank": rank} - return JsonResponse(data) - @login_required def delete_account(request): if request.method == 'POST': @@ -181,4 +171,35 @@ def delete_account(request): return render(request, 'accounts/delete.html', {'deleted': False, 'bad_password': True}) else: - return render(request, 'accounts/delete.html', {'deleted': False, 'bad_password': False} ) \ No newline at end of file + return render(request, 'accounts/delete.html', {'deleted': False, 'bad_password': False} ) + +def rank(request, token): + all_users = UserProfileInfo.objects.filter(score__gt=0).select_related().order_by('-score', 'last_submission_date', 'user__username') + + rank = 1 + for elem in all_users: + if elem.token == token: + break + rank += 1 + data = {"rank": rank} + return JsonResponse(data) + +def api_bot(request): + if request.method != 'GET': + return JsonResponse({'error':'bad request'}) + + token = request.GET.get('token') + auth_token = os.getenv('BOT_TOKEN') + + if (token != auth_token or not auth_token): + return JsonResponse({'error':'not authorized'}) + + all_users = UserProfileInfo.objects.select_related().order_by('-score', 'last_submission_date', 'user__username') + data = {} + rank = 1 + for user in all_users: + if user.discord_id: + data[user.discord_id] = rank + rank += 1 + + return JsonResponse(data) \ No newline at end of file -- 2.40.1 From 8f32ef9a6e3dfbd594d007e7a2a3e6c06f8d443d Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 17 Feb 2022 13:09:11 +0100 Subject: [PATCH 06/13] excluded the API from the i18n patterns --- src/accounts/urls.py | 1 - src/accounts/views/views.py | 20 -------------------- src/api/__init__.py | 0 src/api/admin.py | 3 +++ src/api/apps.py | 6 ++++++ src/api/migrations/__init__.py | 0 src/api/models.py | 3 +++ src/api/tests.py | 3 +++ src/api/urls.py | 6 ++++++ src/api/views.py | 27 +++++++++++++++++++++++++++ src/project/settings.py | 1 + src/project/urls.py | 1 + 12 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 src/api/__init__.py create mode 100644 src/api/admin.py create mode 100644 src/api/apps.py create mode 100644 src/api/migrations/__init__.py create mode 100644 src/api/models.py create mode 100644 src/api/tests.py create mode 100644 src/api/urls.py create mode 100644 src/api/views.py diff --git a/src/accounts/urls.py b/src/accounts/urls.py index 2ba5a2b..abf5ec9 100644 --- a/src/accounts/urls.py +++ b/src/accounts/urls.py @@ -14,5 +14,4 @@ urlpatterns = [ path('connections/connect/discord/authorize', views.connection.authorize, name='connections-connect-discord-authorize'), path('connections/disconnect/discord', views.connection.disconnect, name='connections-disconnect-discord'), path('delete_account/', views.delete_account, name='delete_account'), - path('api/bot/', views.api_bot, name='api_bot'), ] diff --git a/src/accounts/views/views.py b/src/accounts/views/views.py index f81a05b..ad2dffe 100644 --- a/src/accounts/views/views.py +++ b/src/accounts/views/views.py @@ -182,24 +182,4 @@ def rank(request, token): break rank += 1 data = {"rank": rank} - return JsonResponse(data) - -def api_bot(request): - if request.method != 'GET': - return JsonResponse({'error':'bad request'}) - - token = request.GET.get('token') - auth_token = os.getenv('BOT_TOKEN') - - if (token != auth_token or not auth_token): - return JsonResponse({'error':'not authorized'}) - - all_users = UserProfileInfo.objects.select_related().order_by('-score', 'last_submission_date', 'user__username') - data = {} - rank = 1 - for user in all_users: - if user.discord_id: - data[user.discord_id] = rank - rank += 1 - return JsonResponse(data) \ No newline at end of file diff --git a/src/api/__init__.py b/src/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/api/admin.py b/src/api/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/src/api/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/src/api/apps.py b/src/api/apps.py new file mode 100644 index 0000000..66656fd --- /dev/null +++ b/src/api/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ApiConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'api' diff --git a/src/api/migrations/__init__.py b/src/api/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/api/models.py b/src/api/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/src/api/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/src/api/tests.py b/src/api/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/src/api/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/api/urls.py b/src/api/urls.py new file mode 100644 index 0000000..2a5ad61 --- /dev/null +++ b/src/api/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('bot/discord', views.discord_bot, name='discord_bot'), +] diff --git a/src/api/views.py b/src/api/views.py new file mode 100644 index 0000000..4e15d74 --- /dev/null +++ b/src/api/views.py @@ -0,0 +1,27 @@ +from django.shortcuts import render +from accounts.models import UserProfileInfo +from django.http import JsonResponse +import os + +# Create your views here. + + +def discord_bot(request): + if request.method != 'GET': + return JsonResponse({'error':'bad request'}) + + token = request.GET.get('token') + auth_token = os.getenv('BOT_TOKEN') + + if (token != auth_token or not auth_token): + return JsonResponse({'error':'not authorized'}) + + all_users = UserProfileInfo.objects.select_related().order_by('-score', 'last_submission_date', 'user__username') + data = {} + rank = 1 + for user in all_users: + if user.discord_id: + data[user.discord_id] = rank + rank += 1 + + return JsonResponse(data) \ No newline at end of file diff --git a/src/project/settings.py b/src/project/settings.py index 3452bf9..21eb2ce 100644 --- a/src/project/settings.py +++ b/src/project/settings.py @@ -38,6 +38,7 @@ INSTALLED_APPS = [ 'scoreboard.apps.ScoreboardConfig', 'resources.apps.ResourcesConfig', 'django.contrib.sites', + 'api.apps.ApiConfig', ] MIDDLEWARE = [ diff --git a/src/project/urls.py b/src/project/urls.py index 0f70920..a3e30db 100644 --- a/src/project/urls.py +++ b/src/project/urls.py @@ -24,6 +24,7 @@ urlpatterns = [ path('', include('home.urls')), path('set_lang/', home.views.set_language, name="set_language"), path('dashboard/secret/admin', admin.site.urls), + path('api/', include('api.urls')) ] urlpatterns += i18n_patterns( -- 2.40.1 From 60a59b23e6d74183d33dddbdb993f364b2234876 Mon Sep 17 00:00:00 2001 From: Danhia Date: Thu, 17 Feb 2022 23:21:41 +0100 Subject: [PATCH 07/13] fixed error 500 when requesting german or russian translation --- src/ctfs/views.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/ctfs/views.py b/src/ctfs/views.py index 354f131..23b38ec 100644 --- a/src/ctfs/views.py +++ b/src/ctfs/views.py @@ -8,19 +8,6 @@ from django.utils.translation import get_language from math import log from accounts.models import UserProfileInfo -def get_description_by_lang(ctf): - lang = get_language() - ret = None - if lang == "fr": - ret = ctf.description - elif lang == "en": - ret = ctf.description_en - elif lang == "de": - ret = ctf.description_de - elif lang == "ru": - ret = ctf.description_ru - return ret - def actualize_points(ctf): if ctf.category.name == "-Intro-": return @@ -50,7 +37,6 @@ def ctf(request, cat_slug, ctf_slug): ctf_info = get_object_or_404(CTF, slug=ctf_slug, event=None) flagged = False solved_list = CTF_flags.objects.filter(ctf=ctf_info).order_by('flag_date') - description = get_description_by_lang(ctf_info) if request.user.is_authenticated: if CTF_flags.objects.filter(user=request.user, ctf=ctf_info): flagged = True @@ -66,12 +52,12 @@ def ctf(request, cat_slug, ctf_slug): profil.score += ctf_info.points profil.save() actualize_points(ctf_info) - return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'valitated': True, 'description': description, 'date': timezone.now()}) + return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'valitated': True, 'date': timezone.now()}) else: - return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'failed': True, 'description': description, 'date': timezone.now()}) + return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'failed': True, 'date': timezone.now()}) else: - return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': True, 'description': description, 'date': timezone.now()}) + return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': True, 'date': timezone.now()}) else: - return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'description': description, 'date': timezone.now()}) + return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'date': timezone.now()}) else: - return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': flagged, 'description': description, 'date': timezone.now()}) + return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': flagged, 'date': timezone.now()}) -- 2.40.1 From eac835bef51cfa7565bc5f9bf1d4931dcf7c8ed2 Mon Sep 17 00:00:00 2001 From: Danhia Date: Fri, 18 Feb 2022 10:55:54 +0100 Subject: [PATCH 08/13] removed merge artifact --- src/accounts/views/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/accounts/views/views.py b/src/accounts/views/views.py index 895ebe7..392e6ba 100644 --- a/src/accounts/views/views.py +++ b/src/accounts/views/views.py @@ -154,7 +154,6 @@ def profile(request, user_name): return render(request,'accounts/profile.html', {'user':user_obj, 'solves':solves,'solved':solved,'catsDatas': catsDatas, 'pointDatas': pointDatas, 'rank': rank, 'score' : somme, 'member' : member, 'cats':cats}) -<<<<<<< HEAD @login_required def delete_account(request): -- 2.40.1 From 7b2552f0b5f6f1e3481113fee44cf37c712df5df Mon Sep 17 00:00:00 2001 From: Danhia Date: Fri, 18 Feb 2022 11:11:34 +0100 Subject: [PATCH 09/13] added try except in case user cancels oauth --- src/accounts/views/connection.py | 59 +++++++++++++++++--------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/accounts/views/connection.py b/src/accounts/views/connection.py index 8446b11..f25bb6c 100644 --- a/src/accounts/views/connection.py +++ b/src/accounts/views/connection.py @@ -10,43 +10,46 @@ import os oauth = OAuth() oauth.register( - name='discord', - client_id=os.getenv('OAUTH2_DISCORD_CLIENT_ID'), - client_secret=os.getenv('OAUTH2_DISCORD_CLIENT_SECRET'), - access_token_url='https://discord.com/api/oauth2/token', - authorize_url='https://discord.com/api/oauth2/authorize', - client_kwargs={'scope': 'identify'}, - api_base_url='https://discord.com/api/' + name='discord', + client_id=os.getenv('OAUTH2_DISCORD_CLIENT_ID'), + client_secret=os.getenv('OAUTH2_DISCORD_CLIENT_SECRET'), + access_token_url='https://discord.com/api/oauth2/token', + authorize_url='https://discord.com/api/oauth2/authorize', + client_kwargs={'scope': 'identify'}, + api_base_url='https://discord.com/api/' ) @login_required @require_POST def connect(request): - if request.user.userprofileinfo.discord_id: - return bad_request(request, "Already connected") - site = Site.objects.get_current() - redirect_uri = reverse('accounts:connections-connect-discord-authorize') - redirect_uri = "https://" + site.domain + redirect_uri[3:] # remove language code - print(redirect_uri) - return oauth.discord.authorize_redirect(request, redirect_uri) + if request.user.userprofileinfo.discord_id: + return bad_request(request, "Already connected") + site = Site.objects.get_current() + redirect_uri = reverse('accounts:connections-connect-discord-authorize') + redirect_uri = "https://" + site.domain + redirect_uri[3:] # remove language code + print(redirect_uri) + return oauth.discord.authorize_redirect(request, redirect_uri) @login_required def authorize(request): - if request.user.userprofileinfo.discord_id: - return bad_request(request, "Already connected") - token = oauth.discord.authorize_access_token(request) - response = oauth.discord.get('users/@me', token=token) - response = response.json() - discord_id = response['id'] - request.user.userprofileinfo.discord_id = discord_id - request.user.userprofileinfo.save() - return redirect('accounts:edit') + if request.user.userprofileinfo.discord_id: + return bad_request(request, "Already connected") + try: + token = oauth.discord.authorize_access_token(request) + except: + bad_request(request, "Connection refused") + response = oauth.discord.get('users/@me', token=token) + response = response.json() + discord_id = response['id'] + request.user.userprofileinfo.discord_id = discord_id + request.user.userprofileinfo.save() + return redirect('accounts:edit') @login_required @require_POST def disconnect(request): - if not request.user.userprofileinfo.discord_id: - return bad_request(request, "Already disconnected") - request.user.userprofileinfo.discord_id = None - request.user.userprofileinfo.save() - return redirect('accounts:edit') + if not request.user.userprofileinfo.discord_id: + return bad_request(request, "Already disconnected") + request.user.userprofileinfo.discord_id = None + request.user.userprofileinfo.save() + return redirect('accounts:edit') -- 2.40.1 From 67a4d180e0f3a4c3266cad132d9d0c12d722f658 Mon Sep 17 00:00:00 2001 From: Danhia Date: Fri, 18 Feb 2022 11:27:58 +0100 Subject: [PATCH 10/13] corrected typo --- src/accounts/views/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/accounts/views/connection.py b/src/accounts/views/connection.py index f25bb6c..5822a6d 100644 --- a/src/accounts/views/connection.py +++ b/src/accounts/views/connection.py @@ -37,7 +37,7 @@ def authorize(request): try: token = oauth.discord.authorize_access_token(request) except: - bad_request(request, "Connection refused") + return bad_request(request, "Connection refused") response = oauth.discord.get('users/@me', token=token) response = response.json() discord_id = response['id'] -- 2.40.1 From 11164bb84a81cf5bdd0d0e893fa301025977dda8 Mon Sep 17 00:00:00 2001 From: Danhia Date: Fri, 18 Feb 2022 11:32:08 +0100 Subject: [PATCH 11/13] replaced the bad request with a redirect to account edit --- src/accounts/views/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/accounts/views/connection.py b/src/accounts/views/connection.py index 5822a6d..1dc3642 100644 --- a/src/accounts/views/connection.py +++ b/src/accounts/views/connection.py @@ -37,7 +37,7 @@ def authorize(request): try: token = oauth.discord.authorize_access_token(request) except: - return bad_request(request, "Connection refused") + return redirect('accounts:edit') response = oauth.discord.get('users/@me', token=token) response = response.json() discord_id = response['id'] -- 2.40.1 From ba1cb03dbfd8a89ece85e7fdf5e26cac415235a7 Mon Sep 17 00:00:00 2001 From: ysaito Date: Fri, 18 Feb 2022 22:45:09 +0900 Subject: [PATCH 12/13] feat(*/django.po): Add Japanese message string --- src/locale/ja/LC_MESSAGES/django.po | 268 +++++++++--------- src/resources/locale/ja/LC_MESSAGES/django.po | 117 +++++--- 2 files changed, 224 insertions(+), 161 deletions(-) diff --git a/src/locale/ja/LC_MESSAGES/django.po b/src/locale/ja/LC_MESSAGES/django.po index 60b6a06..0537e62 100644 --- a/src/locale/ja/LC_MESSAGES/django.po +++ b/src/locale/ja/LC_MESSAGES/django.po @@ -20,23 +20,23 @@ msgstr "" #: accounts/templates/accounts/delete.html:8 msgid "Delete account" -msgstr "" +msgstr "アカウント削除" #: accounts/templates/accounts/delete.html:11 msgid "Please confirm your password to delete your account." -msgstr "" +msgstr "アカウントを削除するには、パスワードを入力してください。" #: accounts/templates/accounts/delete.html:12 msgid "Deleted accounts cannot be recovered." -msgstr "" +msgstr "削除されたアカウントは復元できません。" #: accounts/templates/accounts/delete.html:15 msgid "Password inccorect." -msgstr "" +msgstr "パスワードが正しくありません。" #: accounts/templates/accounts/delete.html:17 msgid "Your account has been deleted." -msgstr "" +msgstr "あなたのアカウントは削除されました。" #: accounts/templates/accounts/delete.html:22 #: accounts/templates/accounts/login.html:19 @@ -44,21 +44,22 @@ msgstr "" #: events/templates/events/create_team.html:27 #: events/templates/events/join_team.html:32 msgid "Password" -msgstr "" +msgstr "パスワード" #: accounts/templates/accounts/edit.html:21 #: accounts/templates/accounts/login.html:18 #: accounts/templates/accounts/register.html:22 -#: ctfs/templates/ctfs/ctf_info.html:63 ctfs/templates/ctfs/ctfs_list.html:12 +#: ctfs/templates/ctfs/ctf_info.html:63 +#: ctfs/templates/ctfs/ctfs_list.html:12 #: events/templates/events/ctf_info.html:65 #: events/templates/events/event_info.html:64 #: scoreboard/templates/scoreboard/scoreboard.html:13 msgid "Username" -msgstr "" +msgstr "ユーザー名" #: accounts/templates/accounts/edit.html:25 msgid "Email" -msgstr "" +msgstr "Eメール" #: accounts/templates/accounts/edit.html:30 #: ctfs/templates/ctfs/ctf_info.html:64 @@ -66,40 +67,41 @@ msgstr "" #: events/templates/events/event_info.html:65 #: scoreboard/templates/scoreboard/scoreboard.html:14 msgid "Website" -msgstr "" +msgstr "ウェブサイト" #: accounts/templates/accounts/edit.html:36 #: events/templates/events/manage_team.html:29 msgid "Apply" -msgstr "" +msgstr "適用する" #: accounts/templates/accounts/edit.html:47 #: accounts/templates/accounts/profile.html:46 -#: ctfs/templates/ctfs/ctf_info.html:65 ctfs/templates/ctfs/ctfs_list.html:13 +#: ctfs/templates/ctfs/ctf_info.html:65 +#: ctfs/templates/ctfs/ctfs_list.html:13 #: events/templates/events/event_info.html:66 #: events/templates/events/event_info.html:89 #: events/templates/events/manage_team.html:40 #: events/templates/events/team.html:45 #: scoreboard/templates/scoreboard/scoreboard.html:15 msgid "Score" -msgstr "" +msgstr "スコア" #: accounts/templates/accounts/edit.html:55 #: accounts/templates/accounts/profile.html:60 msgid "Registered since" -msgstr "" +msgstr "登録日" #: accounts/templates/accounts/edit.html:61 msgid "Delete my account" -msgstr "" +msgstr "アカウント削除" #: accounts/templates/accounts/login.html:13 msgid "Please, verify your infos." -msgstr "" +msgstr "あなたの情報を確認してください。" #: accounts/templates/accounts/login.html:22 msgid "Reset password" -msgstr "" +msgstr "パスワード再設定" #: accounts/templates/accounts/login.html:31 #: accounts/templates/accounts/register.html:38 templates/base.html:97 @@ -108,7 +110,7 @@ msgstr "" #: templates/registration/password_reset_done.html:18 #: templates/registration/password_reset_form.html:26 msgid "Login" -msgstr "" +msgstr "ログイン" #: accounts/templates/accounts/login.html:32 #: accounts/templates/accounts/register.html:37 @@ -117,37 +119,37 @@ msgstr "" #: templates/registration/password_reset_done.html:19 #: templates/registration/password_reset_form.html:27 msgid "Sign up" -msgstr "" +msgstr "サインアップ" #: accounts/templates/accounts/profile.html:10 msgid "Challenges Solved by" -msgstr "" +msgstr "解いた課題" #: accounts/templates/accounts/profile.html:21 #: events/templates/events/team.html:20 msgid "Challenge Name" -msgstr "" +msgstr "課題名" #: accounts/templates/accounts/profile.html:22 #: events/templates/events/team.html:21 msgid "Category" -msgstr "" +msgstr "カテゴリー" #: accounts/templates/accounts/profile.html:23 #: events/templates/events/team.html:22 msgid "Points" -msgstr "" +msgstr "ポイント" #: accounts/templates/accounts/profile.html:24 #: ctfs/templates/ctfs/ctf_info.html:66 #: events/templates/events/ctf_info.html:67 #: events/templates/events/team.html:23 msgid "Date" -msgstr "" +msgstr "日付" #: accounts/templates/accounts/profile.html:39 msgid "It seems that this user has not solved any challenge yet..." -msgstr "" +msgstr "まだ何も課題を解いていないようです..." #: accounts/templates/accounts/profile.html:47 #: events/templates/events/event_info.html:63 @@ -156,461 +158,471 @@ msgstr "" #: events/templates/events/team.html:46 #: scoreboard/templates/scoreboard/scoreboard.html:12 msgid "Rank" -msgstr "" +msgstr "ラング" #: accounts/templates/accounts/profile.html:56 msgid "Status: Member" -msgstr "" +msgstr "ステータス: メンバー" #: accounts/templates/accounts/profile.html:58 msgid "Status: Visitor" -msgstr "" +msgstr "ステータス: 訪問者" #: accounts/templates/accounts/profile.html:64 #: events/templates/events/team.html:57 msgid "Categories stats" -msgstr "" +msgstr "カテゴリー別の統計" #: accounts/templates/accounts/register.html:13 msgid "Welcome !" -msgstr "" +msgstr "ようこそ!" #: accounts/templates/accounts/register.html:14 msgid "Your account has been created." -msgstr "" +msgstr "アカウントが作成されました。" #: accounts/templates/accounts/register.html:25 msgid "Personal website" -msgstr "" +msgstr "個人サイト" #: accounts/templates/accounts/register.html:26 #: events/templates/events/event_info.html:119 msgid "Register" -msgstr "" +msgstr "登録" #: accounts/views/views.py:33 msgid "Your account was inactive." -msgstr "" +msgstr "アカウントは無効です。" #: accounts/views/views.py:52 msgid "" "The password must contain at least one letter and at least one digit or " "punctuation character." msgstr "" +"パスワードには、少なくとも1つの文字と、1つの数字または記号を含める必要があり" +"ます。" #: accounts/views/views.py:54 msgid "A user with that email already exists." -msgstr "" +msgstr "そのEメールを持つユーザーがすでに存在しています。" #: accounts/views/views.py:67 msgid "A user with that username already exists." -msgstr "" +msgstr "そのユーザー名はすでに存在しています。" #: accounts/views/views.py:95 msgid "Email already taken." -msgstr "" +msgstr "Eメールはすでに受信済みです。" #: accounts/views/views.py:101 msgid "Username already taken." -msgstr "" +msgstr "ユーザー名はすでに使用されています。" #: accounts/views/views.py:105 events/views/teams.py:124 msgid "Updated." -msgstr "" +msgstr "更新しました。" #: ctfs/templates/ctfs/ctf_info.html:12 #: events/templates/events/ctf_info.html:12 msgid "Published date" -msgstr "" +msgstr "掲載日" #: ctfs/templates/ctfs/ctf_info.html:16 msgid "Challenge is not yet available." -msgstr "" +msgstr "課題はまだ利用できません。" #: ctfs/templates/ctfs/ctf_info.html:29 #: events/templates/events/ctf_info.html:24 msgid "Congratulation !" -msgstr "" +msgstr "おめでとうございます!" #: ctfs/templates/ctfs/ctf_info.html:31 #: events/templates/events/ctf_info.html:26 msgid "Already flagged" -msgstr "" +msgstr "すでにフラグが立っています" -#: ctfs/templates/ctfs/ctf_info.html:33 ctfs/templates/ctfs/ctf_info.html:42 +#: ctfs/templates/ctfs/ctf_info.html:33 +#: ctfs/templates/ctfs/ctf_info.html:42 #: events/templates/events/ctf_info.html:36 #: events/templates/events/ctf_info.html:45 msgid "Start the challenge" -msgstr "" +msgstr "チャレンジ開始" -#: ctfs/templates/ctfs/ctf_info.html:35 ctfs/templates/ctfs/ctf_info.html:44 +#: ctfs/templates/ctfs/ctf_info.html:35 +#: ctfs/templates/ctfs/ctf_info.html:44 #: events/templates/events/ctf_info.html:38 #: events/templates/events/ctf_info.html:47 msgid "Download" -msgstr "" +msgstr "ダウンロード" #: ctfs/templates/ctfs/ctf_info.html:39 #: events/templates/events/ctf_info.html:42 msgid "Wrong flag ! You can do it !" -msgstr "" +msgstr "フラグが違います!あなたならできる!" #: ctfs/templates/ctfs/ctf_info.html:58 #: events/templates/events/ctf_info.html:60 msgid "Solved by" -msgstr "" +msgstr "解答者" #: ctfs/templates/ctfs/ctf_info.html:82 #: events/templates/events/ctf_info.html:90 msgid "Nobody has solved this challenge yet." -msgstr "" +msgstr "まだ誰もこの課題を解いていません。" #: ctfs/templates/ctfs/ctf_info.html:89 #: events/templates/events/ctf_info.html:97 msgid "Author" -msgstr "" +msgstr "作成者" #: ctfs/templates/ctfs/ctf_info.html:90 #: events/templates/events/ctf_info.html:98 msgid "Point reward" -msgstr "" +msgstr "獲得ポイント" #: ctfs/templates/ctfs/ctfs_list.html:14 msgid "Solved" -msgstr "" +msgstr "解決済み" #: ctfs/templates/ctfs/ctfs_list.html:37 msgid "No ctf available for this category." -msgstr "" +msgstr "このカテゴリーにはCTFがありません。" #: ctfs/templates/ctfs/ctfs_list.html:42 msgid "Categories" -msgstr "" +msgstr "カテゴリー" #: ctfs/templates/ctfs/ctfs_list.html:48 templates/base.html:54 msgid "No category available." -msgstr "" +msgstr "該当するカテゴリーはありません。" #: events/templates/events/create_team.html:10 #: events/templates/events/join_team.html:10 msgid "This event starts at" -msgstr "" +msgstr "このイベントは始まります。" #: events/templates/events/create_team.html:17 #: events/templates/events/join_team.html:17 msgid "You need to be registered to the event." -msgstr "" +msgstr "このイベントに登録する必要があります。" -#: events/templates/events/create_team.html:20 events/views/teams.py:120 +#: events/templates/events/create_team.html:20 +#: events/views/teams.py:120 msgid "Name already taken." -msgstr "" +msgstr "名前はすでに使用されています。" #: events/templates/events/create_team.html:26 #: events/templates/events/join_team.html:31 #: events/templates/events/manage_team.html:22 msgid "Team name" -msgstr "" +msgstr "チーム名" #: events/templates/events/create_team.html:28 #: events/templates/events/create_team.html:49 #: events/templates/events/join_team.html:54 msgid "Create Team" -msgstr "" +msgstr "チーム作成" #: events/templates/events/create_team.html:33 #: events/templates/events/event_pwd.html:28 #: events/templates/events/join_team.html:38 msgid "You need to be logged to access this event." -msgstr "" +msgstr "このイベントにアクセスするには、ログインする必要があります。" #: events/templates/events/create_team.html:42 #: events/templates/events/event_info.html:113 #: events/templates/events/event_pwd.html:36 #: events/templates/events/join_team.html:47 msgid "Starts at" -msgstr "" +msgstr "開始日" #: events/templates/events/create_team.html:43 #: events/templates/events/event_info.html:114 #: events/templates/events/event_pwd.html:37 #: events/templates/events/join_team.html:48 msgid "Ends at" -msgstr "" +msgstr "終了日" #: events/templates/events/create_team.html:47 #: events/templates/events/event_info.html:129 #: events/templates/events/join_team.html:52 msgid "Manage my team" -msgstr "" +msgstr "自分のチームを管理する" #: events/templates/events/create_team.html:48 #: events/templates/events/join_team.html:33 #: events/templates/events/join_team.html:53 msgid "Join Team" -msgstr "" +msgstr "チームに参加する" #: events/templates/events/create_team.html:53 #: events/templates/events/join_team.html:58 msgid "Auto-matching" -msgstr "" +msgstr "自動マッチング" #: events/templates/events/create_team.html:57 #: events/templates/events/join_team.html:62 msgid "Find me a team !" -msgstr "" +msgstr "チームを見つけよう!" #: events/templates/events/ctf_info.html:10 msgid "Event" -msgstr "" +msgstr "イベント" #: events/templates/events/ctf_info.html:18 msgid "" "No translation available. Please try another language (English or French)." -msgstr "" +msgstr "翻訳はありません。他の言語(英語またはフランス語)をお試しください。" #: events/templates/events/ctf_info.html:28 #: events/templates/events/event_info.html:18 msgid "This event is over." -msgstr "" +msgstr "このイベントは終了しました。" #: events/templates/events/ctf_info.html:30 msgid "Error while processing your request. (Invalid Form)" -msgstr "" +msgstr "リクエストの処理中にエラーが発生しました(無効なフォーム)" #: events/templates/events/ctf_info.html:32 msgid "You must register to the event before submitting flags." -msgstr "" +msgstr "フラグを送信する前に、イベントへの登録が必要です。" #: events/templates/events/ctf_info.html:34 msgid "" "This is a team event, please create or join a team before submitting flags." msgstr "" +"これはチームイベントです。フラグを送信する前に、チームを作成または参加をして" +"ください。" #: events/templates/events/event_info.html:9 msgid "Subscriptions is over." -msgstr "" +msgstr "申し込みは終了しました。" #: events/templates/events/event_info.html:12 #: events/templates/events/event_pwd.html:18 msgid "You're already registered to this event." -msgstr "" +msgstr "すでにこのイベントに登録しています。" #: events/templates/events/event_info.html:20 #: events/templates/events/event_pwd.html:9 msgid "This event start at" -msgstr "" +msgstr "このイベントの開始時間" #: events/templates/events/event_info.html:30 msgid "Challenges" -msgstr "" +msgstr "課題" #: events/templates/events/event_info.html:47 msgid "No challenges available." -msgstr "" +msgstr "チャレンジできません。" #: events/templates/events/event_info.html:51 msgid "The event has not started yet." -msgstr "" +msgstr "イベントはまだ始まっていません。" #: events/templates/events/event_info.html:57 msgid "ScoreBoard" -msgstr "" +msgstr "スコアボード" #: events/templates/events/event_info.html:88 msgid "Team" -msgstr "" +msgstr "チーム" #: events/templates/events/event_info.html:106 msgid "No one have earn point yet, you gonna be the first ?" -msgstr "" +msgstr "まだ誰もポイントを獲得していませんが、あなたが最初に獲得しますか?" #: events/templates/events/event_pwd.html:15 #: events/templates/events/join_team.html:22 msgid "Wrong password submited." -msgstr "" +msgstr "パスワードが違います。" #: events/templates/events/event_pwd.html:20 msgid "This event is password protected" -msgstr "" +msgstr "このイベントはパスワードで保護されています。" #: events/templates/events/event_pwd.html:21 msgid "You need to submit the event password to gain access to this event." msgstr "" +"このイベントにアクセスするには、イベントのパスワードを送信する必要がありま" +"す。" #: events/templates/events/events_list.html:6 templates/base.html:61 msgid "Events" -msgstr "" +msgstr "イベント" #: events/templates/events/events_list.html:38 msgid "See more" -msgstr "" +msgstr "もっと見る" #: events/templates/events/events_list.html:44 msgid "No events available." -msgstr "" +msgstr "該当するイベントはありません。" #: events/templates/events/join_team.html:20 msgid "Team does not exist." -msgstr "" +msgstr "チームが存在しません。" #: events/templates/events/join_team.html:24 msgid "Maximum size reached." -msgstr "" +msgstr "最大サイズに達しました。" #: events/templates/events/manage_team.html:26 msgid "Team password" -msgstr "" +msgstr "チームのパスワード" #: events/templates/events/manage_team.html:44 #: events/templates/events/team.html:49 msgid "Members" -msgstr "" +msgstr "メンバー" #: events/templates/events/manage_team.html:52 msgid "Leave Team" -msgstr "" +msgstr "チームを離れる" #: events/templates/events/manage_team.html:59 msgid "Open to automatching" -msgstr "" +msgstr "自動マッチングにする" #: events/templates/events/manage_team.html:66 msgid "Close to automatching" -msgstr "" +msgstr "自動マッチングをやめる" #: events/templates/events/team.html:38 msgid "It seems that this team has not solved any challenge yet..." -msgstr "" +msgstr "このチームは、まだ何も課題を解いていないようです..." #: home/templates/home/home.html:21 msgid "Weekly Top 5" -msgstr "" +msgstr "週間トップ5" #: home/templates/home/home.html:48 msgid "No article available." -msgstr "" +msgstr "記事はありません。" #: home/templates/home/home.html:53 msgid "Latest challenges added" -msgstr "" +msgstr "最新の追加課題" #: home/templates/home/home.html:58 msgid "points" -msgstr "" +msgstr "ポイント" #: home/templates/home/home.html:62 msgid "No ctf available." -msgstr "" +msgstr "取り組めるctfはありません。" #: home/templates/home/home.html:66 msgid "Latest Flags" -msgstr "" +msgstr "最新のフラグ" #: home/templates/home/home.html:80 msgid "Flags" -msgstr "" +msgstr "フラグ" #: home/templates/home/home.html:86 msgid "Users" -msgstr "" +msgstr "ユーザー" #: project/settings.py:115 msgid "English" -msgstr "" +msgstr "英語" #: project/settings.py:116 msgid "German" -msgstr "" +msgstr "ドイツ語" #: project/settings.py:117 msgid "French" -msgstr "" +msgstr "フランス語" #: project/settings.py:118 msgid "Russian" -msgstr "" +msgstr "ロシア語" #: project/settings.py:119 msgid "Japanese" -msgstr "" +msgstr "日本語" #: project/settings.py:120 msgid "Spanish" -msgstr "" +msgstr "スペイン語" #: scoreboard/templates/scoreboard/scoreboard.html:38 msgid "First" -msgstr "" +msgstr "最初" #: scoreboard/templates/scoreboard/scoreboard.html:39 msgid "Previous" -msgstr "" +msgstr "前" #: scoreboard/templates/scoreboard/scoreboard.html:43 msgid "Page " -msgstr "" +msgstr "ページ" #: scoreboard/templates/scoreboard/scoreboard.html:47 msgid "Next" -msgstr "" +msgstr "次" #: scoreboard/templates/scoreboard/scoreboard.html:48 msgid "Last" -msgstr "" +msgstr "最後" #: templates/base.html:59 msgid "Scoreboard" -msgstr "" +msgstr "スコアボード" #: templates/base.html:64 msgid "Resources" -msgstr "" +msgstr "リソース" #: templates/base.html:93 msgid "Logout" -msgstr "" +msgstr "ログアウト" #: templates/base.html:100 msgid "Sign Up" -msgstr "" +msgstr "サインアップ" #: templates/base.html:135 msgid "Become a Patron!" -msgstr "" +msgstr "支援者になる!" #: templates/registration/password_reset_complete.html:11 msgid "Your new password has been set." -msgstr "" +msgstr "新しいパスワードが設定されました。" #: templates/registration/password_reset_confirm.html:20 msgid "Your password can’t be too similar to your other personal information." -msgstr "" +msgstr "パスワードは、自身の個人情報と似すぎていてはいけません。" #: templates/registration/password_reset_confirm.html:21 msgid "Your password must contain at least 8 characters." -msgstr "" +msgstr "パスワードには8文字以上が必要です。" #: templates/registration/password_reset_confirm.html:22 msgid "Your password can’t be a commonly used password." -msgstr "" +msgstr "パスワードは、一般的に使われているものを使用しないでください。" #: templates/registration/password_reset_confirm.html:23 msgid "Your password can’t be entirely numeric." -msgstr "" +msgstr "パスワードはすべて数字にはできません。" #: templates/registration/password_reset_confirm.html:26 msgid "Confirm" -msgstr "" +msgstr "確認" #: templates/registration/password_reset_confirm.html:28 msgid "Submit" -msgstr "" +msgstr "送信" #: templates/registration/password_reset_done.html:11 msgid "" "We've emailed you instructions for setting your password. You should receive " "the email shortly!" msgstr "" +"パスワードの設定方法をメールでお送りしました。まもなくメールが届くはずです!" #: templates/registration/password_reset_form.html:16 msgid "Reset" -msgstr "" +msgstr "リセット" diff --git a/src/resources/locale/ja/LC_MESSAGES/django.po b/src/resources/locale/ja/LC_MESSAGES/django.po index 32d7a03..1c94f45 100644 --- a/src/resources/locale/ja/LC_MESSAGES/django.po +++ b/src/resources/locale/ja/LC_MESSAGES/django.po @@ -20,11 +20,11 @@ msgstr "" #: resources/templates/resources/42ctf.html:7 msgid "What is 42CTF ?" -msgstr "" +msgstr "42CTFとは?" #: resources/templates/resources/42ctf.html:10 msgid "A short introduction to CTF" -msgstr "" +msgstr "CTFについての簡単な紹介" #: resources/templates/resources/42ctf.html:11 msgid "" @@ -32,144 +32,172 @@ msgid "" "participants have to solve challenges of various categories to gain points " "and progress on the scoreboard." msgstr "" +"42CTFとは、Capture The Flagの略です。サイバーセキュリティの競技会のことで、参" +"加者は様々なカテゴリーの課題を解決してポイントを獲得し、スコアボードでの順位" +"を上げていきます。" #: resources/templates/resources/42ctf.html:12 msgid "" "The challenges require participants to find sort of passwords called \"flags" "\" and to submit them on the platform." msgstr "" +"この課題では、参加者は\"フラグ\"と呼ばれるパスワードを見つけて、プラット" +"フォームに送信することになっています。" #: resources/templates/resources/42ctf.html:15 msgid "Functionment of 42CTF" -msgstr "" +msgstr "42CTFの機能紹介" #: resources/templates/resources/42ctf.html:16 msgid "42CTF is what we call a permanent CTF." -msgstr "" +msgstr "42CTFは、いわゆる永続的CTFです。" #: resources/templates/resources/42ctf.html:17 msgid "Except from the" -msgstr "" +msgstr "こちらを除き" #: resources/templates/resources/42ctf.html:17 msgid "events" -msgstr "" +msgstr "(イベント)" #: resources/templates/resources/42ctf.html:17 msgid "challenges are available on the platform without time limitations." -msgstr "" +msgstr "時間制限なしにプラットフォーム上でチャレンジ可能です。" #: resources/templates/resources/42ctf.html:18 msgid "The registration on 42CTF is open to everyone, 42 students or not." -msgstr "" +msgstr "42CTFへの登録は、42の学生であるかどうかに関わらず、誰でも可能です。" #: resources/templates/resources/42ctf.html:19 msgid "" "Events may or may not be open. If you would like to organize an event on " "42CTF, feel free to contact us." msgstr "" +"イベントは開催する場合としない場合があります。42CTFでのイベント開催をご希望の" +"方は、お気軽にお問い合わせください。" #: resources/templates/resources/42ctf.html:22 msgid "42CTF Team" -msgstr "" +msgstr "42CTFチーム" #: resources/templates/resources/42ctf.html:23 msgid "42CTF is managed by 42 students." -msgstr "" +msgstr "42CTFは42の学生によって運営されています。" #: resources/templates/resources/42ctf.html:24 msgid "You can meet the team on" -msgstr "" +msgstr "こちらでチームに会えます:" #: resources/templates/resources/42ctf.html:25 msgid "" "Challenges are created by various contributors, not necessarily 42 students." -msgstr "" +msgstr "課題は42の学生だけではなく、様々な協力者によって作られます。" #: resources/templates/resources/42ctf.html:26 msgid "" "Anyone is welcome to submit their own challenges, either on the permanent " "CTF or for a specific event." msgstr "" +"常設のCTFでも、特定のイベントでも、誰でも自身が作成した課題を提出することがで" +"きます。" #: resources/templates/resources/create_challenge.html:7 msgid "Create new challenges" -msgstr "" +msgstr "新しい課題を作成する" #: resources/templates/resources/create_challenge.html:10 msgid "If you want to create new challenges for 42CTF, send us a message on " msgstr "" +"42CTFの新しい課題を作成したい方は、こちらでメッセージを送ってください:" #: resources/templates/resources/create_challenge.html:11 msgid "If your challenge is offline, then you don't have to ask us in advance." -msgstr "" +msgstr "オフラインでの課題であれば、事前にご相談いただく必要はありません。" #: resources/templates/resources/create_challenge.html:12 msgid "" "If your challenge is online (for example web or pwn), then you should give " "us a short description of what you want to do." msgstr "" +"課題がオンラインの場合(例:webやpwn)、何をしたいのかを簡単に説明してくださ" +"い。" #: resources/templates/resources/create_challenge.html:13 msgid "" "We may be able to help you or to give you resources such as dockerfiles." msgstr "" +"私たちがお手伝いをさせていただいたり、dockerfileなどのリソースを提供させてい" +"ただく場合があります。" #: resources/templates/resources/create_challenge.html:14 msgid "We plan to make those resources publicly available in a near future." -msgstr "" +msgstr "近日、これらのリソースを公開する予定です。" #: resources/templates/resources/donate.html:7 msgid "Donate" -msgstr "" +msgstr "寄付" #: resources/templates/resources/donate.html:10 msgid "Become a 42CTF member" -msgstr "" +msgstr "42CTFのメンバーになる" #: resources/templates/resources/donate.html:11 msgid "" "42CTF is a non-profit organization with a legal status under the french law " "(Association loi 1901)." msgstr "" +"42CTFは、フランスの法律(Association loi 1901)に基づく法的地位を有する非営利" +"団体です。" #: resources/templates/resources/donate.html:12 msgid "You can support us by becoming a member and paying a fee of 15 euros." msgstr "" +"メンバーになって、15ユーロの会費を払うことで、私たちをサポートすることができ" +"ます。" #: resources/templates/resources/donate.html:13 msgid "Membership is then granted for 1 year." -msgstr "" +msgstr "その後、1年間のメンバーシップが付与されます。" #: resources/templates/resources/donate.html:15 msgid "When you become a member, you gain the following advantages:" -msgstr "" +msgstr "会員になると、以下のようなメリットがあります:" #: resources/templates/resources/donate.html:16 msgid "" "A different color for your pseudo in the scoreboard, to let everyone know " "you're a member." msgstr "" +"スコアボードに表示されるアカウント名の色が変わり、メンバーであることが誰にで" +"もわかるように。" #: resources/templates/resources/donate.html:17 msgid "" "The possibility to play again past CTF, with challenges no longer available, " "in the form of private events with the people of your choice." msgstr "" +"チャレンジができなくなった過去のCTFを、好きな人とプライベートイベントの形で再" +"びチャレンジできる可能性。" #: resources/templates/resources/donate.html:18 msgid "" "Ex: you played Welcome CTF 2021, and want to play it again with your friends " "during one weekend." msgstr "" +"例:Welcome CTF 2021 に一度チャレンジして、週末に友達ともう一度チャレンジした" +"いと思っている方。" #: resources/templates/resources/donate.html:19 msgid "Or you didn't play Welcome CTF 2021 because you were not eligible." msgstr "" +"または、Welcome CTF 2021 への参加資格がなかったため、チャレンジできなかった" +"方。" #: resources/templates/resources/donate.html:22 msgid "More advantages may come later, and you can submit us your ideas." msgstr "" +"もっと多くの利点があるかもしれませんし、あなたのアイデアを私たちに提供してい" +"ただくことも可能です。" #: resources/templates/resources/donate.html:23 msgid "" @@ -177,91 +205,105 @@ msgid "" "will be equivalent to organize paid events, and we want 42CTF to remain FREE " "for all." msgstr "" +"しかし、メンバーのみ参加できる期間限定CTFを開催することはありません。これは、" +"有料のイベントを開催することと同義であり、私たちは42CTFがすべての人にとって無" +"料であることを望んでいます。" #: resources/templates/resources/donate.html:26 msgid "Donate to 42CTF" -msgstr "" +msgstr "42CTFに寄付する" #: resources/templates/resources/donate.html:27 msgid "" "You can donate to 42CTF or pay your membership with the following means:" msgstr "" +"42CTFへのご寄付やメンバーシップのお支払いは、以下の手段で行うことができます:" #: resources/templates/resources/donate.html:46 msgid "" "If you would like us to add another payment method or if you want to pay in " "cash, send us a message !" msgstr "" +"他のお支払い方法や現金でのお支払いをご希望の場合は、メッセージをお送りくださ" +"い。" #: resources/templates/resources/donate.html:48 msgid "" "If you're paying for your membership, don't forget to send us your first and " "last name, as well as your 42CTF pseudo." msgstr "" +"メンバーシップをお支払いになる場合は、氏名と42CTFのアカウント名を忘れずにお送" +"りください。" #: resources/templates/resources/donate.html:49 msgid "" "We will only use thoe data to keep track of our members and grant you " "advantages, and we will never communicate them to any third party." msgstr "" +"これらのデータは、メンバーの管理と特典の付与のためにのみ使用し、第三者に提供" +"することはありません。" #: resources/templates/resources/edit.html:7 msgid "Edit this page" -msgstr "" +msgstr "このページの編集" #: resources/templates/resources/edit.html:12 msgid "" "More information coming soon, but as you can guess it involves making a pull " "request to your favorite" msgstr "" +"詳細は近日中にお知らせしますが、お察しの通り、以下にプルリクエストをすること" +"になります:" #: resources/templates/resources/tools.html:7 msgid "Recommended Tools" -msgstr "" +msgstr "おすすめのツール" #: resources/templates/resources/tools.html:10 msgid "To get you started, we built a VM that you can simply import in" -msgstr "" +msgstr "手始めに、Virtual BoxでインストールするだけのVMを構築しました:" #: resources/templates/resources/tools.html:10 msgid "with a bunch of useful tools." -msgstr "" +msgstr "便利なツールを使用しました。" #: resources/templates/resources/tools.html:11 msgid "You can dowload this OVA" -msgstr "" +msgstr "このOVAはこちらからダウンロードできます:" #: resources/templates/resources/tools.html:11 msgid "here" -msgstr "" +msgstr "こちら" #: resources/templates/resources/tools.html:13 msgid "Here are the tools installed on the VM:" -msgstr "" +msgstr "以下に、VMにインストールされたツールを紹介します:" #: resources/templates/resources/tools.html:22 msgid "" "If you want to solve the challenges on your own machine, we recommend you to " "use a Linux operating system." msgstr "" +"自分のマシンで課題にチャレンジしたい場合は、Linux OSを使用することをお勧めし" +"ます。" #: resources/templates/resources/tools.html:23 msgid "" "Most of the reverse challenges are ELF binaries and won't run on Mac OS or " "Windows." -msgstr "" +msgstr "ReversingのほとんどはELFバイナリで、Mac OSやWindowsでは動作しません。" #: resources/templates/resources/tools.html:25 msgid "Additionnaly, you will need the following languages interpreters:" -msgstr "" +msgstr "さらに、以下の言語のインタプリタが必要です。" #: resources/templates/resources/translate.html:7 msgid "Translate 42CTF" -msgstr "" +msgstr "42CTFを翻訳" #: resources/templates/resources/translate.html:10 msgid "42CTF source code is publicly available on this" -msgstr "" +msgstr "42CTFのソースコードはこのサイトで公開されています。:" #: resources/templates/resources/translate.html:11 msgid "" @@ -269,21 +311,27 @@ msgid "" "contribute if you want to help us, by making the platform always more " "accessible." msgstr "" +"翻訳にはプログラミングのスキルは必要ありません。プラットフォームをより使いや" +"すくすることで、私たちに貢献したいとお考えの方には良い方法です。" #: resources/templates/resources/translate.html:12 msgid "We have a" -msgstr "" +msgstr "こちらがあります。:" #: resources/templates/resources/translate.html:12 msgid "" "describing how to translate pages with the Django internalization module." msgstr "" +"djangoのinternalizationモジュールを使ってページを翻訳する方法を説明したもので" +"す。" #: resources/templates/resources/translate.html:13 msgid "" "We invite you to read it to know all the details, but it merely requires you " "to edit text files, so you see, no programming skills required ;)" msgstr "" +"詳細はぜひ読んでいただきたいのですが、単にテキストファイルを編集するだけなの" +"で、プログラミングのスキルは必要ありません ;)" #: resources/templates/resources/translate.html:14 msgid "" @@ -291,7 +339,10 @@ msgid "" "then open a pull request so that we can merge your contributions into our " "repository." msgstr "" +"gitリポジトリをフォークしていただき、変更を加えてプッシュし、プルリクエストを" +"作成していただくことで、皆さんの貢献を私たちのリポジトリにマージすることがで" +"きます。" #: resources/templates/resources/translate.html:15 msgid "Don't hesitate to reach for help on" -msgstr "" +msgstr "躊躇せずに、こちらで助けを求めてください。:" -- 2.40.1 From 7b2de062250bd392bb381b4c6b964c592eb4176f Mon Sep 17 00:00:00 2001 From: ysaito Date: Fri, 18 Feb 2022 22:48:26 +0900 Subject: [PATCH 13/13] refactor(news/ja/): Corrected the translation of a word --- src/home/templates/news/ja/dynamic_scoring.html | 2 +- src/home/templates/news/ja/sql_challenges.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/home/templates/news/ja/dynamic_scoring.html b/src/home/templates/news/ja/dynamic_scoring.html index 8bd5358..4ff777b 100644 --- a/src/home/templates/news/ja/dynamic_scoring.html +++ b/src/home/templates/news/ja/dynamic_scoring.html @@ -4,4 +4,4 @@ チャレンジポイントは200から始まり、5より低くなることはありません。

-これにより、チャレンジの実際の難易度をより良く反映できるようになると期待しています。期間限定イベントは、この変更の影響は受けません。 \ No newline at end of file +これにより、課題の実際の難易度をより良く反映できるようになると期待しています。期間限定イベントは、この変更の影響は受けません。 \ No newline at end of file diff --git a/src/home/templates/news/ja/sql_challenges.html b/src/home/templates/news/ja/sql_challenges.html index 01a5eb2..cf2881a 100644 --- a/src/home/templates/news/ja/sql_challenges.html +++ b/src/home/templates/news/ja/sql_challenges.html @@ -1,8 +1,8 @@ SQLインジェクションについて学びたいと思ったことはありませんか?

-aldubarが作成した全く新しい3つのチャレンジを提供します。
+aldubarが作成した全く新しい3つの課題を提供します。
- Simple Question of Logic 1 (10 points)
- Simple Question of Logic 2 (30 points)
- Simple Question of Logic 3 (40 points)

-新しいチャレンジを提案するために、へいつでも連絡できることを忘れないでください! \ No newline at end of file +新しい課題を提案するために、へいつでも連絡できることを忘れないでください! \ No newline at end of file -- 2.40.1