mango-cms 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/default/config/automation/index.js +37 -0
- package/default/config/collections/examples.js +60 -0
- package/default/config/config/.collections.json +1 -0
- package/default/config/config/globalFields.js +15 -0
- package/default/config/config/settings.json +23 -0
- package/default/config/config/statuses.js +0 -0
- package/default/config/config/users.js +35 -0
- package/default/config/endpoints/index.js +19 -0
- package/default/config/fields/vimeo.js +36 -0
- package/default/config/hooks/test.js +5 -0
- package/default/config/plugins/.gitkeep +0 -0
- package/default/index.html +25 -0
- package/default/package.json +42 -0
- package/default/postcss.config.js +6 -0
- package/default/public/_redirects +1 -0
- package/default/public/index.js +66 -0
- package/default/src/App.vue +27 -0
- package/default/src/components/layout/login.vue +212 -0
- package/default/src/components/layout/modal.vue +113 -0
- package/default/src/components/layout/spinner.vue +17 -0
- package/default/src/components/pages/404.vue +28 -0
- package/default/src/components/pages/home.vue +74 -0
- package/default/src/helpers/Mango.vue +482 -0
- package/default/src/helpers/darkMode.js +38 -0
- package/default/src/helpers/localDB.js +294 -0
- package/default/src/helpers/mango.js +341 -0
- package/default/src/helpers/user.js +40 -0
- package/default/src/index.css +281 -0
- package/default/src/main.js +145 -0
- package/default/tailwind.config.js +46 -0
- package/default/vite.config.js +37 -0
- package/package.json +4 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
let days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
2
|
+
|
|
3
|
+
Date.prototype.monthDays = function () {
|
|
4
|
+
var d = new Date(this.getFullYear(), this.getMonth() + 1, 0);
|
|
5
|
+
return d.getDate();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let startAutomations = function () {
|
|
9
|
+
|
|
10
|
+
// console.log('starting!')
|
|
11
|
+
|
|
12
|
+
setInterval(() => {
|
|
13
|
+
|
|
14
|
+
// Five hour timezone offset for DigitalOcean server
|
|
15
|
+
let now = new Date(Date.now() - 1000 * 60 * 60 * 5)
|
|
16
|
+
|
|
17
|
+
let day = now.getDay()
|
|
18
|
+
let weekday = days[day]
|
|
19
|
+
let date = now.getDate()
|
|
20
|
+
let month = now.getMonth()
|
|
21
|
+
|
|
22
|
+
let hour = now.getHours()
|
|
23
|
+
let minute = now.getMinutes()
|
|
24
|
+
|
|
25
|
+
let monthDays = now.monthDays()
|
|
26
|
+
let nthWeekdayOfMonth = Math.ceil(day / 7)
|
|
27
|
+
let daysRemainingInMonth = monthDays - date
|
|
28
|
+
let lastWeekdayOfMonth = (daysRemainingInMonth) < 7
|
|
29
|
+
|
|
30
|
+
// Automations to run (cron)
|
|
31
|
+
// if ((weekday == 'Thursday' || weekday == 'Friday') && hour == 8 && minute == 1) doSomethingCool()
|
|
32
|
+
|
|
33
|
+
}, 1000 * 60);
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default startAutomations
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This is an example collection. It will inherit its name
|
|
3
|
+
from the filename for the plural of this collection type
|
|
4
|
+
(examples)
|
|
5
|
+
|
|
6
|
+
The singular should be defined on the root of the export
|
|
7
|
+
or it will be declared as `singularExamples` by default.
|
|
8
|
+
|
|
9
|
+
There should also be a `fields` attribute on the root
|
|
10
|
+
which contains all of the fields in the collection.
|
|
11
|
+
Custom fields can be imported directly, and default fields
|
|
12
|
+
can be imported from the CMS.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import fields from '@fields'
|
|
16
|
+
let { Relationship, Image } = fields
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
permissions: {
|
|
20
|
+
public: ['create', 'read', 'update', 'delete'],
|
|
21
|
+
},
|
|
22
|
+
singular: 'example',
|
|
23
|
+
fields: {
|
|
24
|
+
someData: String,
|
|
25
|
+
anotherField: 'Int',
|
|
26
|
+
anArrayOfInts: ['Int'],
|
|
27
|
+
image: Image({ width: 500 }),
|
|
28
|
+
/* Relationships require that you specify the singular form
|
|
29
|
+
of the collection that you're relating to */
|
|
30
|
+
exampleRelationship: Relationship({ collection: 'example' }),
|
|
31
|
+
/* This is an example of a `complexField`, just think of it
|
|
32
|
+
as a nested object structured the same way as a collection
|
|
33
|
+
with the `fields` attribute. */
|
|
34
|
+
someLegitData: {
|
|
35
|
+
fields: {
|
|
36
|
+
coordinates: {
|
|
37
|
+
x: 'Int',
|
|
38
|
+
y: 'Int'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
/* There are also some sweet things like computed fields.
|
|
43
|
+
There are some cool caching options for computed fields you
|
|
44
|
+
can lookup in the docs */
|
|
45
|
+
productOfXY: {
|
|
46
|
+
computed: doc => doc.someLegitData?.coordinates?.x * doc.someLegitData?.coordinates?.y
|
|
47
|
+
},
|
|
48
|
+
/* Sometimes you might want to store a different type of data
|
|
49
|
+
than you're taking in. There are some cool field options to help
|
|
50
|
+
with this */
|
|
51
|
+
vimeo: {
|
|
52
|
+
inputType: 'Int',
|
|
53
|
+
fields: {
|
|
54
|
+
id: 'Int',
|
|
55
|
+
url: 'String'
|
|
56
|
+
},
|
|
57
|
+
translateInput: input => ({ id: input, url: `https://vimeo.com/${input}` })
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"members","ssrModel":null,"titleName":"Members","singular":"member","titleSingular":"Member","humanName":" Members","humanSingular":" Member","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"email","relationship":false,"instanceOf":null,"options":null,"humanName":"email","type":"String","inputType":"String","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"password","relationship":false,"instanceOf":null,"options":null,"humanName":"password","type":"MembersPassword","inputType":"String","computed":false,"complex":true,"translate":true,"required":true,"customField":false,"global":false,"fields":[{"name":"salt","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"salt","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"hash","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"hash","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"apiKey","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"api Key","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"roles","relationship":false,"instanceOf":"select","options":["admin","member","contributor","editor"],"humanName":"roles","type":"[String]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"firstName","relationship":false,"instanceOf":null,"options":null,"humanName":"first Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lastName","relationship":false,"instanceOf":null,"options":null,"humanName":"last Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"examples","ssrModel":null,"titleName":"Examples","singular":"example","titleSingular":"Example","humanName":" Examples","humanSingular":" Example","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"someData","relationship":false,"instanceOf":null,"options":null,"humanName":"some Data","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"anotherField","relationship":false,"instanceOf":null,"options":null,"humanName":"another Field","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"anArrayOfInts","array":true,"relationship":false,"instanceOf":null,"options":null,"humanName":"an Array Of Ints","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"image","relationship":false,"instanceOf":"image","options":null,"humanName":"image","type":"ExamplesImage","inputType":"String","computed":false,"complex":true,"translate":true,"required":false,"customField":false,"global":false,"fields":[{"name":"width","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"width","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"height","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"height","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"url","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"url","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"exampleRelationship","relationship":"examples","instanceOf":"relationship","options":null,"humanName":"example Relationship","type":"[Example]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"someLegitData","relationship":false,"instanceOf":null,"options":null,"humanName":"some Legit Data","type":"ExamplesSomeLegitData","inputType":"CreateExamplesSomeLegitDataInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"coordinates","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"coordinates","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"productOfXY","relationship":false,"instanceOf":null,"options":null,"humanName":"product Of X Y","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"vimeo","relationship":false,"instanceOf":null,"options":null,"humanName":"vimeo","type":"ExamplesVimeo","inputType":"Int","computed":false,"complex":true,"translate":true,"required":false,"customField":false,"global":false,"fields":[{"name":"id","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"id","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"url","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"url","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"items","ssrModel":null,"titleName":"Items","singular":"item","titleSingular":"Item","humanName":" Items","humanSingular":" Item","library":"Mango-stand","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"price","relationship":false,"instanceOf":null,"options":null,"humanName":"price","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"stock","relationship":false,"instanceOf":null,"options":null,"humanName":"stock","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"description","relationship":false,"instanceOf":null,"options":null,"humanName":"description","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"carts","ssrModel":null,"titleName":"Carts","singular":"cart","titleSingular":"Cart","humanName":" Carts","humanSingular":" Cart","library":"Mango-stand","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"transactionId","relationship":false,"instanceOf":null,"options":null,"humanName":"transaction Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"finalized","relationship":false,"instanceOf":null,"options":null,"humanName":"finalized","type":"Boolean","inputType":"Boolean","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"completed","relationship":false,"instanceOf":null,"options":null,"humanName":"completed","type":"Boolean","inputType":"Boolean","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"completedDate","relationship":false,"instanceOf":null,"options":null,"humanName":"completed Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"cartItems","array":true,"relationship":false,"instanceOf":null,"options":null,"humanName":"cart Items","type":"CartsCartItems","inputType":"CreateCartsCartItemsInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"quantity","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"quantity","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"discount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"discount","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"item","array":false,"relationship":"items","instanceOf":"relationship","options":null,"humanName":"item","type":"Item","inputType":"String","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"coupons","relationship":"discounts","instanceOf":"relationship","options":null,"humanName":"coupons","type":"[Discount]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"customerId","relationship":false,"instanceOf":null,"options":null,"humanName":"customer Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"billing","relationship":false,"instanceOf":null,"options":null,"humanName":"billing","type":"CartsBilling","inputType":"CreateCartsBillingInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"paymentId","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"payment Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"firstName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"first Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lastName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"last Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"phoneNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"phone Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"CartsBillingAddress","inputType":"CreateCartsBillingAddressInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"venue","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"venue","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"city","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"city","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"state","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"state","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"zip","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"zip","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"country","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"country","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"human","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"human","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"coordinates","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"coordinates","type":"CartsBillingAddressCoordinates","inputType":null,"computed":true,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"lat","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lat","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lng","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lng","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"payment","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"payment","type":"CartsBillingPayment","inputType":"CreateCartsBillingPaymentInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"creditCard","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"credit Card","type":"CartsBillingPaymentCreditCard","inputType":"CreateCartsBillingPaymentCreditCardInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"cardNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"card Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"cardType","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"card Type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"expirationDate","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"expiration Date","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"bankAccount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"bank Account","type":"CartsBillingPaymentBankAccount","inputType":"CreateCartsBillingPaymentBankAccountInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"accountNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"account Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"accountType","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"account Type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"echeckType","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"echeck Type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"nameOnAccount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"name On Account","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"routingNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"routing Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]}]},{"name":"shipping","relationship":false,"instanceOf":null,"options":null,"humanName":"shipping","type":"CartsShipping","inputType":"CreateCartsShippingInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"method","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"method","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"price","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"price","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"addressId","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"firstName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"first Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lastName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"last Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"phoneNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"phone Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"CartsShippingAddress","inputType":"CreateCartsShippingAddressInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"venue","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"venue","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"city","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"city","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"state","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"state","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"zip","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"zip","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"country","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"country","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"human","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"human","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"coordinates","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"coordinates","type":"CartsShippingAddressCoordinates","inputType":null,"computed":true,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"lat","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lat","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lng","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lng","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"free","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"free","type":"Boolean","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"price","relationship":false,"instanceOf":null,"options":null,"humanName":"price","type":"CartsPrice","inputType":null,"computed":true,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"subtotal","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"subtotal","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"discount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"discount","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"total","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"total","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"discounts","ssrModel":null,"titleName":"Discounts","singular":"discount","titleSingular":"Discount","humanName":" Discounts","humanSingular":" Discount","library":"Mango-stand","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"type","relationship":false,"instanceOf":"select","options":["coupon","sale"],"humanName":"type","type":"String","inputType":"String","computed":false,"complex":false,"translate":true,"required":true,"customField":false,"global":false,"fields":null},{"name":"code","relationship":false,"instanceOf":null,"options":null,"humanName":"code","type":"String","inputType":"String","computed":false,"complex":false,"translate":true,"required":true,"customField":false,"global":false,"fields":null},{"name":"limitations","relationship":false,"instanceOf":null,"options":null,"humanName":"limitations","type":"DiscountsLimitations","inputType":"CreateDiscountsLimitationsInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"items","array":false,"relationship":"items","instanceOf":"relationship","options":null,"humanName":"items","type":"[Item]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"perCustomer","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"per Customer","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"totalUses","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"total Uses","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"perOrder","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"per Order","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"quantity","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"quantity","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"freeShipping","relationship":false,"instanceOf":null,"options":null,"humanName":"free Shipping","type":"Boolean","inputType":"Boolean","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"discount","relationship":false,"instanceOf":null,"options":null,"humanName":"discount","type":"DiscountsDiscount","inputType":"String","computed":false,"complex":true,"translate":true,"required":false,"customField":false,"example":"$12.50 or 50% etc.","global":false,"fields":[{"name":"type","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"value","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"value","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]}]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fields from '@cms/1. build/fields'
|
|
2
|
+
let { PlainText, Select, Timestamp, Relationship } = fields
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
|
|
6
|
+
title: PlainText({ required: true }),
|
|
7
|
+
author: Relationship({ collection: 'member', single: true, computed: (doc, req) => [req?.member?.id] || [] }),
|
|
8
|
+
editId: { computed: (doc, req) => req?.member?.id || null },
|
|
9
|
+
created: { computed: doc => doc.created || new Date, type: 'Float' },
|
|
10
|
+
updated: { computed: doc => doc.updated ? new Date : doc.created, type: 'Float' },
|
|
11
|
+
slug: { computed: doc => doc?.title?.toLowerCase()?.trim()?.replace(/[^a-zA-Z0-9\s]/g, '')?.replace(/\s/g, '-') },
|
|
12
|
+
startDate: Timestamp(),
|
|
13
|
+
endDate: Timestamp(),
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"port": 3001,
|
|
3
|
+
"siteName": "Example",
|
|
4
|
+
"siteDomain": "example.com",
|
|
5
|
+
|
|
6
|
+
"domain": "api.example.com",
|
|
7
|
+
|
|
8
|
+
"mongoURI":"mongodb://127.0.0.1:27017",
|
|
9
|
+
"database":"exampleMongoDB",
|
|
10
|
+
|
|
11
|
+
"s3AccessKeyId": null,
|
|
12
|
+
"s3AccessKeySecret": null,
|
|
13
|
+
"s3Region": null,
|
|
14
|
+
"s3Bucket":"exampleBucket",
|
|
15
|
+
|
|
16
|
+
"mailgunKey": null,
|
|
17
|
+
"mailgunDomain": null,
|
|
18
|
+
|
|
19
|
+
"algoliaAppId": null,
|
|
20
|
+
"algoliaSearchKey": null,
|
|
21
|
+
"algoliaIndex": null
|
|
22
|
+
|
|
23
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readEntries, updateEntry } from "@cms/1. build/libraries/mongo"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
fields: {
|
|
5
|
+
firstName: String,
|
|
6
|
+
lastName: String,
|
|
7
|
+
},
|
|
8
|
+
families: {
|
|
9
|
+
contributors: { singular: 'contributor' },
|
|
10
|
+
editors: { singular: 'editor' },
|
|
11
|
+
},
|
|
12
|
+
hooks: {
|
|
13
|
+
async created({ document }) {
|
|
14
|
+
|
|
15
|
+
let members = await readEntries({ collection: 'members' })
|
|
16
|
+
if (members.length == 1 && members[0].id == document.id) {
|
|
17
|
+
|
|
18
|
+
document.roles = ['admin']
|
|
19
|
+
document.authorId = document.id
|
|
20
|
+
document.author = document.id
|
|
21
|
+
|
|
22
|
+
await updateEntry({
|
|
23
|
+
collection: 'members',
|
|
24
|
+
document: {
|
|
25
|
+
roles: ['admin'],
|
|
26
|
+
author: [document.id],
|
|
27
|
+
authorId: document.id
|
|
28
|
+
},
|
|
29
|
+
search: { id: document.id }
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
test: {
|
|
3
|
+
async get(req) {
|
|
4
|
+
return `Mango is online! 🥭`
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
contact: {
|
|
8
|
+
admin: {
|
|
9
|
+
async post(req) {
|
|
10
|
+
return `You hit /contact/admin with a post request`
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
editor: {
|
|
14
|
+
async get(req) {
|
|
15
|
+
return `You hit /contact/editor with a get request`
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
const apiKey = 'YOUR-VIMEO-API-KEY'
|
|
3
|
+
|
|
4
|
+
const getVideoThumbnail = async function (video) {
|
|
5
|
+
let videoData = await axios.get(`https://vimeo.com/api/v2/video/${video.id}.json`)
|
|
6
|
+
return videoData?.data?.[0]?.thumbnail_large
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// const getDownloadLink = async function(video) {
|
|
10
|
+
// let url = `https://api.vimeo.com/videos/${video.id}?access_token=${apiKey}`
|
|
11
|
+
// let videoData = await axios.get(url)
|
|
12
|
+
// videoData = videoData?.data?.download?.filter(download => download?.quality != 'source')
|
|
13
|
+
// let bestDownload = videoData.reduce((challenger, champ) => challenger.height > champ.height ? challenger : champ, videoData[0])
|
|
14
|
+
// return bestDownload?.link
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
type: 'Vimeo',
|
|
19
|
+
inputType: String,
|
|
20
|
+
fields: {
|
|
21
|
+
id: {},
|
|
22
|
+
url: {},
|
|
23
|
+
thumbnail: {
|
|
24
|
+
computed: getVideoThumbnail,
|
|
25
|
+
expireCache: 60 * 60 * 24 * 30
|
|
26
|
+
},
|
|
27
|
+
// download: {
|
|
28
|
+
// computed: getDownloadLink,
|
|
29
|
+
// expireCache: 60*60*24*1
|
|
30
|
+
// },
|
|
31
|
+
},
|
|
32
|
+
translateInput: input => ({
|
|
33
|
+
id: `${input}`,
|
|
34
|
+
url: `https://vimeo.com/${input}`,
|
|
35
|
+
})
|
|
36
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui" />
|
|
7
|
+
|
|
8
|
+
<!-- Inject Meta -->
|
|
9
|
+
|
|
10
|
+
<title>Mango Starter</title>
|
|
11
|
+
<meta property='og:description' name="description" content="Here to make your life easier.">
|
|
12
|
+
|
|
13
|
+
</head>
|
|
14
|
+
<body class="w-full overflow-x-hidden overscroll-y-none touch-pan-x touch-pan-y">
|
|
15
|
+
<div id="app" class="font-sans"><div style="opacity: 0;"><!--SSR--></div></div>
|
|
16
|
+
<script type="module" src="/src/main.js"></script>
|
|
17
|
+
|
|
18
|
+
<!-- Main Entry Provision -->
|
|
19
|
+
<script>
|
|
20
|
+
window.mainEntry = null;
|
|
21
|
+
window.user = null;
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cfl-front",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dev": "vite",
|
|
6
|
+
"build": "vite build",
|
|
7
|
+
"preview": "vite preview",
|
|
8
|
+
"mango": "mango"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"mango-cms": "^0.1.16",
|
|
12
|
+
"@headlessui/vue": "^1.6.7",
|
|
13
|
+
"@mapbox/mapbox-gl-geocoder": "^5.0.0",
|
|
14
|
+
"@sweetalert2/theme-dark": "^5.0.10",
|
|
15
|
+
"@tinymce/tinymce-vue": "^4",
|
|
16
|
+
"@vitejs/plugin-vue": "^2.2.0",
|
|
17
|
+
"@vueup/vue-quill": "^1.0.0-beta.7",
|
|
18
|
+
"@vueuse/motion": "^2.0.0-beta.12",
|
|
19
|
+
"algoliasearch": "^4.12.0",
|
|
20
|
+
"axios": "^0.24.0",
|
|
21
|
+
"canvas-confetti": "^1.5.1",
|
|
22
|
+
"datebook": "^7.0.8",
|
|
23
|
+
"dayjs": "^1.10.7",
|
|
24
|
+
"express": "^4.18.1",
|
|
25
|
+
"google-maps": "^4.3.3",
|
|
26
|
+
"mapbox-gl": "^2.7.0",
|
|
27
|
+
"sweetalert2": "^11.4.0",
|
|
28
|
+
"vue": "^3.2.37",
|
|
29
|
+
"vue-router": "4",
|
|
30
|
+
"vue-slider-component": "^4.0.0-beta.4",
|
|
31
|
+
"vue-upload-component": "^3.1.2",
|
|
32
|
+
"vue3-clipboard": "^1.0.0",
|
|
33
|
+
"vue3-touch-events": "^4.1.0",
|
|
34
|
+
"vuedraggable": "^4.1.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"autoprefixer": "^10.4.0",
|
|
38
|
+
"postcss": "^8.4.5",
|
|
39
|
+
"tailwindcss": "^3.0.2",
|
|
40
|
+
"vite": "^4.2.1"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* /index.html 200
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const axios = require('axios')
|
|
4
|
+
const settings = require('../../config/config/settings.json')
|
|
5
|
+
const collections = require('../../config/config/.collections.json')
|
|
6
|
+
|
|
7
|
+
let port = 1337
|
|
8
|
+
let metaComment = '<!-- Inject Meta -->'
|
|
9
|
+
let appPlaceholder = '<!--SSR-->'
|
|
10
|
+
|
|
11
|
+
let serve = async function (req, res) {
|
|
12
|
+
|
|
13
|
+
// Cookies
|
|
14
|
+
let cookies
|
|
15
|
+
const { headers: { cookie } } = req;
|
|
16
|
+
if (cookie) {
|
|
17
|
+
const values = cookie.split(';').reduce((res, item) => {
|
|
18
|
+
const data = item.trim().split('=');
|
|
19
|
+
return { ...res, [data[0]]: data[1] };
|
|
20
|
+
}, {});
|
|
21
|
+
cookies = values;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// User Data Injection
|
|
25
|
+
let index = fs.readFileSync('./index.html', 'utf8')
|
|
26
|
+
let authorization = cookies?.Authorization
|
|
27
|
+
if (authorization) {
|
|
28
|
+
|
|
29
|
+
let hash = authorization.split(':')[0]
|
|
30
|
+
let userId = authorization.split(':')[1]
|
|
31
|
+
let user = (await axios.get(`http://localhost:${settings.port}/members?search={"password.hash": "${hash}", "id": "${userId}"}`, { headers: { 'Authorization': authorization } }))
|
|
32
|
+
user = user?.data?.response?.[0]
|
|
33
|
+
if (user) index = index.replace('window.user = null;', `window.user = ${JSON.stringify(user)};`)
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Define the collection and ID
|
|
38
|
+
let collection = req.path.split('/')[1]
|
|
39
|
+
let id = req.path.split('/')[2] ? req.path.split('/')[2] : null
|
|
40
|
+
|
|
41
|
+
console.log('collection', collection)
|
|
42
|
+
console.log('id', id)
|
|
43
|
+
|
|
44
|
+
let entry = (await axios.get(`http://localhost:${settings.port}/${collection}/${id}`))?.data?.response
|
|
45
|
+
|
|
46
|
+
console.log('entry', entry)
|
|
47
|
+
|
|
48
|
+
if (!entry) return res.send(index)
|
|
49
|
+
|
|
50
|
+
// Main Content Injection
|
|
51
|
+
try { index = index.replace('window.mainEntry = null;', `window.mainEntry = ${JSON.stringify(entry)};`) }
|
|
52
|
+
catch (e) { console.log(e) }
|
|
53
|
+
|
|
54
|
+
return res.send(index)
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const app = express()
|
|
59
|
+
|
|
60
|
+
app.get(["/index.html", "/"], serve);
|
|
61
|
+
app.use(express.static('./'))
|
|
62
|
+
app.get('/*', serve)
|
|
63
|
+
|
|
64
|
+
app.listen(port, () => {
|
|
65
|
+
console.log(`Example app listening at http://localhost:${port}`)
|
|
66
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="{'dark':darkMode.enabled}">
|
|
3
|
+
<div class="relative from-white to-slate-50 bg-gradient-to-b dark:from-black dark:to-gray-700 dark:selection:bg-gray-400 dark:text-gray-400 w-full min-h-screen">
|
|
4
|
+
|
|
5
|
+
<RouterView v-slot="{ Component, route }" @navHidden="navHidden = $event">
|
|
6
|
+
<Suspense :timeout="200" >
|
|
7
|
+
<Component :is="Component" :key="route.meta.usePathKey ? route.path : undefined" />
|
|
8
|
+
<template #fallback><spinner /></template>
|
|
9
|
+
</Suspense>
|
|
10
|
+
</RouterView>
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import login from './components/layout/login.vue'
|
|
18
|
+
export default {
|
|
19
|
+
components: { login },
|
|
20
|
+
inject: ['store','darkMode'],
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
navHidden: false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|