<commit_before>
request = require 'request'

options =
    headers:
      'User-Agent': 'request'
    url: 'https://api.github.com/repos/yakyak/yakyak/releases/latest'

versionToInt = (version) ->
    [major, minor, micro] = version.split('.')
    version = (micro * Math.pow(10,4)) + (minor * Math.pow(10,8)) + (major * Math.pow(10,12))

check = ()->
    request.get options,  (err, res, body) ->
        return console.log err if err
        body = JSON.parse body
        tag = body.tag_name
        releasedVersion = tag?.substr(1) # remove first "v" char
        localVersion = require('electron').remote.require('electron').app.getVersion()
        versionAdvertised = window.localStorage.versionAdvertised or null
        console.log('released', releasedVersion, releasedVersion.split('.'), versionToInt(releasedVersion))
        console.log('local', localVersion, localVersion.split('.'), versionToInt(localVersion))
        if releasedVersion? && localVersion?
            higherVersionAvailable = versionToInt(releasedVersion) > versionToInt(localVersion)
            if higherVersionAvailable and (releasedVersion isnt versionAdvertised)
                window.localStorage.versionAdvertised = releasedVersion
                notr {
                    html: "A new YakYak version is available<br/>Please upgrade #{localVersion} to #{releasedVersion}<br/><i style=\"font-size: .9em; color: gray\">(click to dismiss)</i>",
                    stay: 0
                }
            console.log "YakYak local version is #{localVersion}, released version is #{releasedVersion}"

module.exports = {check, versionToInt}<commit_msg>removes debuging<commit_after>
request = require 'request'

options =
    headers:
      'User-Agent': 'request'
    url: 'https://api.github.com/repos/yakyak/yakyak/releases/latest'

versionToInt = (version) ->
    [major, minor, micro] = version.split('.')
    version = (micro * Math.pow(10,4)) + (minor * Math.pow(10,8)) + (major * Math.pow(10,12))

check = ()->
    request.get options,  (err, res, body) ->
        return console.log err if err
        body = JSON.parse body
        tag = body.tag_name
        releasedVersion = tag?.substr(1) # remove first "v" char
        localVersion = require('electron').remote.require('electron').app.getVersion()
        versionAdvertised = window.localStorage.versionAdvertised or null
        if releasedVersion? && localVersion?
            higherVersionAvailable = versionToInt(releasedVersion) > versionToInt(localVersion)
            if higherVersionAvailable and (releasedVersion isnt versionAdvertised)
                window.localStorage.versionAdvertised = releasedVersion
                notr {
                    html: "A new YakYak version is available<br/>Please upgrade #{localVersion} to #{releasedVersion}<br/><i style=\"font-size: .9em; color: gray\">(click to dismiss)</i>",
                    stay: 0
                }
            console.log "YakYak local version is #{localVersion}, released version is #{releasedVersion}"

module.exports = {check, versionToInt}
{'fraction_non_alphanumeric': 0.12569195701725822, 'fraction_numerical': 0.008466297622924128, 'mean_word_length': 2.928388746803069, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '315957', 'n_tokens_mistral': 886, 'n_tokens_neox': 842, 'n_words': 204}