mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-08 19:35:11 +01:00
generate a smaller json to fix the sheet coordinates
This commit is contained in:
parent
1d3ca71044
commit
0ceff0262d
@ -63,7 +63,7 @@ docker-compose.override.yml
|
||||
|
||||
# Ignore emoji map file
|
||||
/app/javascript/mastodon/features/emoji/emoji_map.json
|
||||
/app/javascript/mastodon/features/emoji/emoji_data.json
|
||||
/app/javascript/mastodon/features/emoji/emoji_sheet.json
|
||||
|
||||
# Ignore locale files
|
||||
/app/javascript/mastodon/locales/*.json
|
||||
|
@ -17,10 +17,11 @@ const emojiMart5Data = require('@emoji-mart/data/sets/15/all.json');
|
||||
const { uncompress: emojiMartUncompress } = require('emoji-mart/dist/utils/data');
|
||||
const _ = require('lodash');
|
||||
|
||||
|
||||
const emojiMap = require('./emoji_map.json');
|
||||
// This json file is downloaded from https://github.com/iamcal/emoji-data/
|
||||
// and is used to correct the sheet coordinates since we're using that repo's sheet
|
||||
const emojiDataJson = require('./emoji_data.json');
|
||||
const emojiMap = require('./emoji_map.json');
|
||||
const emojiDataJson = require('./emoji_sheet.json');
|
||||
const { unicodeToFilename } = require('./unicode_to_filename');
|
||||
const { unicodeToUnifiedName } = require('./unicode_to_unified_name');
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
1
app/javascript/mastodon/features/emoji/emoji_sheet.json
Normal file
1
app/javascript/mastodon/features/emoji/emoji_sheet.json
Normal file
File diff suppressed because one or more lines are too long
@ -104,14 +104,35 @@ namespace :emojis do
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Download the JSON definition of emojis'
|
||||
task :download_json do
|
||||
desc 'Download the JSON sheet data of emojis'
|
||||
task :download_sheet_json do
|
||||
source = 'https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v15.1.2/emoji.json'
|
||||
dest = Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_data.json')
|
||||
dest = Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_sheet.json')
|
||||
|
||||
puts "Downloading emojos data from source... (#{source})"
|
||||
puts "Downloading emoji data from source... (#{source})"
|
||||
|
||||
res = HTTP.get(source).to_s
|
||||
File.write(dest, res)
|
||||
data = JSON.parse(res)
|
||||
|
||||
filtered_data = data.map do |emoji|
|
||||
filtered_item = {
|
||||
'unified' => emoji['unified'],
|
||||
'sheet_x' => emoji['sheet_x'],
|
||||
'sheet_y' => emoji['sheet_y'],
|
||||
'skin_variations' => {},
|
||||
}
|
||||
|
||||
emoji['skin_variations']&.each do |key, variation|
|
||||
filtered_item['skin_variations'][key] = {
|
||||
'unified' => variation['unified'],
|
||||
'sheet_x' => variation['sheet_x'],
|
||||
'sheet_y' => variation['sheet_y'],
|
||||
}
|
||||
end
|
||||
|
||||
filtered_item
|
||||
end
|
||||
|
||||
File.write(dest, JSON.generate(filtered_data))
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user