15 |

22 |
23 | Welcome to {import.meta.env.GENERAL_GREETING}
24 |
25 |
26 | Page has been open for {count} seconds.
27 |
28 |
29 | )
30 | } // App()
31 |
32 | export default App
33 |
--------------------------------------------------------------------------------
/config/utils/StyleLoader.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const loader = require('style-loader')
3 |
4 | module.exports = function () {}
5 |
6 | module.exports.pitch = function (request) {
7 | const result = loader.pitch.call(this, request)
8 | const index = result.indexOf(
9 | 'options.styleTagTransform = styleTagTransformFn;\n'
10 | )
11 | if (index === -1) return result
12 | const insertIndex = index - 1
13 |
14 | // eslint-disable-next-line prefer-destructuring
15 | const resourcePath = this.resourcePath
16 | const relativePath = path.relative(
17 | path.resolve(__dirname, '..'),
18 | resourcePath
19 | )
20 |
21 | const insertAttr = `
22 | if (typeof options.attributes !== 'object') {
23 | options.attributes = {}
24 | }
25 | options.attributes["source-path"] = '${relativePath}' // do anything you want
26 | runtimeOptions.attributes = options.attributes;
27 | `
28 |
29 | console.log(
30 | result.slice(0, insertIndex) + insertAttr + result.slice(insertIndex)
31 | )
32 |
33 | return result.slice(0, insertIndex) + insertAttr + result.slice(insertIndex)
34 | }
35 |
--------------------------------------------------------------------------------
/config/utils/SocketHandler.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 | const { Server } = require('socket.io')
3 | const { findFreePort, setPort } = require('./PortHandler')
4 |
5 | const server = http.createServer()
6 | const io = new Server(server)
7 |
8 | let socket = null
9 | const promiseIOConnection = new Promise(async (resolve) => {
10 | const SOCKET_IO_PORT = await findFreePort(3030)
11 | setPort(SOCKET_IO_PORT, 'SOCKET_IO_PORT')
12 |
13 | let callback = null
14 | io.on('connection', (initializeSocket) => {
15 | let sockets = {}
16 | // Save the list of all connections to a variable
17 | sockets[initializeSocket.io] = initializeSocket
18 | socket = initializeSocket
19 |
20 | // When disconnect, delete the socket with the variable
21 | initializeSocket.on('disconnect', () => {
22 | delete sockets[initializeSocket.id]
23 | })
24 |
25 | if (callback) {
26 | callback({ server, io, socket })
27 | } else {
28 | resolve({
29 | server,
30 | io,
31 | socket,
32 | setupCallback: function (fn) {
33 | callback = fn
34 | },
35 | })
36 | }
37 | })
38 |
39 | server.listen(SOCKET_IO_PORT)
40 | })
41 |
42 | module.exports = promiseIOConnection
43 |
--------------------------------------------------------------------------------
/config/utils/NetworkGenerator.js:
--------------------------------------------------------------------------------
1 | //=======================================
2 | // NOTE - generate External IP
3 | //=======================================
4 | const os = require('os')
5 | const OSNetworkInterfaces = os.networkInterfaces()
6 | const Ethernet =
7 | OSNetworkInterfaces.Ethernet || Object.values(OSNetworkInterfaces)
8 |
9 | let IPV4_ADDRESS = null
10 |
11 | if (Ethernet) {
12 | let ethernetFormatted = Ethernet
13 |
14 | if (ethernetFormatted[0].length) {
15 | let tmpEthernetFormatted = []
16 |
17 | ethernetFormatted.forEach(function (EthernetItem) {
18 | tmpEthernetFormatted = tmpEthernetFormatted.concat(EthernetItem)
19 | })
20 |
21 | ethernetFormatted = tmpEthernetFormatted
22 | }
23 |
24 | ethernetFormatted.some(function (ethernetItem) {
25 | const ethernetItemInfo =
26 | ethernetItem.family &&
27 | /ipv4|4/.test(ethernetItem.family?.toLowerCase?.() ?? ethernetItem.family)
28 | ? ethernetItem
29 | : null
30 |
31 | if (
32 | ethernetItemInfo &&
33 | ethernetItemInfo.address !== '127.0.0.1' &&
34 | (ethernetItemInfo.address.includes('192') ||
35 | ethernetItemInfo.address.includes('172'))
36 | ) {
37 | IPV4_ADDRESS = ethernetItemInfo.address
38 | return true
39 | }
40 | })
41 | }
42 |
43 | module.exports = { IPV4_ADDRESS }
44 |
--------------------------------------------------------------------------------
/config/types/dts-generator.mjs:
--------------------------------------------------------------------------------
1 | import {
2 | quicktype,
3 | InputData,
4 | jsonInputForTargetLanguage,
5 | } from 'quicktype-core'
6 | import {
7 | ENV_OBJECT_DEFAULT as ImportMeta,
8 | promiseENVWriteFileSync,
9 | } from '../env/env.mjs'
10 | import { writeFile } from 'fs'
11 | import { resolve } from 'path'
12 |
13 | async function quicktypeJSON(targetLanguage, jsonString) {
14 | const jsonInput = jsonInputForTargetLanguage(targetLanguage)
15 |
16 | // We could add multiple samples for the same desired
17 | // type, or many sources for other types. Here we're
18 | // just making one type from one piece of sample JSON.
19 | await jsonInput.addSource({
20 | name: 'ImportMeta',
21 | samples: [jsonString],
22 | })
23 |
24 | const inputData = new InputData()
25 | inputData.addInput(jsonInput)
26 |
27 | return await quicktype({
28 | inputData,
29 | lang: targetLanguage,
30 | rendererOptions: { 'just-types': 'true' },
31 | })
32 | }
33 |
34 | async function main() {
35 | const { lines: tdsGroup } = await quicktypeJSON(
36 | 'typescript',
37 | JSON.stringify({ env: ImportMeta })
38 | )
39 |
40 | writeFile(
41 | resolve('./config/types', 'ImportMeta.d.ts'),
42 | tdsGroup.join('\n').replace(/export\s/g, ''),
43 | function (err) {}
44 | )
45 | }
46 |
47 | main()
48 |
49 | export { promiseENVWriteFileSync }
50 |
--------------------------------------------------------------------------------
/src/assets/static/images/development/svg/diamond.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |