<commit_before>from django.views.decorators.clickjacking import xframe_options_exempt

from annoying.decorators import render_to, ajax_request
from django.contrib.auth.models import User
from django.db.models import Q
from common.view_helpers import JSONResponse
from api.models import ChatMessage, EyeHistory
from common.templatetags.gravatar import gravatar_for_user

from django.utils import timezone
import datetime
from django.db.models.aggregates import Sum
from common.templatetags.filters import url_domain
from api.utils import humanize_time
from django.contrib.auth.views import redirect_to_login
from django.views.generic.simple import redirect_to

@xframe_options_exempt
@render_to("extension/track_prompt.html")
def prompt(request):
    site = request.GET.get("site", '')
    return {
        'site' : site
    }

@xframe_options_exempt
@render_to("extension/login_prompt.html")
def login(request):
    src = request.GET.get("src", "chrome")
    return {
        'src' : src
    }
    
@ajax_request 
def profilepic(request):
    return redirect_to(request, gravatar_for_user(request.user));
    
@ajax_request
def active(request):
    url = request.GET.get("url", '')
    
    domain = url_domain(url)
    
    my_user = request.user

    timestamp =  timezone.now() - datetime.timedelta(minutes=5)

    active_users = User.objects.filter(eyehistory__url=url, eyehistory__start_time__gt=timestamp).select_related().distinct()

    active_dusers = User.objects.filter(eyehistory__domain=domain, eyehistory__start_time__gt=timestamp).select_related().distinct()

    res = []
    
    for user in active_users:
        if user != my_user:
            res.append({'username': user.username,
                        'pic_url': gravatar_for_user(user),
                        'resourceURI': '/api/v1/user/%s/' % user.username,
                        })
            
    dres = []
    
    for user in active_dusers:
        if user != my_user and user not in active_users:
            dres.append({'username': user.username,
                        'pic_url': gravatar_for_user(user),
                        'resourceURI': '/api/v1/user/%s/' % user.username,
                        })
    <commit_msg>open window to 30 minutes<commit_after>from django.views.decorators.clickjacking import xframe_options_exempt

from annoying.decorators import render_to, ajax_request
from django.contrib.auth.models import User
from django.db.models import Q
from common.view_helpers import JSONResponse
from api.models import ChatMessage, EyeHistory
from common.templatetags.gravatar import gravatar_for_user

from django.utils import timezone
import datetime
from django.db.models.aggregates import Sum
from common.templatetags.filters import url_domain
from api.utils import humanize_time
from django.contrib.auth.views import redirect_to_login
from django.views.generic.simple import redirect_to

@xframe_options_exempt
@render_to("extension/track_prompt.html")
def prompt(request):
    site = request.GET.get("site", '')
    return {
        'site' : site
    }

@xframe_options_exempt
@render_to("extension/login_prompt.html")
def login(request):
    src = request.GET.get("src", "chrome")
    return {
        'src' : src
    }
    
@ajax_request 
def profilepic(request):
    return redirect_to(request, gravatar_for_user(request.user));
    
@ajax_request
def active(request):
    url = request.GET.get("url", '')
    
    domain = url_domain(url)
    
    my_user = request.user

    timestamp =  timezone.now() - datetime.timedelta(minutes=30)

    active_users = User.objects.filter(eyehistory__url=url, eyehistory__start_time__gt=timestamp).select_related().distinct()

    active_dusers = User.objects.filter(eyehistory__domain=domain, eyehistory__start_time__gt=timestamp).select_related().distinct()

    res = []
    
    for user in active_users:
        if user != my_user:
            res.append({'username': user.username,
                        'pic_url': gravatar_for_user(user),
                        'resourceURI': '/api/v1/user/%s/' % user.username,
                        })
            
    dres = []
    
    for user in active_dusers:
        if user != my_user and user not in active_users:
            dres.append({'username': user.username,
                        'pic_url': gravatar_for_user(user),
                        'resourceURI': '/api/v1/user/%s/' % user.username,
                        })
    
{'fraction_non_alphanumeric': 0.10087818058995722, 'fraction_numerical': 0.002026570592208962, 'mean_word_length': 3.012646793134598, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2802982', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1300, 'n_words': 272}