diff --git a/content.py b/content.py
index 08363ec1a..9b7e462fc 100644
--- a/content.py
+++ b/content.py
@@ -322,6 +322,80 @@ def _save_custom_emoji(session, base_dir: str, emojiName: str, url: str,
print('EX: cusom emoji already saved')
+def _get_emoji_name_from_code(base_dir: str, emoji_code: str) -> str:
+ """Returns the emoji name from its code
+ """
+ emojis_filename = base_dir + '/emoji/emoji.json'
+ if not os.path.isfile(emojis_filename):
+ emojis_filename = base_dir + '/emoji/default_emoji.json'
+ if not os.path.isfile(emojis_filename):
+ return None
+ emojis_json = load_json(emojis_filename)
+ if not emojis_json:
+ return None
+ for emoji_name, code in emojis_json.items():
+ if code == emoji_code:
+ return emoji_name
+ return None
+
+
+def _update_common_emoji(base_dir: str, emoji_content: str) -> None:
+ """Updates the list of commonly used emoji
+ """
+ if '.' in emoji_content:
+ emoji_content = emoji_content.split('.')[0]
+ emoji_content = emoji_content.replace(':', '')
+ if emoji_content.startswith('0x'):
+ # lookup the name for an emoji code
+ emoji_code = emoji_content[2:]
+ emoji_content = _get_emoji_name_from_code(base_dir, emoji_code)
+ if not emoji_content:
+ return
+ common_emoji_filename = base_dir + '/accounts/common_emoji.txt'
+ common_emoji = None
+ if os.path.isfile(common_emoji_filename):
+ try:
+ with open(common_emoji_filename, 'r') as fp_emoji:
+ common_emoji = fp_emoji.readlines()
+ except OSError:
+ print('EX: unable to load common emoji file')
+ pass
+ if common_emoji:
+ new_common_emoji = []
+ emoji_found = False
+ for line in common_emoji:
+ if ' ' + emoji_content in line:
+ if not emoji_found:
+ emoji_found = True
+ counter = 1
+ count_str = line.split(' ')[0]
+ if count_str.isdigit():
+ counter = int(count_str) + 1
+ count_str = str(counter).zfill(16)
+ line = count_str + ' ' + emoji_content
+ new_common_emoji.append(line)
+ else:
+ new_common_emoji.append(line.replace('\n', ''))
+ if not emoji_found:
+ new_common_emoji.append(str(1).zfill(16) + ' ' + emoji_content)
+ new_common_emoji.sort(reverse=True)
+ try:
+ with open(common_emoji_filename, 'w+') as fp_emoji:
+ for line in new_common_emoji:
+ fp_emoji.write(line + '\n')
+ except OSError:
+ print('EX: error writing common emoji 1')
+ return
+ else:
+ line = str(1).zfill(16) + ' ' + emoji_content + '\n'
+ try:
+ with open(common_emoji_filename, 'w+') as fp_emoji:
+ fp_emoji.write(line)
+ except OSError:
+ print('EX: error writing common emoji 2')
+ return
+
+
def replace_emoji_from_tags(session, base_dir: str,
content: str, tag: [], message_type: str,
debug: bool) -> str:
@@ -370,6 +444,11 @@ def replace_emoji_from_tags(session, base_dir: str,
tag_item['name'],
tag_item['icon']['url'],
debug)
+ _update_common_emoji(base_dir,
+ icon_name)
+ else:
+ _update_common_emoji(base_dir,
+ "0x" + icon_name)
else:
# sequence of codes
icon_codes = icon_name.split('-')
@@ -394,6 +473,11 @@ def replace_emoji_from_tags(session, base_dir: str,
tag_item['name'],
tag_item['icon']['url'],
debug)
+ _update_common_emoji(base_dir,
+ icon_name)
+ else:
+ _update_common_emoji(base_dir,
+ "0x" + icon_name)
if icon_code_sequence:
content = content.replace(tag_item['name'],
icon_code_sequence)
diff --git a/daemon.py b/daemon.py
index f2693d88c..c5e029fce 100644
--- a/daemon.py
+++ b/daemon.py
@@ -1717,7 +1717,7 @@ class PubServer(BaseHTTPRequestHandler):
if not isinstance(message_json['object'][check_field], str):
print('INBOX: ' +
check_field + ' should be a string ' +
- str(message_json[check_field]))
+ str(message_json['object'][check_field]))
self._400()
self.server.postreq_busy = False
return 3
@@ -1731,7 +1731,7 @@ class PubServer(BaseHTTPRequestHandler):
if not isinstance(message_json['object'][check_field], list):
print('INBOX: ' +
check_field + ' should be a list ' +
- str(message_json[check_field]))
+ str(message_json['object'][check_field]))
self._400()
self.server.postreq_busy = False
return 3
diff --git a/epicyon-follow.css b/epicyon-follow.css
index bcb4a7024..bfbbe808d 100644
--- a/epicyon-follow.css
+++ b/epicyon-follow.css
@@ -114,6 +114,10 @@ a:focus {
background-color: var(--main-bg-color);
}
+.follow container {
+ width: 100%;
+}
+
.followAvatar {
margin: 0% 0;
}
@@ -201,12 +205,24 @@ input[type=text] {
width: 15%;
}
+.container {
+ width: 100%;
+}
+
@media screen and (min-width: 400px) {
.hashtagswarm {
font-size: var(--hashtag-size1);
font-family: Arial, Helvetica, sans-serif;
margin: var(--hashtag-margin);
line-height: var(--hashtag-vertical-spacing1);
+ -webkit-user-select: all;
+ -ms-user-select: all;
+ user-select: all;
+ white-space: nowrap;
+ }
+ .hashtagswarm img {
+ width: 5%;
+ min-width: 5%;
}
.followText {
font-size: var(--follow-text-size1);
@@ -238,13 +254,13 @@ input[type=text] {
}
input[type=checkbox]
{
- -ms-transform: scale(2);
- -moz-transform: scale(2);
- -webkit-transform: scale(2);
- -o-transform: scale(2);
- transform: scale(2);
- padding: 10px;
- margin: 20px 30px;
+ -ms-transform: scale(2);
+ -moz-transform: scale(2);
+ -webkit-transform: scale(2);
+ -o-transform: scale(2);
+ transform: scale(2);
+ padding: 10px;
+ margin: 20px 30px;
}
}
@@ -254,6 +270,14 @@ input[type=text] {
font-family: Arial, Helvetica, sans-serif;
margin: var(--hashtag-margin);
line-height: var(--hashtag-vertical-spacing3);
+ -webkit-user-select: all;
+ -ms-user-select: all;
+ user-select: all;
+ white-space: nowrap;
+ }
+ .hashtagswarm img {
+ width: 10%;
+ min-width: 10%;
}
.followText {
font-size: var(--follow-text-size2);
@@ -297,13 +321,21 @@ input[type=text] {
@media screen and (max-width: 480px) {
body, html {
- min-width: 400px;
+ min-width: 400px;
}
.hashtagswarm {
font-size: var(--font-size2);
font-family: Arial, Helvetica, sans-serif;
margin: var(--hashtag-margin);
line-height: var(--hashtag-vertical-spacing3);
+ -webkit-user-select: all;
+ -ms-user-select: all;
+ user-select: all;
+ white-space: nowrap;
+ }
+ .hashtagswarm img {
+ width: 10%;
+ min-width: 10%;
}
.followText {
font-size: var(--font-size2);
diff --git a/epicyon-profile.css b/epicyon-profile.css
index 9b678c737..6269c9fd0 100644
--- a/epicyon-profile.css
+++ b/epicyon-profile.css
@@ -1,6 +1,11 @@
@charset "UTF-8";
:root {
+ --hashtag-margin: 2%;
+ --hashtag-size1: 30px;
+ --hashtag-size2: 40px;
+ --hashtag-vertical-spacing1: 50px;
+ --hashtag-vertical-spacing3: 100px;
--likes-names-margin: 2%;
--likes-names-size1: 30px;
--likes-names-size2: 40px;
@@ -1082,6 +1087,12 @@ div.container {
margin: 0 20%;
}
+h3 {
+ -webkit-user-select: all;
+ -ms-user-select: all;
+ user-select: all;
+}
+
@media screen and (min-width: 400px) {
body, html {
background-color: var(--main-bg-color);
@@ -1098,6 +1109,21 @@ div.container {
font-size: var(--font-size);
color: var(--title-color);
}
+ .hashtagswarm {
+ font-size: var(--hashtag-size1);
+ font-family: Arial, Helvetica, sans-serif;
+ margin: var(--hashtag-margin);
+ line-height: var(--hashtag-vertical-spacing1);
+ -webkit-user-select: all;
+ -ms-user-select: all;
+ user-select: all;
+ white-space: nowrap;
+ }
+ #commonemojilabel {
+ float: none;
+ width: 5%;
+ min-width: 5%;
+ }
.likerNames {
font-size: var(--liker-names-size1);
font-family: Arial, Helvetica, sans-serif;
@@ -1871,6 +1897,21 @@ div.container {
blockquote {
font-size: var(--quote-font-size-mobile);
}
+ .hashtagswarm {
+ font-size: var(--hashtag-size2);
+ font-family: Arial, Helvetica, sans-serif;
+ margin: var(--hashtag-margin);
+ line-height: var(--hashtag-vertical-spacing3);
+ -webkit-user-select: all;
+ -ms-user-select: all;
+ user-select: all;
+ white-space: nowrap;
+ }
+ #commonemojilabel {
+ float: none;
+ width: 10%;
+ min-width: 10%;
+ }
.likerNames {
font-size: var(--liker-names-size2);
font-family: Arial, Helvetica, sans-serif;
@@ -2616,6 +2657,21 @@ div.container {
blockquote {
font-size: var(--quote-font-size-tiny);
}
+ .hashtagswarm {
+ font-size: var(--font-size2);
+ font-family: Arial, Helvetica, sans-serif;
+ margin: var(--hashtag-margin);
+ line-height: var(--hashtag-vertical-spacing3);
+ -webkit-user-select: all;
+ -ms-user-select: all;
+ user-select: all;
+ white-space: nowrap;
+ }
+ #commonemojilabel {
+ float: none;
+ width: 10%;
+ min-width: 10%;
+ }
.likerNames {
font-size: var(--font-size2);
font-family: 'Arial, Helvetica, sans-serif';
diff --git a/reaction.py b/reaction.py
index b8f530caa..d511fb231 100644
--- a/reaction.py
+++ b/reaction.py
@@ -446,6 +446,54 @@ def outbox_undo_reaction(recent_posts_cache: {},
print('DEBUG: post undo reaction via c2s - ' + post_filename)
+def _update_common_reactions(base_dir: str, emoji_content: str) -> None:
+ """Updates the list of commonly used reactions
+ """
+ common_reactions_filename = base_dir + '/accounts/common_reactions.txt'
+ common_reactions = None
+ if os.path.isfile(common_reactions_filename):
+ try:
+ with open(common_reactions_filename, 'r') as fp_react:
+ common_reactions = fp_react.readlines()
+ except OSError:
+ print('EX: unable to load common reactions file')
+ pass
+ if common_reactions:
+ new_common_reactions = []
+ reaction_found = False
+ for line in common_reactions:
+ if ' ' + emoji_content in line:
+ if not reaction_found:
+ reaction_found = True
+ counter = 1
+ count_str = line.split(' ')[0]
+ if count_str.isdigit():
+ counter = int(count_str) + 1
+ count_str = str(counter).zfill(16)
+ line = count_str + ' ' + emoji_content
+ new_common_reactions.append(line)
+ else:
+ new_common_reactions.append(line.replace('\n', ''))
+ if not reaction_found:
+ new_common_reactions.append(str(1).zfill(16) + ' ' + emoji_content)
+ new_common_reactions.sort(reverse=True)
+ try:
+ with open(common_reactions_filename, 'w+') as fp_react:
+ for line in new_common_reactions:
+ fp_react.write(line + '\n')
+ except OSError:
+ print('EX: error writing common reactions 1')
+ return
+ else:
+ line = str(1).zfill(16) + ' ' + emoji_content + '\n'
+ try:
+ with open(common_reactions_filename, 'w+') as fp_react:
+ fp_react.write(line)
+ except OSError:
+ print('EX: error writing common reactions 2')
+ return
+
+
def update_reaction_collection(recent_posts_cache: {},
base_dir: str, post_filename: str,
object_url: str, actor: str,
@@ -515,6 +563,8 @@ def update_reaction_collection(recent_posts_cache: {},
itlen = len(obj['reactions']['items'])
obj['reactions']['totalItems'] = itlen
+ _update_common_reactions(base_dir, emoji_content)
+
if debug:
print('DEBUG: saving post with emoji reaction added')
pprint(post_json_object)
diff --git a/translations/ar.json b/translations/ar.json
index 82cfd684e..b1e77a64b 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -544,5 +544,7 @@
"lang_oc": "الأوكسيتانية",
"lang_pt": "البرتغالية",
"lang_sw": "السواحيلية",
- "lang_zh": "صينى"
+ "lang_zh": "صينى",
+ "Common emoji": "الرموز التعبيرية الشائعة",
+ "Copy and paste into your text": "نسخ ولصق في النص الخاص بك"
}
diff --git a/translations/ca.json b/translations/ca.json
index 56a0d088e..1c250ca7e 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -544,5 +544,7 @@
"lang_oc": "Occità",
"lang_pt": "Portuguès",
"lang_sw": "Suahili",
- "lang_zh": "Xinès"
+ "lang_zh": "Xinès",
+ "Common emoji": "Emoji comú",
+ "Copy and paste into your text": "Copia i enganxa al teu text"
}
diff --git a/translations/cy.json b/translations/cy.json
index 46678d36e..4df858f12 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -544,5 +544,7 @@
"lang_oc": "Ocsitaneg",
"lang_pt": "Portiwgaleg",
"lang_sw": "Swahili",
- "lang_zh": "Tseiniaidd"
+ "lang_zh": "Tseiniaidd",
+ "Common emoji": "Emoji cyffredin",
+ "Copy and paste into your text": "Copïwch a gludwch i'ch testun"
}
diff --git a/translations/de.json b/translations/de.json
index 95e049766..ebe210e6b 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -544,5 +544,7 @@
"lang_oc": "Okzitanisch",
"lang_pt": "Portugiesisch",
"lang_sw": "Suaheli",
- "lang_zh": "Chinesisch"
+ "lang_zh": "Chinesisch",
+ "Common emoji": "Gewöhnliches Emoji",
+ "Copy and paste into your text": "Kopieren und in Ihren Text einfügen"
}
diff --git a/translations/en.json b/translations/en.json
index 6b0837189..059f1ea90 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -544,5 +544,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portuguese",
"lang_sw": "Swahili",
- "lang_zh": "Chinese"
+ "lang_zh": "Chinese",
+ "Common emoji": "Common emoji",
+ "Copy and paste into your text": "Copy and paste into your text"
}
diff --git a/translations/es.json b/translations/es.json
index 17b8fa63e..8f8ded93e 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -544,5 +544,7 @@
"lang_oc": "Occitano",
"lang_pt": "Portuguesa",
"lang_sw": "Swahili",
- "lang_zh": "China"
+ "lang_zh": "China",
+ "Common emoji": "Emoticonos comunes",
+ "Copy and paste into your text": "Copia y pega en tu texto"
}
diff --git a/translations/fr.json b/translations/fr.json
index f58c6dfbe..869b5a612 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -544,5 +544,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portugais",
"lang_sw": "Swahili",
- "lang_zh": "Chinoise"
+ "lang_zh": "Chinoise",
+ "Common emoji": "Émoji commun",
+ "Copy and paste into your text": "Copiez et collez dans votre texte"
}
diff --git a/translations/ga.json b/translations/ga.json
index d926e2297..1b9e61da3 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -544,5 +544,7 @@
"lang_oc": "Béarla",
"lang_pt": "Portaingéilis",
"lang_sw": "Swahili",
- "lang_zh": "Síneach"
+ "lang_zh": "Síneach",
+ "Common emoji": "Emoji coitianta",
+ "Copy and paste into your text": "Cóipeáil agus greamaigh isteach i do théacs"
}
diff --git a/translations/hi.json b/translations/hi.json
index 117e07501..41c166e2b 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -544,5 +544,7 @@
"lang_oc": "ओसीटान",
"lang_pt": "पुर्तगाली",
"lang_sw": "Swahili",
- "lang_zh": "चीनी"
+ "lang_zh": "चीनी",
+ "Common emoji": "आम इमोजी",
+ "Copy and paste into your text": "अपने टेक्स्ट में कॉपी और पेस्ट करें"
}
diff --git a/translations/it.json b/translations/it.json
index 943f9fb17..a329d132c 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -544,5 +544,7 @@
"lang_oc": "Occitano",
"lang_pt": "Portoghese",
"lang_sw": "Swahili",
- "lang_zh": "Cinese"
+ "lang_zh": "Cinese",
+ "Common emoji": "Emoji comuni",
+ "Copy and paste into your text": "Copia e incolla nel tuo testo"
}
diff --git a/translations/ja.json b/translations/ja.json
index 5c0a3a5cf..c2a12661e 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -544,5 +544,7 @@
"lang_oc": "オック語",
"lang_pt": "ポルトガル語",
"lang_sw": "スワヒリ語",
- "lang_zh": "中国語"
+ "lang_zh": "中国語",
+ "Common emoji": "一般的な絵文字",
+ "Copy and paste into your text": "コピーしてテキストに貼り付けます"
}
diff --git a/translations/ko.json b/translations/ko.json
index 357d59cc9..c9e30c908 100644
--- a/translations/ko.json
+++ b/translations/ko.json
@@ -544,5 +544,7 @@
"lang_oc": "옥시탄",
"lang_pt": "포르투갈 인",
"lang_sw": "스와힐리어",
- "lang_zh": "중국인"
+ "lang_zh": "중국인",
+ "Common emoji": "일반적인 이모티콘",
+ "Copy and paste into your text": "텍스트에 복사하여 붙여넣기"
}
diff --git a/translations/ku.json b/translations/ku.json
index 6416f3408..920756b66 100644
--- a/translations/ku.json
+++ b/translations/ku.json
@@ -544,5 +544,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portekizî",
"lang_sw": "Swahîlîyî",
- "lang_zh": "Çînî"
+ "lang_zh": "Çînî",
+ "Common emoji": "Emojiyên hevpar",
+ "Copy and paste into your text": "Di nivîsa xwe de kopî bikin û bixin"
}
diff --git a/translations/oc.json b/translations/oc.json
index 03b7c7cb0..09b274b18 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -540,5 +540,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portuguese",
"lang_sw": "Swahili",
- "lang_zh": "Chinese"
+ "lang_zh": "Chinese",
+ "Common emoji": "Common emoji",
+ "Copy and paste into your text": "Copy and paste into your text"
}
diff --git a/translations/pl.json b/translations/pl.json
index 50e42f8d5..f88f3d844 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -544,5 +544,7 @@
"lang_oc": "Prowansalski",
"lang_pt": "Portugalski",
"lang_sw": "Suahili",
- "lang_zh": "Chiński"
+ "lang_zh": "Chiński",
+ "Common emoji": "Popularne emotikony",
+ "Copy and paste into your text": "Skopiuj i wklej do swojego tekstu"
}
diff --git a/translations/pt.json b/translations/pt.json
index de70aeddb..060083ce1 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -544,5 +544,7 @@
"lang_oc": "Occitano",
"lang_pt": "Português",
"lang_sw": "Suaíli",
- "lang_zh": "Chinês"
+ "lang_zh": "Chinês",
+ "Common emoji": "Emoji comum",
+ "Copy and paste into your text": "Copie e cole no seu texto"
}
diff --git a/translations/ru.json b/translations/ru.json
index b06b21eea..2886a8258 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -544,5 +544,7 @@
"lang_oc": "окситанский",
"lang_pt": "португальский",
"lang_sw": "суахили",
- "lang_zh": "Китайский"
+ "lang_zh": "Китайский",
+ "Common emoji": "Общие смайлики",
+ "Copy and paste into your text": "Скопируйте и вставьте в свой текст"
}
diff --git a/translations/sw.json b/translations/sw.json
index f765626ac..e7412ba0c 100644
--- a/translations/sw.json
+++ b/translations/sw.json
@@ -544,5 +544,7 @@
"lang_oc": "Oksitani",
"lang_pt": "Kireno",
"lang_sw": "Kiswahili",
- "lang_zh": "Kichina"
+ "lang_zh": "Kichina",
+ "Common emoji": "Emoji ya kawaida",
+ "Copy and paste into your text": "Nakili na ubandike kwenye maandishi yako"
}
diff --git a/translations/uk.json b/translations/uk.json
index 6df79c654..a1afb5f8c 100644
--- a/translations/uk.json
+++ b/translations/uk.json
@@ -544,5 +544,7 @@
"lang_oc": "окситанський",
"lang_pt": "португальська",
"lang_sw": "суахілі",
- "lang_zh": "китайський"
+ "lang_zh": "китайський",
+ "Common emoji": "Звичайні емодзі",
+ "Copy and paste into your text": "Скопіюйте та вставте у свій текст"
}
diff --git a/translations/zh.json b/translations/zh.json
index e7c1cbbe9..76cc3775c 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -544,5 +544,7 @@
"lang_oc": "奥克西坦",
"lang_pt": "葡萄牙语",
"lang_sw": "斯瓦希里语",
- "lang_zh": "中国人"
+ "lang_zh": "中国人",
+ "Common emoji": "常见表情符号",
+ "Copy and paste into your text": "复制并粘贴到您的文本中"
}
diff --git a/webapp_create_post.py b/webapp_create_post.py
index e0a196353..6019f8762 100644
--- a/webapp_create_post.py
+++ b/webapp_create_post.py
@@ -19,6 +19,7 @@ from utils import get_currencies
from utils import get_category_types
from utils import get_account_timezone
from utils import get_supported_languages
+from webapp_utils import html_common_emoji
from webapp_utils import begin_edit_section
from webapp_utils import end_edit_section
from webapp_utils import get_banner_file
@@ -381,6 +382,17 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
'imageDescription', '')
new_post_image_section += end_edit_section()
+ new_post_emoji_section = ''
+ common_emoji_str = html_common_emoji(base_dir, 16)
+ if common_emoji_str:
+ new_post_emoji_section = \
+ begin_edit_section('😀 ' + translate['Common emoji'])
+ new_post_emoji_section += \
+ '
\n'
+ new_post_emoji_section += common_emoji_str
+ new_post_emoji_section += end_edit_section()
+
scope_icon = 'scope_public.png'
scope_description = translate['Public']
if share_description:
@@ -880,6 +892,7 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
extra_fields + citations_str + replies_section + date_and_location
if not media_instance or reply_str:
new_post_form += new_post_image_section
+ new_post_form += new_post_emoji_section
new_post_form += \
'
\n' + emoji_str += html_common_emoji(base_dir, 16) + '\n' + emoji_str += '