mirror of https://gitlab.com/bashrc2/epicyon
Add quantity to shared items
parent
d70badb76b
commit
67747bad72
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
11
shares.py
11
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'],
|
||||
|
|
|
@ -452,5 +452,6 @@
|
|||
"Blocked User Agents": "عوامل المستخدم المحظورة",
|
||||
"Notify me when this account posts": "أعلمني عندما ينشر الحساب هذا",
|
||||
"Languages": "اللغات",
|
||||
"Translated": "تترجم"
|
||||
"Translated": "تترجم",
|
||||
"Quantity": "كمية"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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é"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -452,5 +452,6 @@
|
|||
"Blocked User Agents": "अवरुद्ध उपयोगकर्ता एजेंट",
|
||||
"Notify me when this account posts": "यह खाता पोस्ट होने पर मुझे सूचित करें",
|
||||
"Languages": "बोली",
|
||||
"Translated": "अनुवाद"
|
||||
"Translated": "अनुवाद",
|
||||
"Quantity": "मात्रा"
|
||||
}
|
||||
|
|
|
@ -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à"
|
||||
}
|
||||
|
|
|
@ -452,5 +452,6 @@
|
|||
"Blocked User Agents": "ブロックされたユーザーエージェント",
|
||||
"Notify me when this account posts": "この口座投稿を通知する",
|
||||
"Languages": "言語",
|
||||
"Translated": "翻訳"
|
||||
"Translated": "翻訳",
|
||||
"Quantity": "量"
|
||||
}
|
||||
|
|
|
@ -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î"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -452,5 +452,6 @@
|
|||
"Blocked User Agents": "Заблокированные пользовательские агенты",
|
||||
"Notify me when this account posts": "Сообщите мне, когда эта учетная запись",
|
||||
"Languages": "Языки",
|
||||
"Translated": "Перевод"
|
||||
"Translated": "Перевод",
|
||||
"Quantity": "Количество"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -452,5 +452,6 @@
|
|||
"Blocked User Agents": "阻止用户代理商",
|
||||
"Notify me when this account posts": "此帐户帖子时通知我",
|
||||
"Languages": "语言",
|
||||
"Translated": "翻译"
|
||||
"Translated": "翻译",
|
||||
"Quantity": "数量"
|
||||
}
|
||||
|
|
|
@ -354,6 +354,9 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
translate['Description of the item being shared'] + '...'
|
||||
endpoint = 'newshare'
|
||||
extraFields = '<div class="container">\n'
|
||||
extraFields += \
|
||||
editTextField(translate['Quantity'] + ':',
|
||||
'itemQty', '1')
|
||||
extraFields += \
|
||||
editTextField(translate['Type of shared item. eg. hat'] + ':',
|
||||
'itemType', '')
|
||||
|
|
|
@ -175,9 +175,12 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
sharedItem['imageUrl'] + \
|
||||
'" alt="Item image"></a>\n'
|
||||
sharedItemsForm += \
|
||||
'<p>' + sharedItem['summary'] + '</p>\n'
|
||||
'<p>' + sharedItem['summary'] + '</p>\n<p>'
|
||||
sharedItemsForm += \
|
||||
'<p><b>' + translate['Type'] + \
|
||||
'<b>' + translate['Quantity'] + \
|
||||
':</b> ' + str(sharedItem['itemQty']) + ' '
|
||||
sharedItemsForm += \
|
||||
'<b>' + translate['Type'] + \
|
||||
':</b> ' + sharedItem['itemType'] + ' '
|
||||
sharedItemsForm += \
|
||||
'<b>' + translate['Category'] + \
|
||||
|
|
|
@ -821,8 +821,11 @@ def htmlIndividualShare(actor: str, item: {}, translate: {},
|
|||
'<img loading="lazy" src="' + item['imageUrl'] + \
|
||||
'" alt="' + translate['Item image'] + '">\n</a>\n'
|
||||
profileStr += '<p>' + item['summary'] + '</p>\n'
|
||||
profileStr += '<p>'
|
||||
profileStr += \
|
||||
'<p><b>' + translate['Type'] + ':</b> ' + item['itemType'] + ' '
|
||||
'<b>' + translate['Quantity'] + ':</b> ' + str(item['itemQty']) + ' '
|
||||
profileStr += \
|
||||
'<b>' + translate['Type'] + ':</b> ' + item['itemType'] + ' '
|
||||
profileStr += \
|
||||
'<b>' + translate['Category'] + ':</b> ' + item['category'] + ' '
|
||||
profileStr += \
|
||||
|
|
Loading…
Reference in New Issue