<commit_before>const nest = require('depnest')
const h = require('mutant/h')
const blobFiles = require('ssb-blob-files')

module.exports = {
  gives: nest('blob.html.input', true),
  needs: nest({
    'sbot.obs.connection': 'first'
  }),
  create: function (api) {
    return nest('blob.html.input', FileInput)

    function FileInput (onAdded, opts = {}) {
      const { accept, private: isPrivate, removeExif: stripExif, resize, quality, multiple, maxSize } = opts

      return h('input', {
        type: 'file',
        accept,
        multiple,
        'ev-change': handleEvent
      })

      function handleEvent (ev) {
        const opts = { isPrivate, stripExif, resize, quality, maxSize: maxSize || 5 * 1024 * 1024 }
        blobFiles(ev.target.files, api.sbot.obs.connection, opts, (err, result) => {
          // error is returned if file is too big
          onAdded(err, result) // { link, name, size, type }
          ev.target.value = ''
        })
      }
    }
  }
}<commit_msg>Fix EXIF stripping via message compose input button<commit_after>const nest = require('depnest')
const h = require('mutant/h')
const blobFiles = require('ssb-blob-files')

module.exports = {
  gives: nest('blob.html.input', true),
  needs: nest({
    'sbot.obs.connection': 'first'
  }),
  create: function (api) {
    return nest('blob.html.input', FileInput)

    function FileInput (onAdded, opts = {}) {
      const { accept, private: isPrivate, stripExif = true, resize, quality, multiple, maxSize } = opts

      return h('input', {
        type: 'file',
        accept,
        multiple,
        'ev-change': handleEvent
      })

      function handleEvent (ev) {
        const opts = { isPrivate, stripExif, resize, quality, maxSize: maxSize || 5 * 1024 * 1024 }
        blobFiles(ev.target.files, api.sbot.obs.connection, opts, (err, result) => {
          // error is returned if file is too big
          onAdded(err, result) // { link, name, size, type }
          ev.target.value = ''
        })
      }
    }
  }
}
{'fraction_non_alphanumeric': 0.14320987654320988, 'fraction_numerical': 0.008888888888888889, 'mean_word_length': 2.5357766143106457, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7218042', 'n_tokens_mistral': 649, 'n_tokens_neox': 617, 'n_words': 167}