<commit_before>#+--------------------------------------------------------------------+
#| demo.coffee
#+--------------------------------------------------------------------+
#| Copyright DarkOverlordOfData (c) 2014
#+--------------------------------------------------------------------+
#|
#| This file is a part of Frodo
#|
#| Frodo is free software you can copy, modify, and distribute
#| it under the terms of the MIT License
#|
#+--------------------------------------------------------------------+
#
#	Demo
#

muninn = require('muninn')


class FbDemo extends muninn.core.Controller

  graph = require('fbgraph')

  @routes =
    '/demo':            'indexAction'
    '/login/callback':  'authAction'
    '/logout':          'logoutAction'
    '/loggedin':        'loginAction'


  #
  # indexAction
  #
  # @return [None]
  #
  indexAction: ->

    @res.render 'demo/index',
      title: 'Express',
      loginUrl: muninn.config.fb.redirectUri


  #
  # authAction
  #
  # @return [None]
  #
  authAction: ->

    if not @req.query.code

      authUrl = graph.getOauthUrl
        client_id:     muninn.config.fb.appId
        redirect_uri:  muninn.config.fb.redirectUri
        scope:         'user_about_me'
        response_type:  'code'

      authUrl = authUrl.replace(/$http:/, 'https:')
      console.log '=================================================='
      console.log authUrl
      console.log '=================================================='

      if not @req.query.error # checks whether a user denied the app facebook login/permissions
        console.log 'redirect '+authUrl
        @res.redirect authUrl
      else # req.query.error == 'access_denied'
        console.log 'access denied'
        @res.send 'access denied'
      return

    graph.authorize
      client_id:      muninn.config.fb.appId<commit_msg>testing auth<commit_after>#+--------------------------------------------------------------------+
#| demo.coffee
#+--------------------------------------------------------------------+
#| Copyright DarkOverlordOfData (c) 2014
#+--------------------------------------------------------------------+
#|
#| This file is a part of Frodo
#|
#| Frodo is free software you can copy, modify, and distribute
#| it under the terms of the MIT License
#|
#+--------------------------------------------------------------------+
#
#	Demo
#

muninn = require('muninn')


class FbDemo extends muninn.core.Controller

  graph = require('fbgraph')

  @routes =
    '/demo':            'indexAction'
    '/login/callback':  'authAction'
    '/logout':          'logoutAction'
    '/loggedin':        'loginAction'


  #
  # indexAction
  #
  # @return [None]
  #
  indexAction: ->

    @res.render 'demo/index',
      title: 'Express',
      loginUrl: muninn.config.fb.redirectUri


  #
  # authAction
  #
  # @return [None]
  #
  authAction: ->

    if not @req.query.code

      authUrl = graph.getOauthUrl
        client_id:     muninn.config.fb.appId
        redirect_uri:  muninn.config.fb.redirectUri
        scope:         'user_about_me'
        response_type:  'code'

      authUrl = authUrl.replace('http:', 'https:')
      console.log '=================================================='
      console.log authUrl
      console.log '=================================================='

      if not @req.query.error # checks whether a user denied the app facebook login/permissions
        console.log 'redirect '+authUrl
        @res.redirect authUrl
      else # req.query.error == 'access_denied'
        console.log 'access denied'
        @res.send 'access denied'
      return

    graph.authorize
      client_id:      muninn.config.fb.appId
{'fraction_non_alphanumeric': 0.3004885993485342, 'fraction_numerical': 0.002171552660152009, 'mean_word_length': 1.591420534458509, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6118864', 'n_tokens_mistral': 1039, 'n_tokens_neox': 974, 'n_words': 226}