diff --git a/daemon.py b/daemon.py index cec24bb9c..00c46ffef 100644 --- a/daemon.py +++ b/daemon.py @@ -13627,6 +13627,8 @@ class PubServer(BaseHTTPRequestHandler): return 1 return -1 elif postType == 'newshare': + if not fields.get('itemQty'): + return -1 if not fields.get('itemType'): return -1 if not fields.get('category'): @@ -13646,6 +13648,10 @@ class PubServer(BaseHTTPRequestHandler): self.server.baseDir, nickname, self.server.domain) + itemQty = 1 + if fields['itemQty']: + if fields['itemQty'].isdigit(): + itemQty = int(fields['itemQty']) addShare(self.server.baseDir, self.server.httpPrefix, nickname, @@ -13653,7 +13659,7 @@ class PubServer(BaseHTTPRequestHandler): fields['subject'], fields['message'], filename, - fields['itemType'], + itemQty, fields['itemType'], fields['category'], fields['location'], durationStr, diff --git a/epicyon.py b/epicyon.py index 7ce570793..684ae8521 100644 --- a/epicyon.py +++ b/epicyon.py @@ -558,6 +558,9 @@ parser.add_argument('--summary', dest='summary', type=str, parser.add_argument('--itemImage', dest='itemImage', type=str, default=None, help='Filename of an image for an item being shared') +parser.add_argument('--itemQty', dest='itemQty', type=int, + default=1, + help='Quantity of items being shared') parser.add_argument('--itemType', dest='itemType', type=str, default=None, help='Type of item being shared') @@ -1246,6 +1249,10 @@ if args.itemName: 'with the --summary option') sys.exit() + if not args.itemQty: + print('Specify a quantity of shared items with the --itemQty option') + sys.exit() + if not args.itemType: print('Specify a type of shared item with the --itemType option') sys.exit() @@ -1277,6 +1284,7 @@ if args.itemName: args.itemName, args.summary, args.itemImage, + args.itemQty, args.itemType, args.itemCategory, args.location, diff --git a/shares.py b/shares.py index 20605c12a..9e10e6aa3 100644 --- a/shares.py +++ b/shares.py @@ -97,7 +97,7 @@ def _addShareDurationSec(duration: str, published: str) -> int: def addShare(baseDir: str, httpPrefix: str, nickname: str, domain: str, port: int, displayName: str, summary: str, imageFilename: str, - itemType: str, itemCategory: str, location: str, + itemQty: int, itemType: str, itemCategory: str, location: str, duration: str, debug: bool, city: str) -> None: """Adds a new share """ @@ -151,6 +151,7 @@ def addShare(baseDir: str, "displayName": displayName, "summary": summary, "imageUrl": imageUrl, + "itemQty": itemQty, "itemType": itemType, "category": itemCategory, "location": location, @@ -321,7 +322,7 @@ def sendShareViaServer(baseDir, session, fromDomain: str, fromPort: int, httpPrefix: str, displayName: str, summary: str, imageFilename: str, - itemType: str, itemCategory: str, + itemQty: int, itemType: str, itemCategory: str, location: str, duration: str, cachedWebfingers: {}, personCache: {}, debug: bool, projectVersion: str) -> {}: @@ -347,6 +348,7 @@ def sendShareViaServer(baseDir, session, "type": "Offer", "displayName": displayName, "summary": summary, + "itemQty": itemQty, "itemType": itemType, "category": itemCategory, "location": location, @@ -545,6 +547,10 @@ def outboxShareUpload(baseDir: str, httpPrefix: str, if debug: print('DEBUG: summary missing from Offer') return + if not messageJson['object'].get('itemQty'): + if debug: + print('DEBUG: itemQty missing from Offer') + return if not messageJson['object'].get('itemType'): if debug: print('DEBUG: itemType missing from Offer') @@ -566,6 +572,7 @@ def outboxShareUpload(baseDir: str, httpPrefix: str, messageJson['object']['displayName'], messageJson['object']['summary'], messageJson['object']['imageFilename'], + messageJson['object']['itemQty'], messageJson['object']['itemType'], messageJson['object']['itemCategory'], messageJson['object']['location'], diff --git a/translations/ar.json b/translations/ar.json index 01994da3e..f6e54fb4a 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -452,5 +452,6 @@ "Blocked User Agents": "عوامل المستخدم المحظورة", "Notify me when this account posts": "أعلمني عندما ينشر الحساب هذا", "Languages": "اللغات", - "Translated": "تترجم" + "Translated": "تترجم", + "Quantity": "كمية" } diff --git a/translations/ca.json b/translations/ca.json index 3b7911ba9..0c4e49f54 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Agents d'usuari bloquejats", "Notify me when this account posts": "Aviseu-me quan publiqui aquest compte", "Languages": "Idiomes", - "Translated": "Traduït" + "Translated": "Traduït", + "Quantity": "Quantitat" } diff --git a/translations/cy.json b/translations/cy.json index 3bfb2b4e3..8eb9088d3 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Asiantau defnyddwyr wedi'u blocio", "Notify me when this account posts": "Rhoi gwybod i mi pan fydd y cyfrifon cyfrif hwn", "Languages": "Ieithoedd", - "Translated": "Chyfieithwyd" + "Translated": "Chyfieithwyd", + "Quantity": "Symiau" } diff --git a/translations/de.json b/translations/de.json index 38b233dda..f6b501be1 100644 --- a/translations/de.json +++ b/translations/de.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Blockierte Benutzeragenten", "Notify me when this account posts": "Benachrichtigen Sie mich, wenn dieses Konto postet", "Languages": "Sprachen", - "Translated": "Übersetzt" + "Translated": "Übersetzt", + "Quantity": "Menge" } diff --git a/translations/en.json b/translations/en.json index 644d41b83..e358967ba 100644 --- a/translations/en.json +++ b/translations/en.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Blocked User Agents", "Notify me when this account posts": "Notify me when this account posts", "Languages": "Languages", - "Translated": "Translated" + "Translated": "Translated", + "Quantity": "Quantity" } diff --git a/translations/es.json b/translations/es.json index c1d9ea13d..0627c523c 100644 --- a/translations/es.json +++ b/translations/es.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Agentes de usuario bloqueados", "Notify me when this account posts": "Notifíqueme cuando se publique esta cuenta", "Languages": "Idiomas", - "Translated": "Traducida" + "Translated": "Traducida", + "Quantity": "Cantidad" } diff --git a/translations/fr.json b/translations/fr.json index 015e6ed11..0e73dcd27 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Agents d'utilisateur bloqués", "Notify me when this account posts": "Avertissez-moi quand ce compte publie", "Languages": "Langues", - "Translated": "Traduite" + "Translated": "Traduite", + "Quantity": "Quantité" } diff --git a/translations/ga.json b/translations/ga.json index a7008e056..6841a30d8 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Gníomhairí úsáideora blocáilte", "Notify me when this account posts": "Cuir in iúl dom nuair a phostófar an cuntas seo", "Languages": "Teangacha", - "Translated": "Aistrithe" + "Translated": "Aistrithe", + "Quantity": "Cainníocht" } diff --git a/translations/hi.json b/translations/hi.json index 5f389a268..fd07f2407 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -452,5 +452,6 @@ "Blocked User Agents": "अवरुद्ध उपयोगकर्ता एजेंट", "Notify me when this account posts": "यह खाता पोस्ट होने पर मुझे सूचित करें", "Languages": "बोली", - "Translated": "अनुवाद" + "Translated": "अनुवाद", + "Quantity": "मात्रा" } diff --git a/translations/it.json b/translations/it.json index 103a3aef5..98fc2abb4 100644 --- a/translations/it.json +++ b/translations/it.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Agenti utente bloccati", "Notify me when this account posts": "Avvisami quando questo account messaggi", "Languages": "Le lingue", - "Translated": "Tradotto" + "Translated": "Tradotto", + "Quantity": "Quantità" } diff --git a/translations/ja.json b/translations/ja.json index c8f022fd2..237c40538 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -452,5 +452,6 @@ "Blocked User Agents": "ブロックされたユーザーエージェント", "Notify me when this account posts": "この口座投稿を通知する", "Languages": "言語", - "Translated": "翻訳" + "Translated": "翻訳", + "Quantity": "量" } diff --git a/translations/ku.json b/translations/ku.json index 8053032d2..ddd15e33e 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Karmendên bikarhêner asteng kirin", "Notify me when this account posts": "Dema ku ev postên hesabê min agahdar bikin", "Languages": "Ziman", - "Translated": "Wergerandin" + "Translated": "Wergerandin", + "Quantity": "Jimarî" } diff --git a/translations/oc.json b/translations/oc.json index c16657c80..53843d5aa 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -448,5 +448,6 @@ "Blocked User Agents": "Blocked User Agents", "Notify me when this account posts": "Notify me when this account posts", "Languages": "Languages", - "Translated": "Translated" + "Translated": "Translated", + "Quantity": "Quantity" } diff --git a/translations/pt.json b/translations/pt.json index 13ef8a929..b2bfcbf1a 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Agentes de usuário bloqueados", "Notify me when this account posts": "Notifique-me quando esta conta posts", "Languages": "Línguas", - "Translated": "Traduzida" + "Translated": "Traduzida", + "Quantity": "Quantidade" } diff --git a/translations/ru.json b/translations/ru.json index 71eaf6606..2284d4d13 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Заблокированные пользовательские агенты", "Notify me when this account posts": "Сообщите мне, когда эта учетная запись", "Languages": "Языки", - "Translated": "Перевод" + "Translated": "Перевод", + "Quantity": "Количество" } diff --git a/translations/sw.json b/translations/sw.json index 29537cef9..2b010a9a2 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -452,5 +452,6 @@ "Blocked User Agents": "Wakala wa watumiaji waliozuiwa", "Notify me when this account posts": "Nijulishe wakati akaunti hii ya akaunti.", "Languages": "Lugha", - "Translated": "Ilitafsiriwa" + "Translated": "Ilitafsiriwa", + "Quantity": "Wingi" } diff --git a/translations/zh.json b/translations/zh.json index 54cd7658e..828b32382 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -452,5 +452,6 @@ "Blocked User Agents": "阻止用户代理商", "Notify me when this account posts": "此帐户帖子时通知我", "Languages": "语言", - "Translated": "翻译" + "Translated": "翻译", + "Quantity": "数量" } diff --git a/webapp_create_post.py b/webapp_create_post.py index 083dd93f7..408a22b96 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -354,6 +354,9 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, translate['Description of the item being shared'] + '...' endpoint = 'newshare' extraFields = '
\n' + extraFields += \ + editTextField(translate['Quantity'] + ':', + 'itemQty', '1') extraFields += \ editTextField(translate['Type of shared item. eg. hat'] + ':', 'itemType', '') diff --git a/webapp_search.py b/webapp_search.py index f0d2df47a..e22c3140e 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -175,9 +175,12 @@ def htmlSearchSharedItems(cssCache: {}, translate: {}, sharedItem['imageUrl'] + \ '" alt="Item image">\n' sharedItemsForm += \ - '

' + sharedItem['summary'] + '

\n' + '

' + sharedItem['summary'] + '

\n

' sharedItemsForm += \ - '

' + translate['Type'] + \ + '' + translate['Quantity'] + \ + ': ' + str(sharedItem['itemQty']) + ' ' + sharedItemsForm += \ + '' + translate['Type'] + \ ': ' + sharedItem['itemType'] + ' ' sharedItemsForm += \ '' + translate['Category'] + \ diff --git a/webapp_timeline.py b/webapp_timeline.py index 1b1552b09..5e472b856 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -821,8 +821,11 @@ def htmlIndividualShare(actor: str, item: {}, translate: {}, '' + translate['Item image'] + '\n\n' profileStr += '

' + item['summary'] + '

\n' + profileStr += '

' profileStr += \ - '

' + translate['Type'] + ': ' + item['itemType'] + ' ' + '' + translate['Quantity'] + ': ' + str(item['itemQty']) + ' ' + profileStr += \ + '' + translate['Type'] + ': ' + item['itemType'] + ' ' profileStr += \ '' + translate['Category'] + ': ' + item['category'] + ' ' profileStr += \