mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-04-19 23:37:41 +00:00
fix issue
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
410934063f
commit
e2b1bdddff
2 changed files with 15 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
||||||
// Variables used by Scriptable.
|
// Variables used by Scriptable.
|
||||||
// These must be at the very top of the file. Do not edit.
|
// These must be at the very top of the file. Do not edit.
|
||||||
// icon-color: deep-blue; icon-glyph: shopping-cart;
|
// icon-color: deep-blue; icon-glyph: shopping-cart;
|
||||||
// Version 1.1.2
|
// Version 1.1.3
|
||||||
|
|
||||||
const cacheMinutes = 60 * 2
|
const cacheMinutes = 60 * 2
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
|
@ -39,42 +39,42 @@ const localeText = {
|
||||||
default: ['Day', 'Days', {
|
default: ['Day', 'Days', {
|
||||||
'PLACED': 'Order Placed',
|
'PLACED': 'Order Placed',
|
||||||
'PROCESSING': 'Processing',
|
'PROCESSING': 'Processing',
|
||||||
'PREPARED_FOR_SHIPPMENT': 'Preparing for Ship',
|
'PREPARED_FOR_SHIPMENT': 'Preparing for Ship',
|
||||||
'SHIPPED': 'Shipped',
|
'SHIPPED': 'Shipped',
|
||||||
'DELIVERED': 'Delivered'
|
'DELIVERED': 'Delivered'
|
||||||
}],
|
}],
|
||||||
en: ['Day', 'Days', {
|
en: ['Day', 'Days', {
|
||||||
'PLACED': 'Order Placed',
|
'PLACED': 'Order Placed',
|
||||||
'PROCESSING': 'Processing',
|
'PROCESSING': 'Processing',
|
||||||
'PREPARED_FOR_SHIPPMENT': 'Preparing for Ship',
|
'PREPARED_FOR_SHIPMENT': 'Preparing for Ship',
|
||||||
'SHIPPED': 'Shipped',
|
'SHIPPED': 'Shipped',
|
||||||
'DELIVERED': 'Delivered'
|
'DELIVERED': 'Delivered'
|
||||||
}],
|
}],
|
||||||
de: ['Tag', 'Tage', {
|
de: ['Tag', 'Tage', {
|
||||||
'PLACED': 'Bestellung aufgegeben',
|
'PLACED': 'Bestellung aufgegeben',
|
||||||
'PROCESSING': 'Vorgang läuft',
|
'PROCESSING': 'Vorgang läuft',
|
||||||
'PREPARED_FOR_SHIPPMENT': 'Versand wird vorbereitet',
|
'PREPARED_FOR_SHIPMENT': 'Versand wird vorbereitet',
|
||||||
'SHIPPED': 'Bestellung versandt',
|
'SHIPPED': 'Bestellung versandt',
|
||||||
'DELIVERED': 'Geliefert'
|
'DELIVERED': 'Geliefert'
|
||||||
}],
|
}],
|
||||||
fr: ['Jour', 'Jours', {
|
fr: ['Jour', 'Jours', {
|
||||||
'PLACED': 'Commande enregistrée',
|
'PLACED': 'Commande enregistrée',
|
||||||
'PROCESSING': 'Traitement',
|
'PROCESSING': 'Traitement',
|
||||||
'PREPARED_FOR_SHIPPMENT': 'En cours de préparation pour expédition',
|
'PREPARED_FOR_SHIPMENT': 'En cours de préparation pour expédition',
|
||||||
'SHIPPED': 'Expédiée',
|
'SHIPPED': 'Expédiée',
|
||||||
'DELIVERED': 'Livrée'
|
'DELIVERED': 'Livrée'
|
||||||
}],
|
}],
|
||||||
es: ['día', 'días', {
|
es: ['día', 'días', {
|
||||||
'PLACED': 'Pedido recibido',
|
'PLACED': 'Pedido recibido',
|
||||||
'PROCESSING': 'Procesando',
|
'PROCESSING': 'Procesando',
|
||||||
'PREPARED_FOR_SHIPPMENT': 'Preparando envío',
|
'PREPARED_FOR_SHIPMENT': 'Preparando envío',
|
||||||
'SHIPPED': 'Enviado',
|
'SHIPPED': 'Enviado',
|
||||||
'DELIVERED': 'Entregado'
|
'DELIVERED': 'Entregado'
|
||||||
}],
|
}],
|
||||||
it: ['giorno', 'giorni', {
|
it: ['giorno', 'giorni', {
|
||||||
'PLACED': 'Ordine inoltrato',
|
'PLACED': 'Ordine inoltrato',
|
||||||
'PROCESSING': 'ElaborazioneIn',
|
'PROCESSING': 'ElaborazioneIn',
|
||||||
'PREPARED_FOR_SHIPPMENT': 'Spedizione in preparazione',
|
'PREPARED_FOR_SHIPMENT': 'Spedizione in preparazione',
|
||||||
'SHIPPED': 'Spedito',
|
'SHIPPED': 'Spedito',
|
||||||
'DELIVERED': 'ConsegnatoIncompleto'
|
'DELIVERED': 'ConsegnatoIncompleto'
|
||||||
}]
|
}]
|
||||||
|
@ -180,21 +180,19 @@ const getOrderdetails = async (ordernumber, email) => {
|
||||||
if (!xAosStkMatch) {
|
if (!xAosStkMatch) {
|
||||||
throw new Error('Needed x-aos-stk token not found')
|
throw new Error('Needed x-aos-stk token not found')
|
||||||
}
|
}
|
||||||
|
const postUrl = (reqSession.response.url.replace('/orders', '/orderx')) + '&_a=guestUserOrderLookUp&_m=signIn.orderLookUp'
|
||||||
const postUrl = (reqSession.response.url.replace('/np/', '/npx/')) + '&_a=guestUserOrderLookUp&_m=loginHomeOLSS.orderLookUp'
|
|
||||||
|
|
||||||
const postReq = new Request(postUrl)
|
const postReq = new Request(postUrl)
|
||||||
postReq.headers = {
|
postReq.headers = {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Referer': reqSession.response.url,
|
'Referer': reqSession.response.url,
|
||||||
'x-aos-model-page': 'sentryLoginOlssNP',
|
'x-aos-model-page': 'olssSignInPage',
|
||||||
'x-aos-stk': xAosStkMatch[1],
|
'x-aos-stk': xAosStkMatch[1],
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
'Cookie': CookieValues.join('; ')
|
'Cookie': CookieValues.join('; ')
|
||||||
}
|
}
|
||||||
postReq.method = "POST";
|
postReq.method = "POST";
|
||||||
postReq.addParameterToMultipart('loginHomeOLSS.orderLookUp.orderNumber', ordernumber)
|
postReq.body = `signIn.orderLookUp.orderNumber=${ordernumber}&signIn.orderLookUp.emailAddress=${email}`
|
||||||
postReq.addParameterToMultipart('loginHomeOLSS.orderLookUp.emailAddress', email)
|
|
||||||
|
|
||||||
const resPostReq = await postReq.loadString()
|
const resPostReq = await postReq.loadString()
|
||||||
|
|
||||||
|
@ -210,13 +208,12 @@ const getOrderdetails = async (ordernumber, email) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (postResData['head']['status'] !== 302) {
|
if (postResData['head']['status'] !== 302) {
|
||||||
console.log(resPostReq)
|
|
||||||
throw new Error('Fetching the data failed. Got unexpected response. Please try it later.')
|
throw new Error('Fetching the data failed. Got unexpected response. Please try it later.')
|
||||||
}
|
}
|
||||||
|
|
||||||
const req = new Request(postResData['head']['data']['url'])
|
const req = new Request(postResData['head']['data']['url'])
|
||||||
const res = await req.loadString()
|
const res = await req.loadString()
|
||||||
const rawJSON = res.match(/<script id="init_data" type="application\/json">(.*)<\/script>/)
|
const rawJSON = res.match(/<script id="init_data" type="application\/json">[\s]+(.*)[\s]+<\/script>/)
|
||||||
if (!rawJSON) {
|
if (!rawJSON) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
1.1.2
|
||||||
|
- script adjusted to the new service logic
|
||||||
|
- fix typo
|
||||||
|
1.1.1
|
||||||
1.1.2
|
1.1.2
|
||||||
- Fix issue with different timeformat after delivery
|
- Fix issue with different timeformat after delivery
|
||||||
1.1.1
|
1.1.1
|
||||||
|
|
Loading…
Add table
Reference in a new issue