<commit_before>import Vapor
import Fluent
import LeafMarkdown
import Auth
import Paginator

/**
    A Blog engine for Vapor. Simply initialise an instance of `SteamPress` and it will do the rest for you!
    You will need to ensure that the views it is expecting are available though. See https://github.com/brokenhandsio/SteamPress for full documentation.
 */
public struct SteamPress {
    
    fileprivate let blogPath: String?
    fileprivate let blogController: BlogController
    fileprivate let blogAdminController: BlogAdminController
    
    /**
        Initialiser for SteamPress to add a blog to your Vapor App. You can pass it an optional `blogPath` to add the blog to. For instance, if you pass in "blog", your blog will be accessible at http://mysite.com/blog/, or if you pass in `nil` your blog will be added to the root of your site (i.e. http://mysite.com/)
     
        - Parameter drop: The droplet to add the blog too
        - Parameter blogPath: The path to add the blog too
     */
    public init(drop: Droplet, blogPath: String? = nil) {
        self.blogPath = blogPath
        
        // Database preperations
        drop.preparations.append(BlogPost.self)
        drop.preparations.append(BlogUser.self)
        drop.preparations.append(BlogTag.self)
        drop.preparations.append(Pivot<BlogPost, BlogTag>.self)
        
        // Middleware
        let authMiddleware = AuthMiddleware<BlogUser>()
        drop.middleware.append(authMiddleware)
        
        // Providers
        let paginator = PaginatorProvider(useBootstrap4: true, paginationLabel: "Blog Post Pages")
        drop.addProvider(paginator)
        
        // Set up Leaf tag
        if let leaf = drop.view as? LeafRenderer {<commit_msg>Use our custom AuthMiddleware for remember me<commit_after>import Vapor
import Fluent
import LeafMarkdown
import Auth
import Paginator

/**
    A Blog engine for Vapor. Simply initialise an instance of `SteamPress` and it will do the rest for you!
    You will need to ensure that the views it is expecting are available though. See https://github.com/brokenhandsio/SteamPress for full documentation.
 */
public struct SteamPress {
    
    fileprivate let blogPath: String?
    fileprivate let blogController: BlogController
    fileprivate let blogAdminController: BlogAdminController
    
    /**
        Initialiser for SteamPress to add a blog to your Vapor App. You can pass it an optional `blogPath` to add the blog to. For instance, if you pass in "blog", your blog will be accessible at http://mysite.com/blog/, or if you pass in `nil` your blog will be added to the root of your site (i.e. http://mysite.com/)
     
        - Parameter drop: The droplet to add the blog too
        - Parameter blogPath: The path to add the blog too
     */
    public init(drop: Droplet, blogPath: String? = nil) {
        self.blogPath = blogPath
        
        // Database preperations
        drop.preparations.append(BlogPost.self)
        drop.preparations.append(BlogUser.self)
        drop.preparations.append(BlogTag.self)
        drop.preparations.append(Pivot<BlogPost, BlogTag>.self)
        
        // Middleware
        let authMiddleware = BlogAuthMiddleware()
        drop.middleware.append(authMiddleware)
        
        // Providers
        let paginator = PaginatorProvider(useBootstrap4: true, paginationLabel: "Blog Post Pages")
        drop.addProvider(paginator)
        
        // Set up Leaf tag
        if let leaf = drop.view as? LeafRenderer {
{'fraction_non_alphanumeric': 0.07057484348321001, 'fraction_numerical': 0.0005691519635742744, 'mean_word_length': 2.7195767195767195, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, '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': '7230159', 'n_tokens_mistral': 961, 'n_tokens_neox': 936, 'n_words': 360}