aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js41
1 files changed, 2 insertions, 39 deletions
diff --git a/lib/serve.js b/lib/serve.js
index d292158..c7065bc 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -6,7 +6,6 @@ var paramap = require('pull-paramap')
var sort = require('ssb-sort')
var crypto = require('crypto')
var toPull = require('stream-to-pull-stream')
-var serveEmoji = require('emoji-server')()
var u = require('./util')
var cat = require('pull-cat')
var h = require('hyperscript')
@@ -19,7 +18,6 @@ var mime = require('mime-types')
var ident = require('pull-identify-filetype')
var htime = require('human-time')
var ph = require('pull-hyperscript')
-var emojis = require('emoji-named-characters')
var jpeg = require('jpeg-autorotate')
var Catch = require('pull-catch')
var Diff = require('diff')
@@ -30,7 +28,6 @@ var Url = require('url')
module.exports = Serve
-var emojiDir = path.join(require.resolve('emoji-named-characters'), '../pngs')
var hlCssDir = path.join(require.resolve('highlight.js'), '../../styles')
var urlIdRegex = /^(?:\/+(([%&@]|%25|%26)(?:[A-Za-z0-9\/+]|%2[Ff]|%2[Bb]){43}(?:=|%3D)\.(?:sha256|ed25519))([^?]*)?|(\/.*?))(?:\?(.*))?$/
@@ -539,7 +536,6 @@ Serve.prototype.path = function (url) {
case '/type': return this.type(m[2])
case '/links': return this.links(m[2])
case '/static': return this.static(m[2])
- case '/emoji': return this.emoji(m[2])
case '/highlight': return this.highlight(m[2])
case '/contacts': return this.contacts(m[2])
case '/about': return this.about(m[2])
@@ -2066,10 +2062,6 @@ Serve.prototype.static = function (file) {
this.file(path.join(__dirname, '../static', file))
}
-Serve.prototype.emoji = function (emoji) {
- serveEmoji(this.req, this.res, emoji)
-}
-
Serve.prototype.highlight = function (dirs) {
this.file(path.join(hlCssDir, dirs))
}
@@ -4345,12 +4337,6 @@ Serve.prototype.composer = function (opts, cb) {
var id = formEmojiNames[name]
if (id) return {name: name, id: id}
// 2. TODO: check user's preferred emoji-image mapping
- // 3. check builtin emoji
- var link = self.getBuiltinEmojiLink(name)
- if (link) {
- return {name: name, id: link.link}
- blobs[id] = {type: link.type, size: link.size}
- }
// 4. check recently seen emoji
id = self.app.getReverseEmojiNameSync(name)
return {name: name, id: id}
@@ -4529,15 +4515,8 @@ Serve.prototype.composer = function (opts, cb) {
if (mention.emoji) {
mention.link = formEmojiNames[mention.name]
if (!mention.link) {
- var link = self.getBuiltinEmojiLink(mention.name)
- if (link) {
- mention.link = link.link
- mention.size = link.size
- mention.type = link.type
- } else {
- mention.link = self.app.getReverseEmojiNameSync(mention.name)
- if (!mention.link) return false
- }
+ mention.link = self.app.getReverseEmojiNameSync(mention.name)
+ if (!mention.link) return false
}
}
var blob = blobs[mention.link]
@@ -4887,22 +4866,6 @@ function hashBuf(buf) {
return '&' + hash.digest('base64') + '.sha256'
}
-Serve.prototype.getBuiltinEmojiLink = function (name) {
- if (!(name in emojis)) return
- var file = path.join(emojiDir, name + '.png')
- var fileBuf = fs.readFileSync(file)
- var id = hashBuf(fileBuf)
- // seed the builtin emoji
- pull(pull.once(fileBuf), this.app.sbot.blobs.add(id, function (err) {
- if (err) console.error('error adding builtin emoji as blob', err)
- }))
- return {
- link: id,
- type: 'image/png',
- size: fileBuf.length,
- }
-}
-
Serve.prototype.getMsgDecryptedMaybeOoo = function (key, cb) {
var self = this
if (this.useOoo) this.app.getMsgDecryptedOoo(key, next)