<commit_before>/*
    Agora Forum Software
    Copyright (C) 2016 <NAME>
    License: AGPL-3.0, Check file LICENSE
*/

Router.onBeforeAction(function() {
    if (Meteor.user() && Meteor.user().isBanned) {
        return this.render('forbidden');
    } else {
        return this.next();
    }
});

Router.route('/admin', {
    name: 'Admin Screen',
    template: 'adminScreen'
});

Router.route('/@:handle', function() {
    var handle = this.params.handle;

    if (!handle) handle = Meteor.userId();

    let id = Meteor.absoluteUrl() + "actors/" + handle;

    if (this.ready()) {
        if (handle) this.render('userProfile', {data: {id: id}});
        else this.render('errorPage', {data: {_id: id}});
    }
});

Router.route('/user', function() {
    var id = Meteor.userId();

    if (this.ready()) {
        if (id) this.render('userProfile', {data: {id: id}});
        else this.render('errorPage', {data: {_id: id}});
    }
});

Router.route('/users', {
    name: 'userList',
    template: 'userList'
});

Router.route('/federation', {
    name: 'federation',
    template: 'federation'
});

Router.route('/forum', {

    onRun: function() {
        var id = this.params.query.post;

        if (id && this.ready()) {
            this.state.set("postID", id);
        }
        this.next();
    },
    action: function() {
        if (this.ready()) {
            this.render('forum');
        } else this.render('errorPage', {data: {_id: id}});
    }
});

/*Router.route('/search/:_id', function() {
    var id = this.params._id;

    if (this.ready()) {
        var tag = Tags.findOne({_id: id});
        if (tag) this.render('search', {data: tag});
        else this.render('errorPage', {data: {_id: id}});
    }
});*/
<commit_msg>tidy up routes to user profiles<commit_after>/*
    Agora Forum Software
    Copyright (C) 2016 <NAME>
    License: AGPL-3.0, Check file LICENSE
*/

Router.onBeforeAction(function() {
    if (Meteor.user() && Meteor.user().isBanned) {
        return this.render('forbidden');
    } else {
        return this.next();
    }
});

Router.route('/admin', {
    name: 'Admin Screen',
    template: 'adminScreen'
});

Router.route('/@:handle', {
    template: 'userProfile',
    data: function() {
        var handle = this.params.handle;

        if (!handle) handle = Meteor.userId();

        let id = Meteor.absoluteUrl() + "actors/" + handle;

        return {id: id};
    }
});

Router.route('/user', function() {
    var id = Meteor.user().actor;

    if (this.ready()) {
        if (id) this.render('userProfile', {data: {id: id}});
        else this.render('errorPage', {data: {_id: id}});
    }
});

Router.route('/users', {
    name: 'userList',
    template: 'userList'
});

Router.route('/federation', {
    name: 'federation',
    template: 'federation'
});

Router.route('/forum', {

    onRun: function() {
        var id = this.params.query.post;

        if (id && this.ready()) {
            this.state.set("postID", id);
        }
        this.next();
    },
    action: function() {
        if (this.ready()) {
            this.render('forum');
        } else this.render('errorPage', {data: {_id: id}});
    }
});

/*Router.route('/search/:_id', function() {
    var id = this.params._id;

    if (this.ready()) {
        var tag = Tags.findOne({_id: id});
        if (tag) this.render('search', {data: tag});
        else this.render('errorPage', {data: {_id: id}});
    }
});*/

{'fraction_non_alphanumeric': 0.20087209302325582, 'fraction_numerical': 0.0034883720930232558, 'mean_word_length': 2.4652567975830815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '160782', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1145, 'n_words': 250}