added pengguna,kurir page, with socket.io,need to switch this to node.js first
This commit is contained in:
55
assets/auth.js
Normal file
55
assets/auth.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// check local storage
|
||||||
|
if (!localStorage.getItem('user')) {
|
||||||
|
// redirect to login page
|
||||||
|
window.location.href = "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
const path = window.location.pathname;
|
||||||
|
|
||||||
|
const segments = path.split('/'); // ["", "kurir", "data"]
|
||||||
|
const target = segments[1];
|
||||||
|
// console.log(target);
|
||||||
|
|
||||||
|
if (target != 'kurir' && target != 'user') {
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
localStorage.removeItem('role');
|
||||||
|
// redirect to login page
|
||||||
|
window.location.href = "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fetch(target == 'kurir' ? '/kurir/check' : '/user/check', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(JSON.parse(localStorage.getItem('user')))
|
||||||
|
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.status >= 400) {
|
||||||
|
// remove local storage
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
localStorage.removeItem('role');
|
||||||
|
// redirect to login page
|
||||||
|
window.location.href = "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(res);
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
// console.log(data);
|
||||||
|
// document.getElementById('h5-title').innerHTML = data.username;
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
// console.log(err);
|
||||||
|
// remove local storage
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
localStorage.removeItem('role');
|
||||||
|
// redirect to login page
|
||||||
|
window.location.href = "/";
|
||||||
|
|
||||||
|
});
|
BIN
assets/images/habibie.jpg
Normal file
BIN
assets/images/habibie.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 MiB |
BIN
assets/images/person.png
Normal file
BIN
assets/images/person.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
@ -12,6 +12,9 @@ function logout() {
|
|||||||
confirmButtonColor: "#f60e0e"
|
confirmButtonColor: "#f60e0e"
|
||||||
}, function (t) {
|
}, function (t) {
|
||||||
if (t) {
|
if (t) {
|
||||||
|
// remove local storage
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
localStorage.removeItem('role');
|
||||||
window.location.href = "/"
|
window.location.href = "/"
|
||||||
}else{
|
}else{
|
||||||
// close swal
|
// close swal
|
||||||
|
22
assets/socket-io/LICENSE
Normal file
22
assets/socket-io/LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Guillermo Rauch and Socket.IO contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
273
assets/socket-io/Readme.md
Normal file
273
assets/socket-io/Readme.md
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
# socket.io
|
||||||
|
[](https://replit.com/@socketio/socketio-minimal-example)
|
||||||
|
[](#backers) [](#sponsors)
|
||||||
|
[](https://github.com/socketio/socket.io/actions)
|
||||||
|
[](https://www.npmjs.com/package/socket.io)
|
||||||
|

|
||||||
|
[](https://slackin-socketio.now.sh)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
Socket.IO enables real-time bidirectional event-based communication. It consists of:
|
||||||
|
|
||||||
|
- a Node.js server (this repository)
|
||||||
|
- a [Javascript client library](https://github.com/socketio/socket.io-client) for the browser (or a Node.js client)
|
||||||
|
|
||||||
|
Some implementations in other languages are also available:
|
||||||
|
|
||||||
|
- [Java](https://github.com/socketio/socket.io-client-java)
|
||||||
|
- [C++](https://github.com/socketio/socket.io-client-cpp)
|
||||||
|
- [Swift](https://github.com/socketio/socket.io-client-swift)
|
||||||
|
- [Dart](https://github.com/rikulo/socket.io-client-dart)
|
||||||
|
- [Python](https://github.com/miguelgrinberg/python-socketio)
|
||||||
|
- [.NET](https://github.com/doghappy/socket.io-client-csharp)
|
||||||
|
- [Rust](https://github.com/1c3t3a/rust-socketio)
|
||||||
|
- [PHP](https://github.com/ElephantIO/elephant.io)
|
||||||
|
|
||||||
|
Its main features are:
|
||||||
|
|
||||||
|
#### Reliability
|
||||||
|
|
||||||
|
Connections are established even in the presence of:
|
||||||
|
- proxies and load balancers.
|
||||||
|
- personal firewall and antivirus software.
|
||||||
|
|
||||||
|
For this purpose, it relies on [Engine.IO](https://github.com/socketio/engine.io), which first establishes a long-polling connection, then tries to upgrade to better transports that are "tested" on the side, like WebSocket. Please see the [Goals](https://github.com/socketio/engine.io#goals) section for more information.
|
||||||
|
|
||||||
|
#### Auto-reconnection support
|
||||||
|
|
||||||
|
Unless instructed otherwise a disconnected client will try to reconnect forever, until the server is available again. Please see the available reconnection options [here](https://socket.io/docs/v3/client-api/#new-Manager-url-options).
|
||||||
|
|
||||||
|
#### Disconnection detection
|
||||||
|
|
||||||
|
A heartbeat mechanism is implemented at the Engine.IO level, allowing both the server and the client to know when the other one is not responding anymore.
|
||||||
|
|
||||||
|
That functionality is achieved with timers set on both the server and the client, with timeout values (the `pingInterval` and `pingTimeout` parameters) shared during the connection handshake. Those timers require any subsequent client calls to be directed to the same server, hence the `sticky-session` requirement when using multiples nodes.
|
||||||
|
|
||||||
|
#### Binary support
|
||||||
|
|
||||||
|
Any serializable data structures can be emitted, including:
|
||||||
|
|
||||||
|
- [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) and [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) in the browser
|
||||||
|
- [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) and [Buffer](https://nodejs.org/api/buffer.html) in Node.js
|
||||||
|
|
||||||
|
#### Simple and convenient API
|
||||||
|
|
||||||
|
Sample code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
io.on('connection', socket => {
|
||||||
|
socket.emit('request', /* … */); // emit an event to the socket
|
||||||
|
io.emit('broadcast', /* … */); // emit an event to all connected sockets
|
||||||
|
socket.on('reply', () => { /* … */ }); // listen to the event
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Cross-browser
|
||||||
|
|
||||||
|
Browser support is tested in Sauce Labs:
|
||||||
|
|
||||||
|
[](https://saucelabs.com/u/socket)
|
||||||
|
|
||||||
|
#### Multiplexing support
|
||||||
|
|
||||||
|
In order to create separation of concerns within your application (for example per module, or based on permissions), Socket.IO allows you to create several `Namespaces`, which will act as separate communication channels but will share the same underlying connection.
|
||||||
|
|
||||||
|
#### Room support
|
||||||
|
|
||||||
|
Within each `Namespace`, you can define arbitrary channels, called `Rooms`, that sockets can join and leave. You can then broadcast to any given room, reaching every socket that has joined it.
|
||||||
|
|
||||||
|
This is a useful feature to send notifications to a group of users, or to a given user connected on several devices for example.
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Socket.IO is not a WebSocket implementation. Although Socket.IO indeed uses WebSocket as a transport when possible, it adds some metadata to each packet: the packet type, the namespace and the ack id when a message acknowledgement is needed. That is why a WebSocket client will not be able to successfully connect to a Socket.IO server, and a Socket.IO client will not be able to connect to a WebSocket server (like `ws://echo.websocket.org`) either. Please see the protocol specification [here](https://github.com/socketio/socket.io-protocol).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
// with npm
|
||||||
|
npm install socket.io
|
||||||
|
|
||||||
|
// with yarn
|
||||||
|
yarn add socket.io
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
|
||||||
|
The following example attaches socket.io to a plain Node.JS
|
||||||
|
HTTP server listening on port `3000`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const server = require('http').createServer();
|
||||||
|
const io = require('socket.io')(server);
|
||||||
|
io.on('connection', client => {
|
||||||
|
client.on('event', data => { /* … */ });
|
||||||
|
client.on('disconnect', () => { /* … */ });
|
||||||
|
});
|
||||||
|
server.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Standalone
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('socket.io')();
|
||||||
|
io.on('connection', client => { ... });
|
||||||
|
io.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Module syntax
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { Server } from "socket.io";
|
||||||
|
const io = new Server(server);
|
||||||
|
io.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### In conjunction with Express
|
||||||
|
|
||||||
|
Starting with **3.0**, express applications have become request handler
|
||||||
|
functions that you pass to `http` or `http` `Server` instances. You need
|
||||||
|
to pass the `Server` to `socket.io`, not the express application
|
||||||
|
function. Also make sure to call `.listen` on the `server`, not the `app`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const app = require('express')();
|
||||||
|
const server = require('http').createServer(app);
|
||||||
|
const io = require('socket.io')(server);
|
||||||
|
io.on('connection', () => { /* … */ });
|
||||||
|
server.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### In conjunction with Koa
|
||||||
|
|
||||||
|
Like Express.JS, Koa works by exposing an application as a request
|
||||||
|
handler function, but only by calling the `callback` method.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const app = require('koa')();
|
||||||
|
const server = require('http').createServer(app.callback());
|
||||||
|
const io = require('socket.io')(server);
|
||||||
|
io.on('connection', () => { /* … */ });
|
||||||
|
server.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### In conjunction with Fastify
|
||||||
|
|
||||||
|
To integrate Socket.io in your Fastify application you just need to
|
||||||
|
register `fastify-socket.io` plugin. It will create a `decorator`
|
||||||
|
called `io`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const app = require('fastify')();
|
||||||
|
app.register(require('fastify-socket.io'));
|
||||||
|
app.ready().then(() => {
|
||||||
|
app.io.on('connection', () => { /* … */ });
|
||||||
|
})
|
||||||
|
app.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Please see the documentation [here](https://socket.io/docs/).
|
||||||
|
|
||||||
|
The source code of the website can be found [here](https://github.com/socketio/socket.io-website). Contributions are welcome!
|
||||||
|
|
||||||
|
## Debug / logging
|
||||||
|
|
||||||
|
Socket.IO is powered by [debug](https://github.com/visionmedia/debug).
|
||||||
|
In order to see all the debug output, run your app with the environment variable
|
||||||
|
`DEBUG` including the desired scope.
|
||||||
|
|
||||||
|
To see the output from all of Socket.IO's debugging scopes you can use:
|
||||||
|
|
||||||
|
```
|
||||||
|
DEBUG=socket.io* node myapp
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
```
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
This runs the `gulp` task `test`. By default the test will be run with the source code in `lib` directory.
|
||||||
|
|
||||||
|
Set the environmental variable `TEST_VERSION` to `compat` to test the transpiled es5-compat version of the code.
|
||||||
|
|
||||||
|
The `gulp` task `test` will always transpile the source code into es5 and export to `dist` first before running the test.
|
||||||
|
|
||||||
|
|
||||||
|
## Backers
|
||||||
|
|
||||||
|
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/socketio#backer)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/socketio/backer/0/website" target="_blank"><img src="https://opencollective.com/socketio/backer/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/1/website" target="_blank"><img src="https://opencollective.com/socketio/backer/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/2/website" target="_blank"><img src="https://opencollective.com/socketio/backer/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/3/website" target="_blank"><img src="https://opencollective.com/socketio/backer/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/4/website" target="_blank"><img src="https://opencollective.com/socketio/backer/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/5/website" target="_blank"><img src="https://opencollective.com/socketio/backer/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/6/website" target="_blank"><img src="https://opencollective.com/socketio/backer/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/7/website" target="_blank"><img src="https://opencollective.com/socketio/backer/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/8/website" target="_blank"><img src="https://opencollective.com/socketio/backer/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/9/website" target="_blank"><img src="https://opencollective.com/socketio/backer/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/10/website" target="_blank"><img src="https://opencollective.com/socketio/backer/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/11/website" target="_blank"><img src="https://opencollective.com/socketio/backer/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/12/website" target="_blank"><img src="https://opencollective.com/socketio/backer/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/13/website" target="_blank"><img src="https://opencollective.com/socketio/backer/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/14/website" target="_blank"><img src="https://opencollective.com/socketio/backer/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/15/website" target="_blank"><img src="https://opencollective.com/socketio/backer/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/16/website" target="_blank"><img src="https://opencollective.com/socketio/backer/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/17/website" target="_blank"><img src="https://opencollective.com/socketio/backer/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/18/website" target="_blank"><img src="https://opencollective.com/socketio/backer/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/19/website" target="_blank"><img src="https://opencollective.com/socketio/backer/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/20/website" target="_blank"><img src="https://opencollective.com/socketio/backer/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/21/website" target="_blank"><img src="https://opencollective.com/socketio/backer/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/22/website" target="_blank"><img src="https://opencollective.com/socketio/backer/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/23/website" target="_blank"><img src="https://opencollective.com/socketio/backer/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/24/website" target="_blank"><img src="https://opencollective.com/socketio/backer/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/25/website" target="_blank"><img src="https://opencollective.com/socketio/backer/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/26/website" target="_blank"><img src="https://opencollective.com/socketio/backer/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/27/website" target="_blank"><img src="https://opencollective.com/socketio/backer/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/28/website" target="_blank"><img src="https://opencollective.com/socketio/backer/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/29/website" target="_blank"><img src="https://opencollective.com/socketio/backer/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/socketio#sponsor)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/0/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/1/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/2/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/3/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/4/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/5/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/6/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/7/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/8/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/9/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/10/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/11/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/12/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/13/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/14/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/15/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/16/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/17/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/18/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/19/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/20/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/21/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/22/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/23/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/24/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/25/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/26/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/27/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/28/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/29/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
7
assets/socket-io/client-dist/socket.io.esm.min.js
vendored
Normal file
7
assets/socket-io/client-dist/socket.io.esm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/socket-io/client-dist/socket.io.esm.min.js.map
Normal file
1
assets/socket-io/client-dist/socket.io.esm.min.js.map
Normal file
File diff suppressed because one or more lines are too long
4908
assets/socket-io/client-dist/socket.io.js
Normal file
4908
assets/socket-io/client-dist/socket.io.js
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/socket-io/client-dist/socket.io.js.map
Normal file
1
assets/socket-io/client-dist/socket.io.js.map
Normal file
File diff suppressed because one or more lines are too long
7
assets/socket-io/client-dist/socket.io.min.js
vendored
Normal file
7
assets/socket-io/client-dist/socket.io.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/socket-io/client-dist/socket.io.min.js.map
Normal file
1
assets/socket-io/client-dist/socket.io.min.js.map
Normal file
File diff suppressed because one or more lines are too long
7
assets/socket-io/client-dist/socket.io.msgpack.min.js
vendored
Normal file
7
assets/socket-io/client-dist/socket.io.msgpack.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
85
assets/socket-io/package.json
Normal file
85
assets/socket-io/package.json
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
{
|
||||||
|
"name": "socket.io",
|
||||||
|
"version": "4.8.1",
|
||||||
|
"description": "node.js realtime framework server",
|
||||||
|
"keywords": [
|
||||||
|
"realtime",
|
||||||
|
"framework",
|
||||||
|
"websocket",
|
||||||
|
"tcp",
|
||||||
|
"events",
|
||||||
|
"socket",
|
||||||
|
"io"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"dist/",
|
||||||
|
"client-dist/",
|
||||||
|
"wrapper.mjs",
|
||||||
|
"!**/*.tsbuildinfo"
|
||||||
|
],
|
||||||
|
"directories": {
|
||||||
|
"doc": "docs/",
|
||||||
|
"example": "example/",
|
||||||
|
"lib": "lib/",
|
||||||
|
"test": "test/"
|
||||||
|
},
|
||||||
|
"type": "commonjs",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"exports": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./wrapper.mjs",
|
||||||
|
"require": "./dist/index.js"
|
||||||
|
},
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"license": "MIT",
|
||||||
|
"homepage": "https://github.com/socketio/socket.io/tree/main/packages/socket.io#readme",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/socketio/socket.io.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/socketio/socket.io/issues"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"compile": "rimraf ./dist && tsc",
|
||||||
|
"test": "npm run format:check && npm run compile && npm run test:types && npm run test:unit",
|
||||||
|
"test:types": "tsd",
|
||||||
|
"test:unit": "nyc mocha --require ts-node/register --reporter spec --slow 200 --bail --timeout 10000 test/index.ts",
|
||||||
|
"format:check": "prettier --check \"lib/**/*.ts\" \"test/**/*.ts\"",
|
||||||
|
"format:fix": "prettier --write \"lib/**/*.ts\" \"test/**/*.ts\"",
|
||||||
|
"prepack": "npm run compile"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"accepts": "~1.3.4",
|
||||||
|
"base64id": "~2.0.0",
|
||||||
|
"cors": "~2.8.5",
|
||||||
|
"debug": "~4.3.2",
|
||||||
|
"engine.io": "~6.6.0",
|
||||||
|
"socket.io-adapter": "~2.5.2",
|
||||||
|
"socket.io-parser": "~4.2.4"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Guillermo Rauch",
|
||||||
|
"email": "rauchg@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Arnout Kazemier",
|
||||||
|
"email": "info@3rd-eden.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vladimir Dronnikov",
|
||||||
|
"email": "dronnikov@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Einar Otto Stangvik",
|
||||||
|
"email": "einaros@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.2.0"
|
||||||
|
},
|
||||||
|
"tsd": {
|
||||||
|
"directory": "test"
|
||||||
|
}
|
||||||
|
}
|
3
assets/socket-io/wrapper.mjs
Normal file
3
assets/socket-io/wrapper.mjs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import io from "./dist/index.js";
|
||||||
|
|
||||||
|
export const {Server, Namespace, Socket} = io;
|
22
assets/socketnya/LICENSE
Normal file
22
assets/socketnya/LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2018 Automattic <dev@cloudup.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
271
assets/socketnya/Readme.md
Normal file
271
assets/socketnya/Readme.md
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
# socket.io
|
||||||
|
[](https://replit.com/@socketio/socketio-minimal-example)
|
||||||
|
[](#backers) [](#sponsors)
|
||||||
|
[](https://github.com/socketio/socket.io/actions)
|
||||||
|
[](https://david-dm.org/socketio/socket.io)
|
||||||
|
[](https://david-dm.org/socketio/socket.io#info=devDependencies)
|
||||||
|
[](https://www.npmjs.com/package/socket.io)
|
||||||
|

|
||||||
|
[](https://slackin-socketio.now.sh)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
Socket.IO enables real-time bidirectional event-based communication. It consists of:
|
||||||
|
|
||||||
|
- a Node.js server (this repository)
|
||||||
|
- a [Javascript client library](https://github.com/socketio/socket.io-client) for the browser (or a Node.js client)
|
||||||
|
|
||||||
|
Some implementations in other languages are also available:
|
||||||
|
|
||||||
|
- [Java](https://github.com/socketio/socket.io-client-java)
|
||||||
|
- [C++](https://github.com/socketio/socket.io-client-cpp)
|
||||||
|
- [Swift](https://github.com/socketio/socket.io-client-swift)
|
||||||
|
- [Dart](https://github.com/rikulo/socket.io-client-dart)
|
||||||
|
- [Python](https://github.com/miguelgrinberg/python-socketio)
|
||||||
|
- [.NET](https://github.com/doghappy/socket.io-client-csharp)
|
||||||
|
|
||||||
|
Its main features are:
|
||||||
|
|
||||||
|
#### Reliability
|
||||||
|
|
||||||
|
Connections are established even in the presence of:
|
||||||
|
- proxies and load balancers.
|
||||||
|
- personal firewall and antivirus software.
|
||||||
|
|
||||||
|
For this purpose, it relies on [Engine.IO](https://github.com/socketio/engine.io), which first establishes a long-polling connection, then tries to upgrade to better transports that are "tested" on the side, like WebSocket. Please see the [Goals](https://github.com/socketio/engine.io#goals) section for more information.
|
||||||
|
|
||||||
|
#### Auto-reconnection support
|
||||||
|
|
||||||
|
Unless instructed otherwise a disconnected client will try to reconnect forever, until the server is available again. Please see the available reconnection options [here](https://socket.io/docs/v3/client-api/#new-Manager-url-options).
|
||||||
|
|
||||||
|
#### Disconnection detection
|
||||||
|
|
||||||
|
A heartbeat mechanism is implemented at the Engine.IO level, allowing both the server and the client to know when the other one is not responding anymore.
|
||||||
|
|
||||||
|
That functionality is achieved with timers set on both the server and the client, with timeout values (the `pingInterval` and `pingTimeout` parameters) shared during the connection handshake. Those timers require any subsequent client calls to be directed to the same server, hence the `sticky-session` requirement when using multiples nodes.
|
||||||
|
|
||||||
|
#### Binary support
|
||||||
|
|
||||||
|
Any serializable data structures can be emitted, including:
|
||||||
|
|
||||||
|
- [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) and [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) in the browser
|
||||||
|
- [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) and [Buffer](https://nodejs.org/api/buffer.html) in Node.js
|
||||||
|
|
||||||
|
#### Simple and convenient API
|
||||||
|
|
||||||
|
Sample code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
io.on('connection', socket => {
|
||||||
|
socket.emit('request', /* … */); // emit an event to the socket
|
||||||
|
io.emit('broadcast', /* … */); // emit an event to all connected sockets
|
||||||
|
socket.on('reply', () => { /* … */ }); // listen to the event
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Cross-browser
|
||||||
|
|
||||||
|
Browser support is tested in Sauce Labs:
|
||||||
|
|
||||||
|
[](https://saucelabs.com/u/socket)
|
||||||
|
|
||||||
|
#### Multiplexing support
|
||||||
|
|
||||||
|
In order to create separation of concerns within your application (for example per module, or based on permissions), Socket.IO allows you to create several `Namespaces`, which will act as separate communication channels but will share the same underlying connection.
|
||||||
|
|
||||||
|
#### Room support
|
||||||
|
|
||||||
|
Within each `Namespace`, you can define arbitrary channels, called `Rooms`, that sockets can join and leave. You can then broadcast to any given room, reaching every socket that has joined it.
|
||||||
|
|
||||||
|
This is a useful feature to send notifications to a group of users, or to a given user connected on several devices for example.
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Socket.IO is not a WebSocket implementation. Although Socket.IO indeed uses WebSocket as a transport when possible, it adds some metadata to each packet: the packet type, the namespace and the ack id when a message acknowledgement is needed. That is why a WebSocket client will not be able to successfully connect to a Socket.IO server, and a Socket.IO client will not be able to connect to a WebSocket server (like `ws://echo.websocket.org`) either. Please see the protocol specification [here](https://github.com/socketio/socket.io-protocol).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
// with npm
|
||||||
|
npm install socket.io
|
||||||
|
|
||||||
|
// with yarn
|
||||||
|
yarn add socket.io
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
|
||||||
|
The following example attaches socket.io to a plain Node.JS
|
||||||
|
HTTP server listening on port `3000`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const server = require('http').createServer();
|
||||||
|
const io = require('socket.io')(server);
|
||||||
|
io.on('connection', client => {
|
||||||
|
client.on('event', data => { /* … */ });
|
||||||
|
client.on('disconnect', () => { /* … */ });
|
||||||
|
});
|
||||||
|
server.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Standalone
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('socket.io')();
|
||||||
|
io.on('connection', client => { ... });
|
||||||
|
io.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Module syntax
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { Server } from "socket.io";
|
||||||
|
const io = new Server(server);
|
||||||
|
io.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### In conjunction with Express
|
||||||
|
|
||||||
|
Starting with **3.0**, express applications have become request handler
|
||||||
|
functions that you pass to `http` or `http` `Server` instances. You need
|
||||||
|
to pass the `Server` to `socket.io`, and not the express application
|
||||||
|
function. Also make sure to call `.listen` on the `server`, not the `app`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const app = require('express')();
|
||||||
|
const server = require('http').createServer(app);
|
||||||
|
const io = require('socket.io')(server);
|
||||||
|
io.on('connection', () => { /* … */ });
|
||||||
|
server.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### In conjunction with Koa
|
||||||
|
|
||||||
|
Like Express.JS, Koa works by exposing an application as a request
|
||||||
|
handler function, but only by calling the `callback` method.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const app = require('koa')();
|
||||||
|
const server = require('http').createServer(app.callback());
|
||||||
|
const io = require('socket.io')(server);
|
||||||
|
io.on('connection', () => { /* … */ });
|
||||||
|
server.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
### In conjunction with Fastify
|
||||||
|
|
||||||
|
To integrate Socket.io in your Fastify application you just need to
|
||||||
|
register `fastify-socket.io` plugin. It will create a `decorator`
|
||||||
|
called `io`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const app = require('fastify')();
|
||||||
|
app.register(require('fastify-socket.io'));
|
||||||
|
app.io.on('connection', () => { /* … */ });
|
||||||
|
app.listen(3000);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Please see the documentation [here](https://socket.io/docs/).
|
||||||
|
|
||||||
|
The source code of the website can be found [here](https://github.com/socketio/socket.io-website). Contributions are welcome!
|
||||||
|
|
||||||
|
## Debug / logging
|
||||||
|
|
||||||
|
Socket.IO is powered by [debug](https://github.com/visionmedia/debug).
|
||||||
|
In order to see all the debug output, run your app with the environment variable
|
||||||
|
`DEBUG` including the desired scope.
|
||||||
|
|
||||||
|
To see the output from all of Socket.IO's debugging scopes you can use:
|
||||||
|
|
||||||
|
```
|
||||||
|
DEBUG=socket.io* node myapp
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
```
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
This runs the `gulp` task `test`. By default the test will be run with the source code in `lib` directory.
|
||||||
|
|
||||||
|
Set the environmental variable `TEST_VERSION` to `compat` to test the transpiled es5-compat version of the code.
|
||||||
|
|
||||||
|
The `gulp` task `test` will always transpile the source code into es5 and export to `dist` first before running the test.
|
||||||
|
|
||||||
|
|
||||||
|
## Backers
|
||||||
|
|
||||||
|
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/socketio#backer)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/socketio/backer/0/website" target="_blank"><img src="https://opencollective.com/socketio/backer/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/1/website" target="_blank"><img src="https://opencollective.com/socketio/backer/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/2/website" target="_blank"><img src="https://opencollective.com/socketio/backer/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/3/website" target="_blank"><img src="https://opencollective.com/socketio/backer/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/4/website" target="_blank"><img src="https://opencollective.com/socketio/backer/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/5/website" target="_blank"><img src="https://opencollective.com/socketio/backer/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/6/website" target="_blank"><img src="https://opencollective.com/socketio/backer/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/7/website" target="_blank"><img src="https://opencollective.com/socketio/backer/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/8/website" target="_blank"><img src="https://opencollective.com/socketio/backer/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/9/website" target="_blank"><img src="https://opencollective.com/socketio/backer/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/10/website" target="_blank"><img src="https://opencollective.com/socketio/backer/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/11/website" target="_blank"><img src="https://opencollective.com/socketio/backer/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/12/website" target="_blank"><img src="https://opencollective.com/socketio/backer/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/13/website" target="_blank"><img src="https://opencollective.com/socketio/backer/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/14/website" target="_blank"><img src="https://opencollective.com/socketio/backer/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/15/website" target="_blank"><img src="https://opencollective.com/socketio/backer/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/16/website" target="_blank"><img src="https://opencollective.com/socketio/backer/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/17/website" target="_blank"><img src="https://opencollective.com/socketio/backer/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/18/website" target="_blank"><img src="https://opencollective.com/socketio/backer/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/19/website" target="_blank"><img src="https://opencollective.com/socketio/backer/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/20/website" target="_blank"><img src="https://opencollective.com/socketio/backer/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/21/website" target="_blank"><img src="https://opencollective.com/socketio/backer/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/22/website" target="_blank"><img src="https://opencollective.com/socketio/backer/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/23/website" target="_blank"><img src="https://opencollective.com/socketio/backer/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/24/website" target="_blank"><img src="https://opencollective.com/socketio/backer/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/25/website" target="_blank"><img src="https://opencollective.com/socketio/backer/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/26/website" target="_blank"><img src="https://opencollective.com/socketio/backer/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/27/website" target="_blank"><img src="https://opencollective.com/socketio/backer/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/28/website" target="_blank"><img src="https://opencollective.com/socketio/backer/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/backer/29/website" target="_blank"><img src="https://opencollective.com/socketio/backer/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/socketio#sponsor)]
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/0/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/0/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/1/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/1/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/2/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/2/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/3/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/3/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/4/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/4/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/5/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/5/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/6/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/6/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/7/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/7/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/8/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/8/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/9/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/9/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/10/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/10/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/11/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/11/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/12/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/12/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/13/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/13/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/14/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/15/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/16/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/17/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/18/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/19/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/20/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/21/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/22/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/23/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/24/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/25/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/26/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/27/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/28/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/socketio/sponsor/29/website" target="_blank"><img src="https://opencollective.com/socketio/sponsor/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
7
assets/socketnya/client-dist/socket.io.esm.min.js
vendored
Normal file
7
assets/socketnya/client-dist/socket.io.esm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/socketnya/client-dist/socket.io.esm.min.js.map
Normal file
1
assets/socketnya/client-dist/socket.io.esm.min.js.map
Normal file
File diff suppressed because one or more lines are too long
4240
assets/socketnya/client-dist/socket.io.js
Normal file
4240
assets/socketnya/client-dist/socket.io.js
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/socketnya/client-dist/socket.io.js.map
Normal file
1
assets/socketnya/client-dist/socket.io.js.map
Normal file
File diff suppressed because one or more lines are too long
7
assets/socketnya/client-dist/socket.io.min.js
vendored
Normal file
7
assets/socketnya/client-dist/socket.io.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/socketnya/client-dist/socket.io.min.js.map
Normal file
1
assets/socketnya/client-dist/socket.io.min.js.map
Normal file
File diff suppressed because one or more lines are too long
7
assets/socketnya/client-dist/socket.io.msgpack.min.js
vendored
Normal file
7
assets/socketnya/client-dist/socket.io.msgpack.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
126
assets/socketnya/package.json
Normal file
126
assets/socketnya/package.json
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
{
|
||||||
|
"_from": "socket.io",
|
||||||
|
"_id": "socket.io@4.4.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-s04vrBswdQBUmuWJuuNTmXUVJhP0cVky8bBDhdkf8y0Ptsu7fKU2LuLbts9g+pdmAdyMMn8F/9Mf1/wbtUN0fg==",
|
||||||
|
"_location": "/socket.io",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "tag",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "socket.io",
|
||||||
|
"name": "socket.io",
|
||||||
|
"escapedName": "socket.io",
|
||||||
|
"rawSpec": "",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "latest"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
|
"/"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.1.tgz",
|
||||||
|
"_shasum": "cd6de29e277a161d176832bb24f64ee045c56ab8",
|
||||||
|
"_spec": "socket.io",
|
||||||
|
"_where": "E:\\xampp\\htdocs\\flood_app\\backend",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/socketio/socket.io/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Guillermo Rauch",
|
||||||
|
"email": "rauchg@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Arnout Kazemier",
|
||||||
|
"email": "info@3rd-eden.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vladimir Dronnikov",
|
||||||
|
"email": "dronnikov@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Einar Otto Stangvik",
|
||||||
|
"email": "einaros@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"accepts": "~1.3.4",
|
||||||
|
"base64id": "~2.0.0",
|
||||||
|
"debug": "~4.3.2",
|
||||||
|
"engine.io": "~6.1.0",
|
||||||
|
"socket.io-adapter": "~2.3.3",
|
||||||
|
"socket.io-parser": "~4.0.4"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "node.js realtime framework server",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/mocha": "^9.0.0",
|
||||||
|
"expect.js": "0.3.1",
|
||||||
|
"mocha": "^3.5.3",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
|
"prettier": "^2.3.2",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"socket.io-client": "4.4.1",
|
||||||
|
"socket.io-client-v2": "npm:socket.io-client@^2.4.0",
|
||||||
|
"superagent": "^6.1.0",
|
||||||
|
"supertest": "^6.1.6",
|
||||||
|
"ts-node": "^10.2.1",
|
||||||
|
"tsd": "^0.17.0",
|
||||||
|
"typescript": "^4.4.2",
|
||||||
|
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.0.0"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"doc": "docs/",
|
||||||
|
"example": "example/",
|
||||||
|
"lib": "lib/",
|
||||||
|
"test": "test/"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"exports": {
|
||||||
|
"import": "./wrapper.mjs",
|
||||||
|
"require": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/",
|
||||||
|
"client-dist/",
|
||||||
|
"wrapper.mjs",
|
||||||
|
"!**/*.tsbuildinfo"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/socketio/socket.io#readme",
|
||||||
|
"keywords": [
|
||||||
|
"realtime",
|
||||||
|
"framework",
|
||||||
|
"websocket",
|
||||||
|
"tcp",
|
||||||
|
"events",
|
||||||
|
"socket",
|
||||||
|
"io"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"name": "socket.io",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/socketio/socket.io.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"compile": "rimraf ./dist && tsc",
|
||||||
|
"format:check": "prettier --check \"lib/**/*.ts\" \"test/**/*.ts\"",
|
||||||
|
"format:fix": "prettier --write \"lib/**/*.ts\" \"test/**/*.ts\"",
|
||||||
|
"prepack": "npm run compile",
|
||||||
|
"test": "npm run format:check && npm run compile && npm run test:types && npm run test:unit",
|
||||||
|
"test:types": "tsd",
|
||||||
|
"test:unit": "nyc mocha --require ts-node/register --reporter spec --slow 200 --bail --timeout 10000 test/socket.io.ts"
|
||||||
|
},
|
||||||
|
"tsd": {
|
||||||
|
"directory": "test"
|
||||||
|
},
|
||||||
|
"type": "commonjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"version": "4.4.1"
|
||||||
|
}
|
3
assets/socketnya/wrapper.mjs
Normal file
3
assets/socketnya/wrapper.mjs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import io from "./dist/index.js";
|
||||||
|
|
||||||
|
export const {Server, Namespace, Socket} = io;
|
77
bot.ts
Normal file
77
bot.ts
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import { create, Whatsapp } from 'venom-bot';
|
||||||
|
import express, { type Request, type Response } from 'express';
|
||||||
|
|
||||||
|
let client: Whatsapp;
|
||||||
|
|
||||||
|
async function initBot() {
|
||||||
|
try {
|
||||||
|
client = await create({
|
||||||
|
session: 'kurir-bot',
|
||||||
|
headless: 'new',
|
||||||
|
browserArgs: ['--no-sandbox'],
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('WhatsApp bot connected');
|
||||||
|
|
||||||
|
client.onMessage(async (message) => {
|
||||||
|
if (message.body === 'hi' && !message.isGroupMsg) {
|
||||||
|
await client.sendText(message.from, 'Hello! 👋');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start the HTTP server after bot is ready
|
||||||
|
startServer();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to initialize bot:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startServer() {
|
||||||
|
const app = express();
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
|
app.post('/send-otp', async (req: Request, res: Response) => {
|
||||||
|
let { number, otp } = req.body;
|
||||||
|
|
||||||
|
// remove the 0 in front of the number
|
||||||
|
if (number.startsWith('0')) {
|
||||||
|
number = number.slice(1);
|
||||||
|
}
|
||||||
|
// add +62 to the number
|
||||||
|
number = `+62${number}`;
|
||||||
|
// convert to int
|
||||||
|
number = parseInt(number);
|
||||||
|
console.log(`Sending OTP ${otp} to ${number}`);
|
||||||
|
|
||||||
|
const formattedNumber = `${number}@c.us`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await client.sendText(formattedNumber, `Kode OTP Anda: ${otp}`);
|
||||||
|
console.log(`OTP ${otp} sent to ${number}`);
|
||||||
|
res.status(200).json({ success: true });
|
||||||
|
} catch (error) {
|
||||||
|
// console.error(error);
|
||||||
|
if (
|
||||||
|
typeof error === 'object' &&
|
||||||
|
error !== null &&
|
||||||
|
'status' in error &&
|
||||||
|
'text' in error
|
||||||
|
) {
|
||||||
|
const err = error as { status: number; text: string };
|
||||||
|
console.log(err.status);
|
||||||
|
console.log(err.text);
|
||||||
|
const text_response = err.status == 404 ? 'Nomor Telpon Tidak Terdaftar Pada Whatsapp<br />Silahkan Periksa Nomor Telpon Anda' : err.text
|
||||||
|
res.status(err.status).json(text_response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.status(500).json({ error: 'Failed to send OTP.' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const PORT = 3012;
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`WhatsApp bot API listening on http://localhost:${PORT}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
initBot();
|
@ -9,28 +9,28 @@ export async function testDatabaseConnection() {
|
|||||||
await mongoose.connect(process.env.MONGODB_URI as string);
|
await mongoose.connect(process.env.MONGODB_URI as string);
|
||||||
console.log('MongoDB Connection Successful!');
|
console.log('MongoDB Connection Successful!');
|
||||||
|
|
||||||
// Define a simple schema for the "test" collection
|
// // Define a simple schema for the "test" collection
|
||||||
const testSchema = new Schema({
|
// const testSchema = new Schema({
|
||||||
name: String,
|
// name: String,
|
||||||
value: Number,
|
// value: Number,
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Create a model based on the schema
|
// // Create a model based on the schema
|
||||||
const TestModel = mongoose.model('Test', testSchema);
|
// const TestModel = mongoose.model('Test', testSchema);
|
||||||
|
|
||||||
// Insert a single document with a random value
|
// // Insert a single document with a random value
|
||||||
const singleData = { name: 'Random Item', value: Math.floor(Math.random() * 100) }; // Random number between 0 and 99
|
// const singleData = { name: 'Random Item', value: Math.floor(Math.random() * 100) }; // Random number between 0 and 99
|
||||||
|
|
||||||
const createdItem = await TestModel.create(singleData);
|
// const createdItem = await TestModel.create(singleData);
|
||||||
console.log('Single document inserted into "test" collection.', createdItem);
|
// console.log('Single document inserted into "test" collection.', createdItem);
|
||||||
|
|
||||||
// Optionally, retrieve and log the inserted data
|
// // Optionally, retrieve and log the inserted data
|
||||||
const insertedData = await TestModel.find();
|
// const insertedData = await TestModel.find();
|
||||||
console.log('Inserted data:', insertedData);
|
// console.log('Inserted data:', insertedData);
|
||||||
|
|
||||||
// Disconnect from the database
|
// // Disconnect from the database
|
||||||
// await mongoose.disconnect();
|
// // await mongoose.disconnect();
|
||||||
// console.log('MongoDB Disconnected.');
|
// // console.log('MongoDB Disconnected.');
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('MongoDB Connection or Test Failed:', error);
|
console.error('MongoDB Connection or Test Failed:', error);
|
||||||
|
Before Width: | Height: | Size: 317 KiB After Width: | Height: | Size: 317 KiB |
Binary file not shown.
Before Width: | Height: | Size: 76 KiB |
BIN
images/motor/082293246583_motor_lebj0.jpg
Normal file
BIN
images/motor/082293246583_motor_lebj0.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 317 KiB |
67
index.ts
67
index.ts
@ -1,10 +1,19 @@
|
|||||||
// ini adalah file utama dari aplikasi ini
|
// ini adalah file utama dari aplikasi ini
|
||||||
import express, { type Request, type Response } from 'express';
|
import express, { type Request, type Response } from 'express';
|
||||||
|
|
||||||
|
import http from 'http';
|
||||||
|
|
||||||
|
import * as socket from './socket';
|
||||||
|
const socket_client = socket.clientSocket;
|
||||||
|
|
||||||
|
|
||||||
// import formData from 'express-form-data';
|
// import formData from 'express-form-data';
|
||||||
import fileUpload from 'express-fileupload';
|
import fileUpload from 'express-fileupload';
|
||||||
import {testDatabaseConnection} from './connection';
|
import {testDatabaseConnection} from './connection';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import adminRouter from './routes/admin_router';
|
import adminRouter from './routes/admin_router';
|
||||||
|
import userRouter from './routes/user_router';
|
||||||
|
import kurirRouter from './routes/kurir_router';
|
||||||
|
|
||||||
|
|
||||||
// this is for dotenv
|
// this is for dotenv
|
||||||
@ -17,6 +26,8 @@ console.log("diatas untuk dotenv");
|
|||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = process.env.PORT || 3011;
|
const port = process.env.PORT || 3011;
|
||||||
|
const server = http.createServer(app);
|
||||||
|
const io = socket.init(server);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -29,21 +40,61 @@ app.use(express.static(path.join(__dirname, 'assets')));
|
|||||||
app.use(fileUpload({
|
app.use(fileUpload({
|
||||||
createParentPath: true, // Creates the parent directory if it doesn't exist
|
createParentPath: true, // Creates the parent directory if it doesn't exist
|
||||||
}));
|
}));
|
||||||
|
app.use(express.json());
|
||||||
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
testDatabaseConnection();
|
testDatabaseConnection();
|
||||||
|
|
||||||
// create an admin route
|
// create an admin route
|
||||||
app.use('/admin', adminRouter);
|
app.use('/admin', adminRouter);
|
||||||
|
app.use('/kurir', kurirRouter);
|
||||||
|
app.use('/', userRouter);
|
||||||
|
|
||||||
app.post('/submit', (req: Request, res: Response) => {
|
io.on('connection', (socket) => {
|
||||||
console.log('Received form data:', req.body);
|
const userID = socket.id;
|
||||||
res.json({ message: 'Form data received!', data: req.body });
|
// console.log('A user connected: ' + userID);
|
||||||
|
|
||||||
|
socket.on('scan_dia', (data: any) => {
|
||||||
|
console.log('Received scan_dia event: ' + data);
|
||||||
|
io.emit('scan_dia_lagi', "coba");
|
||||||
|
// socket.broadcast.emit('scan_dia_lagi', "coba");
|
||||||
|
// // cobadulu();
|
||||||
|
// io.emit('scan_dia_lagi', 'ini coba');
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('scan_dia_lagi', (data: any) => {
|
||||||
|
console.log('Received scan_dia_lagi event: ' + data);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('disconnect', () => {
|
||||||
|
// console.log('User disconnected: ' + userID);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/', (req: Request, res: Response) => {
|
|
||||||
res.send("Express and express-form-data test");
|
// function cobadulu(){
|
||||||
|
// console.log("coba");
|
||||||
|
// socket_client.emit('scan_dia_lagi', 'ini coba');
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// app.post('/submit', (req: Request, res: Response) => {
|
||||||
|
// console.log('Received form data:', req.body);
|
||||||
|
// res.json({ message: 'Form data received!', data: req.body });
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// app.listen(port, async () => {
|
||||||
|
// console.log(`Server is running on port ${port}`);
|
||||||
|
// });
|
||||||
|
server.listen(port, () => {
|
||||||
|
console.log(`Server running on port ${port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(port, () => {
|
export default { app, server, io };
|
||||||
console.log(`Server is running on port ${port}`);
|
|
||||||
});
|
|
||||||
|
43
index1.ts
Normal file
43
index1.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
import express from 'express';
|
||||||
|
import { createServer } from 'http';
|
||||||
|
import { Server } from 'socket.io';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const server = createServer(app);
|
||||||
|
const io = new Server(server, {
|
||||||
|
cors: {
|
||||||
|
origin: "*", // allow all for dev
|
||||||
|
methods: ["GET", "POST"]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Serve static files
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
|
io.on('connection', (socket) => {
|
||||||
|
console.log('✅ A user connected:', socket.id);
|
||||||
|
|
||||||
|
socket.on('scan_dia', (data: any) => {
|
||||||
|
console.log('📩 Received scan_dia:', data);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('scan_dia_lagi', (data: any) => {
|
||||||
|
console.log('📩 Received scan_dia_lagi:', data);
|
||||||
|
// io.emit('scan_dia_lagi', "coba");
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('disconnect', () => {
|
||||||
|
console.log('❌ User disconnected:', socket.id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const PORT = 3011;
|
||||||
|
server.listen(PORT, () => {
|
||||||
|
console.log(`🚀 Server running at http://localhost:${PORT}`);
|
||||||
|
});
|
@ -2,11 +2,13 @@ import mongoose from "mongoose";
|
|||||||
|
|
||||||
const kurirSchema = new mongoose.Schema({
|
const kurirSchema = new mongoose.Schema({
|
||||||
no_telpon: { type: String, required: true, unique: true },
|
no_telpon: { type: String, required: true, unique: true },
|
||||||
|
password: { type: String },
|
||||||
nama: { type: String, required: true },
|
nama: { type: String, required: true },
|
||||||
jenis_kelamin: { type: String, required: true },
|
jenis_kelamin: { type: String, required: true },
|
||||||
dd_motor: { type: String, required: true, unique: true },
|
dd_motor: { type: String, required: true, unique: true },
|
||||||
gambar_kurir: { type: String, required: true },
|
gambar_kurir: { type: String, required: true },
|
||||||
gambar_motor: { type: String, required: true }
|
gambar_motor: { type: String, required: true },
|
||||||
|
status: { type: String },
|
||||||
}, {
|
}, {
|
||||||
timestamps: true // This auto-adds createdAt and updatedAt
|
timestamps: true // This auto-adds createdAt and updatedAt
|
||||||
});
|
});
|
||||||
|
14
models/pendaftaran_baru_model.ts
Normal file
14
models/pendaftaran_baru_model.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
|
const PendaftaranBaruSchema = new mongoose.Schema({
|
||||||
|
no_telpon: { type: String, required: true, unique: true },
|
||||||
|
nama: { type: String, required: true },
|
||||||
|
password: { type: String, required: true },
|
||||||
|
otp: { type: String, required: true },
|
||||||
|
}, {
|
||||||
|
timestamps: true // This auto-adds createdAt and updatedAt
|
||||||
|
});
|
||||||
|
|
||||||
|
const PendafaranBaruModel = mongoose.model('Pendaftaran_Baru_Collection', PendaftaranBaruSchema);
|
||||||
|
|
||||||
|
export default PendafaranBaruModel;
|
16
models/user_model.ts
Normal file
16
models/user_model.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
|
const userSchema = new mongoose.Schema({
|
||||||
|
no_telpon: { type: String, required: true, unique: true },
|
||||||
|
nama: { type: String, required: true },
|
||||||
|
password: { type: String, required: true },
|
||||||
|
alamat: { type: String, required: false },
|
||||||
|
gambar: { type: String, required: false },
|
||||||
|
|
||||||
|
}, {
|
||||||
|
timestamps: true // This auto-adds createdAt and updatedAt
|
||||||
|
});
|
||||||
|
|
||||||
|
const UserModel = mongoose.model('User_Collection', userSchema);
|
||||||
|
|
||||||
|
export default UserModel;
|
@ -15,10 +15,14 @@
|
|||||||
"@types/express": "^5.0.0",
|
"@types/express": "^5.0.0",
|
||||||
"@types/express-fileupload": "^1.5.1",
|
"@types/express-fileupload": "^1.5.1",
|
||||||
"@types/express-form-data": "^2.0.5",
|
"@types/express-form-data": "^2.0.5",
|
||||||
|
"axios": "^1.9.0",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"express-fileupload": "^1.5.1",
|
"express-fileupload": "^1.5.1",
|
||||||
"express-form-data": "^2.0.23",
|
"express-form-data": "^2.0.23",
|
||||||
"mongoose": "^8.12.1"
|
"mongoose": "^8.12.1",
|
||||||
|
"socket.io": "^4.8.1",
|
||||||
|
"socket.io-client": "^4.8.1",
|
||||||
|
"venom-bot": "^5.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
27
public/index.html
Normal file
27
public/index.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!-- public/index.html -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Receiver Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>This is index.html (Receiver)</h2>
|
||||||
|
|
||||||
|
<script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script>
|
||||||
|
<script>
|
||||||
|
const socket = io();
|
||||||
|
|
||||||
|
socket.on('connect', () => {
|
||||||
|
console.log('Connected to server:', socket.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('scan_dia_lagi', (data) => {
|
||||||
|
console.log('📨 Received scan_dia_lagi:', data);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
26
public/index2.html
Normal file
26
public/index2.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<!-- public/index2.html -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Emitter Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>This is index2.html (Emitter)</h2>
|
||||||
|
<button onclick="emitScan()">Emit scan_dia_lagi</button>
|
||||||
|
|
||||||
|
<script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script>
|
||||||
|
<script>
|
||||||
|
const socket = io();
|
||||||
|
|
||||||
|
socket.on('connect', () => {
|
||||||
|
console.log('Connected to server:', socket.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
function emitScan() {
|
||||||
|
socket.emit('scan_dia_lagi', 'Hello from index2.html!');
|
||||||
|
console.log('📤 Emitted scan_dia_lagi');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -105,10 +105,11 @@ router.post('/kurir', async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
// Save to MongoDB
|
// Save to MongoDB
|
||||||
const newKurir = new KurirModel({
|
const newKurir = new KurirModel({
|
||||||
dd_motor,
|
|
||||||
nama,
|
|
||||||
no_telpon,
|
no_telpon,
|
||||||
|
password : no_telpon,
|
||||||
|
nama,
|
||||||
jenis_kelamin,
|
jenis_kelamin,
|
||||||
|
dd_motor,
|
||||||
gambar_kurir: `${no_telpon}_kurir_${random_5_char}.jpg`,
|
gambar_kurir: `${no_telpon}_kurir_${random_5_char}.jpg`,
|
||||||
gambar_motor: `${no_telpon}_motor_${random_5_char}.jpg`,
|
gambar_motor: `${no_telpon}_motor_${random_5_char}.jpg`,
|
||||||
});
|
});
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="/fonts/material-design-iconic-font/css/material-design-iconic-font.min.css">
|
<link rel="stylesheet" href="/fonts/material-design-iconic-font/css/material-design-iconic-font.min.css">
|
||||||
<link rel="stylesheet" href="/fonts/material-design/css/materialdesignicons.css">
|
<link rel="stylesheet" href="/fonts/material-design/css/materialdesignicons.css">
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -214,8 +217,35 @@
|
|||||||
<!-- Full Screen Plugin -->
|
<!-- Full Screen Plugin -->
|
||||||
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||||
|
|
||||||
<script src="/scripts/main.min.js"></script>
|
<script src="/scripts/main.min.js"></script>
|
||||||
<script src="/my-js.js"></script>
|
<script src="/my-js.js"></script>
|
||||||
|
<script src="/socketnya/client-dist/socket.io.js"></script>
|
||||||
|
<script>
|
||||||
|
const socket = io(); // Connects to your server
|
||||||
|
|
||||||
|
// function sendScanDia() {
|
||||||
|
// const data = "Hello from client!";
|
||||||
|
// socket.emit('scan_dia', data);
|
||||||
|
// console.log('scan_dia sent:', data);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// sendScanDia();
|
||||||
|
|
||||||
|
socket.on('connect', () => {
|
||||||
|
console.log('Connected to server:', socket.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('pengiriman_baru1', (data) => {
|
||||||
|
console.log('Received scan_dia event:', "data");
|
||||||
|
toastr.info("Ada Pengiriman Baru Terdaftar");
|
||||||
|
// console.log('Received scan_dia event:', data);
|
||||||
|
// Do something with the received data
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -116,9 +116,13 @@
|
|||||||
<button type="button" class="btn btn-sm btn-info btn-rounded waves-effect waves-light"
|
<button type="button" class="btn btn-sm btn-info btn-rounded waves-effect waves-light"
|
||||||
onclick="addKurirOpenModal()">Pendaftaran Kurir Baru</button>
|
onclick="addKurirOpenModal()">Pendaftaran Kurir Baru</button>
|
||||||
</div>
|
</div>
|
||||||
<table id="tb-kurir" class="table table-striped table-bordered display" style="width:100%">
|
<div class="form-group" style="overflow-x: auto;">
|
||||||
|
<table id="tb-kurir" class="table table-striped table-bordered display"
|
||||||
|
style="width:100%">
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -253,7 +257,8 @@
|
|||||||
// destroy table
|
// destroy table
|
||||||
// $('#tb-kurir').DataTable().destroy();
|
// $('#tb-kurir').DataTable().destroy();
|
||||||
$('#tb-kurir').DataTable({
|
$('#tb-kurir').DataTable({
|
||||||
responsive: true,
|
// responsive: true,
|
||||||
|
scrollX: true,
|
||||||
// order: [
|
// order: [
|
||||||
// [0, 'asc']
|
// [0, 'asc']
|
||||||
// ],
|
// ],
|
||||||
@ -282,6 +287,13 @@
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"mData": "status",
|
||||||
|
"title": "Status",
|
||||||
|
"render": function (data, type, row) {
|
||||||
|
return data == null || data == "" || data == undefined ? "Tersedia" : data
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"mData": null,
|
"mData": null,
|
||||||
"title": "Aksi",
|
"title": "Aksi",
|
||||||
@ -443,7 +455,7 @@
|
|||||||
$("#btn-update-kurir").hide()
|
$("#btn-update-kurir").hide()
|
||||||
$('#modal-kurir').modal('show')
|
$('#modal-kurir').modal('show')
|
||||||
var img = document.createElement('img');
|
var img = document.createElement('img');
|
||||||
img.src = 'kurir/gambar/' + data.no_telpon + '/'+ data.gambar_kurir;
|
img.src = 'kurir/gambar/' + data.no_telpon + '/' + data.gambar_kurir;
|
||||||
img.style.maxWidth = '100%'; // Make the image fit the width of the div
|
img.style.maxWidth = '100%'; // Make the image fit the width of the div
|
||||||
img.style.maxHeight = '100%'; // Make the image fit the height of the div
|
img.style.maxHeight = '100%'; // Make the image fit the height of the div
|
||||||
|
|
||||||
@ -457,7 +469,7 @@
|
|||||||
previewDiv.appendChild(img);
|
previewDiv.appendChild(img);
|
||||||
|
|
||||||
var img = document.createElement('img');
|
var img = document.createElement('img');
|
||||||
img.src = 'kurir/gambar/' + data.no_telpon + '/'+ data.gambar_motor;
|
img.src = 'kurir/gambar/' + data.no_telpon + '/' + data.gambar_motor;
|
||||||
img.style.maxWidth = '100%'; // Make the image fit the width of the div
|
img.style.maxWidth = '100%'; // Make the image fit the width of the div
|
||||||
img.style.maxHeight = '100%'; // Make the image fit the height of the div
|
img.style.maxHeight = '100%'; // Make the image fit the height of the div
|
||||||
|
|
||||||
|
79
routes/kurir_router.ts
Normal file
79
routes/kurir_router.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import type { Request, Response } from 'express';
|
||||||
|
import PendafaranBaruModel from '../models/pendaftaran_baru_model';
|
||||||
|
import KurirModel from '../models/kurir_model';
|
||||||
|
import type { UploadedFile } from 'express-fileupload';
|
||||||
|
import path from 'path';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get('/', (req: Request, res: Response) => {
|
||||||
|
res.sendFile(__dirname + '/kurir_ui/index.html');
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/login', (req: Request, res: Response) => {
|
||||||
|
res.sendFile(__dirname + '/kurir_ui/login.html');
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/login', async (req: Request, res: Response) => {
|
||||||
|
const { no_telpon, password } = req.body;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const user = await KurirModel.findOne({ no_telpon, password });
|
||||||
|
if (user) {
|
||||||
|
res.status(200).json(user);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.status(400).json('Nomor Telpon atau Password Salah');
|
||||||
|
return;
|
||||||
|
} catch (error) {
|
||||||
|
console.log("error di kurir login",error);
|
||||||
|
res.status(500).json('Terjadi Kesalahan Server');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/:jenis/:gambar', (req: Request, res: Response) => {
|
||||||
|
const { jenis, gambar } = req.params;
|
||||||
|
const imagePath = path.join(__dirname, `../images/${jenis}/${gambar}`);
|
||||||
|
|
||||||
|
if (fs.existsSync(imagePath)) {
|
||||||
|
res.sendFile(imagePath);
|
||||||
|
} else {
|
||||||
|
res.status(404).send('Image not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/check', async (req: Request, res: Response) => {
|
||||||
|
if (!req.body) {
|
||||||
|
res.status(400).json('Bad Request');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { _id, no_telpon, password, createdAt } = req.body;
|
||||||
|
console.log(_id , no_telpon , password , createdAt);
|
||||||
|
|
||||||
|
// console.log(_id , no_telpon , password , createdAt);
|
||||||
|
try {
|
||||||
|
// check the user by _id , no_telpon , password , createdAt
|
||||||
|
const user = await KurirModel.findOne({ _id, no_telpon, password, createdAt });
|
||||||
|
if (!user) {
|
||||||
|
res.status(400).json('User not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(200).json('Success');
|
||||||
|
return;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
res.status(500).json('Terjadi Kesalahan Server');
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default router;
|
306
routes/kurir_ui/index.html
Normal file
306
routes/kurir_ui/index.html
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Shenior Kurir | Halaman Utama</title>
|
||||||
|
|
||||||
|
<!-- Main Styles -->
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- mCustomScrollbar -->
|
||||||
|
<link rel="stylesheet" href="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
|
||||||
|
<!-- Sweet Alert -->
|
||||||
|
<link rel="stylesheet" href="/plugin/sweet-alert/sweetalert.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/fontello/fontello.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design-iconic-font/css/material-design-iconic-font.min.css">
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design/css/materialdesignicons.css">
|
||||||
|
<script src="/auth.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="main-menu">
|
||||||
|
<header class="header">
|
||||||
|
<a href="/admin" class="logo">Shenior Kurir</a>
|
||||||
|
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||||
|
<div class="user">
|
||||||
|
<a href="#" class="avatar"><img src="/images/admin.png" id="img-avatar" alt=""><span
|
||||||
|
class="status online"></span></a>
|
||||||
|
<h5 class="name"><a href="#" id="h5-title">...</a></h5>
|
||||||
|
<h5 class="position">Kurir</h5>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.user -->
|
||||||
|
</header>
|
||||||
|
<!-- /.header -->
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<div class="navigation">
|
||||||
|
<h5 class="title">Navigasi</h5>
|
||||||
|
<!-- /.title -->
|
||||||
|
<ul class="menu js__accordion">
|
||||||
|
<li class="current active">
|
||||||
|
<a class="waves-effect" href="/kurir"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||||
|
Utama</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="/kurir/penghantaran"><i
|
||||||
|
class="menu-icon ico mdi mdi-motorbike"></i><span>Pengiriman Paket</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- <li>
|
||||||
|
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||||
|
class="menu-icon fa fa-users"></i><span>List User</span></a>
|
||||||
|
</li> -->
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||||
|
class="menu-icon ico icon-table"></i><span>Log Penghantaran</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="/kurir/profil"><i
|
||||||
|
class="menu-icon fa fa-unlock-alt"></i><span>Ganti Password</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="#" onclick="logout()"><i
|
||||||
|
class="menu-icon ico icon-logout"></i><span>Logout</span></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.navigation -->
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.main-menu -->
|
||||||
|
|
||||||
|
<div class="fixed-navbar">
|
||||||
|
<div class="pull-left">
|
||||||
|
<button type="button"
|
||||||
|
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||||
|
<h1 class="page-title">Halaman Utama</h1>
|
||||||
|
<!-- /.page-title -->
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-left -->
|
||||||
|
<div class="pull-right">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="#" class="ico-item ico icon-logout" onclick="logout()"></a>
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-right -->
|
||||||
|
</div>
|
||||||
|
<!-- /.fixed-navbar -->
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-lg-6 col-md-6 col-xs-6">
|
||||||
|
<div class="box-content">
|
||||||
|
<h4 class="box-title">Jumlah Pengguna</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
|
||||||
|
<!-- /.dropdown js__dropdown -->
|
||||||
|
<div class="content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<img src="/images/kiriman.png" alt="" style="width: 100%;">
|
||||||
|
</div>
|
||||||
|
<!-- show this icon ico icon-users-1 -->
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="right-content">
|
||||||
|
<h2 class="murid-counter"></h2>
|
||||||
|
<!-- /.counter -->
|
||||||
|
<p class="text">Orang</p>
|
||||||
|
<!-- /.text -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.right-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-xs-6">
|
||||||
|
<div class="box-content">
|
||||||
|
<h4 class="box-title">Jumlah Kiriman Dilakukan</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
|
||||||
|
<!-- /.dropdown js__dropdown -->
|
||||||
|
<div class="content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<img src="/images/kiriman2.png" alt="" style="width: 100%;">
|
||||||
|
</div>
|
||||||
|
<!-- show this icon ico icon-users-1 -->
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="right-content">
|
||||||
|
<h2 class="staf-counter"></h2>
|
||||||
|
<!-- /.counter -->
|
||||||
|
<p class="text">Orang</p>
|
||||||
|
<!-- /.text -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.right-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
<!-- <div class="col-xs-12">
|
||||||
|
<div class="box-content card">
|
||||||
|
<img src="/images/habibie.jpg" alt="" style="width: 100%; border-radius: 30px;">
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-lg-2 col-md-2 col-xs-12"></div>
|
||||||
|
<div class="col-lg-8 col-md-8 col-xs-12">
|
||||||
|
<div class="box-content card white">
|
||||||
|
<h4 class="box-title">Profil Kurir</h4>
|
||||||
|
<form class="card-content" id="form-kurir">
|
||||||
|
<div class="form-group">
|
||||||
|
<!-- show the upload -->
|
||||||
|
<div id="show-upload-gambar-kurir">
|
||||||
|
<center>
|
||||||
|
<div id="preview-gambar-kurir" style="height: 200px; width: 150px"></div>
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="form-group" id="form-gambar-kurir">
|
||||||
|
<label for="modal-kurir-nama">Photo Kurir</label>
|
||||||
|
<input type="file" class="form-control" id="gambar-kurir" accept="image/*"
|
||||||
|
onchange="showUpload(this, 'gambar-kurir')">
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-nama">Nama</label>
|
||||||
|
<input type="text" class="form-control" id="nama" placeholder="Masukkan Nama">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-nama">Status</label>
|
||||||
|
<input type="text" class="form-control" id="status" placeholder="Masukkan Status">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-nama">No Telpon/HP</label>
|
||||||
|
<input type="text" class="form-control" id="no_telpon" oninput="numberOnly(this)"
|
||||||
|
maxlength="13" placeholder="Masukkan No Telpon/HP">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-nama">Jenis Kelamin</label>
|
||||||
|
<select class="form-control" id="jenis-kelamin">
|
||||||
|
<option value="" disabled selected>-Pilih Jenis Kelamin</option>
|
||||||
|
<option value="Laki-laki">Laki-laki</option>
|
||||||
|
<option value="Perempuan">Perempuan</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="form-group">
|
||||||
|
<div id="show-upload-gambar-motor">
|
||||||
|
<center>
|
||||||
|
<div id="preview-gambar-motor" style="height: 200px; width: 150px"></div>
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="form-group" id="form-gambar-motor">
|
||||||
|
<label for="modal-kurir-nama">Photo Motor</label>
|
||||||
|
<input type="file" class="form-control" id="gambar-motor" accept="image/*"
|
||||||
|
onchange="showUpload(this, 'gambar-motor')">
|
||||||
|
</div> -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-dd-motor">DD Motor</label>
|
||||||
|
<input type="text" class="form-control" id="dd-motor" placeholder="Masukkan DD Motor">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-2 col-md-2 col-xs-12"></div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer">
|
||||||
|
<ul class="list-inline">
|
||||||
|
<li>Arifuddin Naawi Amanah © 2025.</li>
|
||||||
|
<!-- <li><a href="#">Privacy</a></li>
|
||||||
|
<li><a href="#">Terms</a></li>
|
||||||
|
<li><a href="#">Help</a></li> -->
|
||||||
|
</ul>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<!-- /.main-content -->
|
||||||
|
</div><!--/#wrapper -->
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
<!-- Full Screen Plugin -->
|
||||||
|
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
<script src="/my-js.js"></script>
|
||||||
|
<script src="/socketnya/client-dist/socket.io.js"></script>
|
||||||
|
<script>
|
||||||
|
const global_data = JSON.parse(localStorage.getItem('user'));
|
||||||
|
console.log(global_data);
|
||||||
|
|
||||||
|
const form = document.querySelector('#form-kurir');
|
||||||
|
form.querySelectorAll('input, select, textarea, button').forEach(el => {
|
||||||
|
el.disabled = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
let img = document.createElement('img');
|
||||||
|
img.src = 'kurir/motor/' + global_data.gambar_motor;
|
||||||
|
img.width = 200;
|
||||||
|
img.height = 200;
|
||||||
|
document.getElementById('preview-gambar-motor').appendChild(img);
|
||||||
|
let img2 = document.createElement('img');
|
||||||
|
img2.src = 'kurir/kurir/' + global_data.gambar_kurir;
|
||||||
|
img2.width = 200;
|
||||||
|
img2.height = 200;
|
||||||
|
document.getElementById('preview-gambar-kurir').appendChild(img2);
|
||||||
|
|
||||||
|
document.getElementById('h5-title').innerHTML = global_data.nama;
|
||||||
|
|
||||||
|
$("#nama").val(global_data.nama);
|
||||||
|
$("#no_telpon").val(global_data.no_telpon);
|
||||||
|
$("#status").val(global_data.status == null ? "Tersedia" : global_data.status);
|
||||||
|
$("#jenis-kelamin").val(global_data.jenis_kelamin);
|
||||||
|
$("#dd-motor").val(global_data.dd_motor);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
104
routes/kurir_ui/login.html
Normal file
104
routes/kurir_ui/login.html
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Halaman Login Kurir</title>
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="single-wrapper">
|
||||||
|
<form action="#" class="frm-single">
|
||||||
|
<div class="inside">
|
||||||
|
<div class="title"><strong>Shenior</strong> Kurir</div>
|
||||||
|
<!-- /.title -->
|
||||||
|
<div class="frm-title">Login Kurir</div>
|
||||||
|
<!-- /.frm-title -->
|
||||||
|
<div class="frm-input"><input type="text" id="username" placeholder="No Telpon" class="frm-inp"><i class="fa fa-user frm-ico"></i></div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
<div class="frm-input"><input type="password" id="password" placeholder="Password" class="frm-inp"><i class="fa fa-lock frm-ico"></i></div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
|
||||||
|
<button type="button" class="frm-submit" onclick="login()">Login<i class="fa fa-arrow-circle-right"></i></button>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="/" class="a-link"><i class="fa fa-home"></i>Kembali Ke Halaman Utama.</a>
|
||||||
|
|
||||||
|
<div class="frm-footer">Arifuddin Naawi Amanah © 2025.</div>
|
||||||
|
<!-- /.footer -->
|
||||||
|
</div>
|
||||||
|
<!-- .inside -->
|
||||||
|
</form>
|
||||||
|
<!-- /.frm-single -->
|
||||||
|
</div><!--/#single-wrapper -->
|
||||||
|
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||||
|
|
||||||
|
<script src="/block/jquery.blockUI.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
<script src="/my-js.js"></script>
|
||||||
|
<script>
|
||||||
|
function login() {
|
||||||
|
var username = $("#username").val();
|
||||||
|
var password = $("#password").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/kurir/login",
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
no_telpon: username,
|
||||||
|
password: password
|
||||||
|
},
|
||||||
|
beforeSend: function () {
|
||||||
|
blockUI('Login Sedang Diproses...');
|
||||||
|
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$.unblockUI();
|
||||||
|
toastr.success("Login Berhasil");
|
||||||
|
// create local storage
|
||||||
|
localStorage.setItem('user', JSON.stringify(data));
|
||||||
|
localStorage.setItem('role', 'kurir');
|
||||||
|
// 2 sec the to halaman login
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = "/kurir";
|
||||||
|
}, 2500);
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
$.unblockUI();
|
||||||
|
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
206
routes/user_after_login_ui/index.html
Normal file
206
routes/user_after_login_ui/index.html
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Shenior Kurir | Halaman Utama</title>
|
||||||
|
|
||||||
|
<!-- Main Styles -->
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- mCustomScrollbar -->
|
||||||
|
<link rel="stylesheet" href="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
|
||||||
|
<!-- Sweet Alert -->
|
||||||
|
<link rel="stylesheet" href="/plugin/sweet-alert/sweetalert.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/fontello/fontello.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design-iconic-font/css/material-design-iconic-font.min.css">
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design/css/materialdesignicons.css">
|
||||||
|
<script src="/auth.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="main-menu">
|
||||||
|
<header class="header">
|
||||||
|
<a href="/admin" class="logo">Shenior Kurir</a>
|
||||||
|
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||||
|
<div class="user">
|
||||||
|
<a href="#" class="avatar"><img src="/images/person.png" alt=""><span class="status online"></span></a>
|
||||||
|
<h5 class="name"><a href="#" id="h5-title">...</a></h5>
|
||||||
|
<h5 class="position">Pengguna</h5>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.user -->
|
||||||
|
</header>
|
||||||
|
<!-- /.header -->
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<div class="navigation">
|
||||||
|
<h5 class="title">Navigasi</h5>
|
||||||
|
<!-- /.title -->
|
||||||
|
<ul class="menu js__accordion">
|
||||||
|
<li class="current active">
|
||||||
|
<a class="waves-effect" href="/user"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||||
|
Utama</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="/user/kirim-paket"><i class="menu-icon ico mdi mdi-motorbike"></i><span>Pengiriman Paket</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||||
|
class="menu-icon ico icon-table"></i><span>History Pengiriman</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="/user/profil" ><i
|
||||||
|
class="menu-icon ico icon-user"></i><span>Profil Pengunna</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" onclick="logout()" href="#"><i
|
||||||
|
class="menu-icon ico icon-logout"></i><span>Logout</span></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.navigation -->
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.main-menu -->
|
||||||
|
|
||||||
|
<div class="fixed-navbar">
|
||||||
|
<div class="pull-left">
|
||||||
|
<button type="button" class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||||
|
<h1 class="page-title">Halaman Utama</h1>
|
||||||
|
<!-- /.page-title -->
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-left -->
|
||||||
|
<div class="pull-right">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="#" onclick="logout()" class="ico-item ico icon-logout" ></a>
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-right -->
|
||||||
|
</div>
|
||||||
|
<!-- /.fixed-navbar -->
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-lg-6 col-md-6 col-xs-6">
|
||||||
|
<div class="box-content">
|
||||||
|
<h4 class="box-title">Jumlah Kurir Tersedia</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
|
||||||
|
<!-- /.dropdown js__dropdown -->
|
||||||
|
<div class="content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<img src="/images/kurir.png" alt="" style="width: 100%;">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- show this icon ico icon-users-1 -->
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="right-content">
|
||||||
|
<h2 class="guru-counter"></h2>
|
||||||
|
<!-- /.counter -->
|
||||||
|
<p class="text">Orang</p>
|
||||||
|
<!-- /.text -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.right-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-xs-6">
|
||||||
|
<div class="box-content">
|
||||||
|
<h4 class="box-title">Jumlah Paket Terkirim</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
|
||||||
|
<!-- /.dropdown js__dropdown -->
|
||||||
|
<div class="content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<img src="/images/kiriman2.png" alt="" style="width: 100%;">
|
||||||
|
</div>
|
||||||
|
<!-- show this icon ico icon-users-1 -->
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="right-content">
|
||||||
|
<h2 class="staf-counter"></h2>
|
||||||
|
<!-- /.counter -->
|
||||||
|
<p class="text">Orang</p>
|
||||||
|
<!-- /.text -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.right-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="box-content card">
|
||||||
|
<img src="/images/habibie.jpg" alt="" style="width: 100%; border-radius: 30px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer">
|
||||||
|
<ul class="list-inline">
|
||||||
|
<li>Arifuddin Naawi Amanah © 2025.</li>
|
||||||
|
<!-- <li><a href="#">Privacy</a></li>
|
||||||
|
<li><a href="#">Terms</a></li>
|
||||||
|
<li><a href="#">Help</a></li> -->
|
||||||
|
</ul>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<!-- /.main-content -->
|
||||||
|
</div><!--/#wrapper -->
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
<!-- Full Screen Plugin -->
|
||||||
|
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
<script src="/my-js.js"></script>
|
||||||
|
<script>
|
||||||
|
const global_data = JSON.parse(localStorage.getItem('user'));
|
||||||
|
document.getElementById('h5-title').innerHTML = global_data.nama;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
265
routes/user_after_login_ui/paket.html
Normal file
265
routes/user_after_login_ui/paket.html
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Shenior Kurir | Pengiriman Paket</title>
|
||||||
|
|
||||||
|
<!-- Main Styles -->
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- mCustomScrollbar -->
|
||||||
|
<link rel="stylesheet" href="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
|
||||||
|
<!-- Sweet Alert -->
|
||||||
|
<link rel="stylesheet" href="/plugin/sweet-alert/sweetalert.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/fontello/fontello.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design-iconic-font/css/material-design-iconic-font.min.css">
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design/css/materialdesignicons.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||||
|
<script src="/auth.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="main-menu">
|
||||||
|
<header class="header">
|
||||||
|
<a href="/admin" class="logo">Shenior Kurir</a>
|
||||||
|
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||||
|
<div class="user">
|
||||||
|
<a href="#" class="avatar"><img src="/images/person.png" alt=""><span class="status online"></span></a>
|
||||||
|
<h5 class="name"><a href="#" id="h5-title">...</a></h5>
|
||||||
|
<h5 class="position">Pengguna</h5>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.user -->
|
||||||
|
</header>
|
||||||
|
<!-- /.header -->
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<div class="navigation">
|
||||||
|
<h5 class="title">Navigasi</h5>
|
||||||
|
<!-- /.title -->
|
||||||
|
<ul class="menu js__accordion">
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="/user"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||||
|
Utama</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="current active">
|
||||||
|
<a class="waves-effect" href="/user/kirim-paket"><i
|
||||||
|
class="menu-icon ico mdi mdi-motorbike"></i><span>Pengiriman Paket</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||||
|
class="menu-icon ico icon-table"></i><span>History Pengiriman</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="/user/profil"><i class="menu-icon ico icon-user"></i><span>Profil
|
||||||
|
Pengunna</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" onclick="logout()" href="#"><i
|
||||||
|
class="menu-icon ico icon-logout"></i><span>Logout</span></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.navigation -->
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.main-menu -->
|
||||||
|
|
||||||
|
<div class="fixed-navbar">
|
||||||
|
<div class="pull-left">
|
||||||
|
<button type="button"
|
||||||
|
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||||
|
<h1 class="page-title">Pengiriman Paket</h1>
|
||||||
|
<!-- /.page-title -->
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-left -->
|
||||||
|
<div class="pull-right">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="#" class="ico-item ico icon-logout" onclick="logout()"></a>
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-right -->
|
||||||
|
</div>
|
||||||
|
<!-- /.fixed-navbar -->
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="box-content card">
|
||||||
|
<h4 class="box-title">Form Kurir</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="button" class="btn btn-sm btn-info btn-rounded waves-effect waves-light"
|
||||||
|
onclick="addpaketOpenModal()">Pendaftaran Kurir Baru</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<footer class="footer">
|
||||||
|
<ul class="list-inline">
|
||||||
|
<li>Arifuddin Naawi Amanah © 2025.</li>
|
||||||
|
<!-- <li><a href="#">Privacy</a></li>
|
||||||
|
<li><a href="#">Terms</a></li>
|
||||||
|
<li><a href="#">Help</a></li> -->
|
||||||
|
</ul>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<!-- /.main-content -->
|
||||||
|
</div><!--/#wrapper -->
|
||||||
|
|
||||||
|
<div class="modal fade" id="modal-paket" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||||
|
aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title" id="modal-paket-title">Modal title</h4>
|
||||||
|
</div>
|
||||||
|
<form class="modal-body" id="form-modal">
|
||||||
|
<div class="form-group">
|
||||||
|
<!-- show the upload -->
|
||||||
|
<div id="show-upload-gambar-kurir" style="display: none">
|
||||||
|
<center>
|
||||||
|
<div id="preview-gambar-kurir" style="height: 200px; width: 150px"></div>
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" id="form-gambar-kurir">
|
||||||
|
<!-- create upload -->
|
||||||
|
<label for="modal-kurir-nama">Photo Kurir</label>
|
||||||
|
<input type="file" class="form-control" id="gambar-kurir" accept="image/*"
|
||||||
|
onchange="showUpload(this, 'gambar-kurir')">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-no-telpon">No Telpon/HP Yang Dihubungi</label>
|
||||||
|
<input type="text" class="form-control" id="no_telpon" oninput="numberOnly(this)" maxlength="13"
|
||||||
|
placeholder="Masukkan No Telpon/HP Yang Dihubungi">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-alamat">Alamat Pengiriman</label>
|
||||||
|
<textarea name="alamat" class="form-control" id="alamat"
|
||||||
|
placeholder="Masukkan Alamat"></textarea>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default btn-sm waves-effect waves-light"
|
||||||
|
data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light" id="btn-pengiriman"
|
||||||
|
onclick="tambahpengiriman()">Lakukan Pengiriman</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
<!-- Full Screen Plugin -->
|
||||||
|
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||||
|
|
||||||
|
<script src="/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||||
|
<script src="/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||||
|
|
||||||
|
<script src="/block/jquery.blockUI.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
<script src="/my-js.js"></script>
|
||||||
|
<script src="/socket-io/client-dist/socket.io.js"></script>
|
||||||
|
<script>
|
||||||
|
const socket = io(); // Connects to your server
|
||||||
|
|
||||||
|
|
||||||
|
socket.on('connect', () => {
|
||||||
|
console.log('Connected to server:', socket.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
const global_data = JSON.parse(localStorage.getItem('user'));
|
||||||
|
document.getElementById('h5-title').innerHTML = global_data.nama;
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
function addpaketOpenModal() {
|
||||||
|
$('#modal-paket-title').html('Form Pengiriman Paket Baru');
|
||||||
|
$('#modal-paket').modal('show');
|
||||||
|
}
|
||||||
|
function tambahpengiriman() {
|
||||||
|
$.ajax({
|
||||||
|
url: '/user/kirim-paket/',
|
||||||
|
type: 'POST',
|
||||||
|
data: {},
|
||||||
|
beforeSend: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
// This triggers the event
|
||||||
|
socket.emit('scan_dia_lagi', 'hello from paket.html');
|
||||||
|
$('#modal-paket').modal('hide');
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
158
routes/user_router.ts
Normal file
158
routes/user_router.ts
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import type { Request, Response } from 'express';
|
||||||
|
import PendafaranBaruModel from '../models/pendaftaran_baru_model';
|
||||||
|
import UserModel from '../models/user_model';
|
||||||
|
import type { UploadedFile } from 'express-fileupload';
|
||||||
|
import path from 'path';
|
||||||
|
import fs from 'fs';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
import * as socket from '../socket';
|
||||||
|
const socket_client = socket.clientSocket;
|
||||||
|
|
||||||
|
router.get('/', (req: Request, res: Response) => {
|
||||||
|
// socket_client.emit('scan_dia', 'test');
|
||||||
|
res.sendFile(__dirname + '/user_ui/index.html');
|
||||||
|
});
|
||||||
|
|
||||||
|
// router.get('/coba', async (req: Request, res: Response) => {
|
||||||
|
// res.status(200).json('success');
|
||||||
|
// })
|
||||||
|
|
||||||
|
router.get('/login', (req: Request, res: Response) => {
|
||||||
|
res.sendFile(__dirname + '/user_ui/login.html');
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/login', async (req: Request, res: Response) => {
|
||||||
|
const { no_telpon, password } = req.body;
|
||||||
|
const user = await UserModel.findOne({ no_telpon, password });
|
||||||
|
if (user) {
|
||||||
|
console.log(user);
|
||||||
|
res.status(200).json(user);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.status(400).json('Nomor Telpon atau Password Salah');
|
||||||
|
})
|
||||||
|
|
||||||
|
router.get('/daftar', (req: Request, res: Response) => {
|
||||||
|
res.sendFile(__dirname + '/user_ui/daftar.html');
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/daftar', async (req: Request, res: Response) => {
|
||||||
|
const { no_telpon, nama, password } = req.body;
|
||||||
|
// check the user
|
||||||
|
const user = await UserModel.findOne({ no_telpon });
|
||||||
|
if (user) {
|
||||||
|
res.status(400).json('Nomor Telpon sudah terdaftar');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the pendaftaran baru
|
||||||
|
const pencarian_data = await PendafaranBaruModel.findOne({ no_telpon });
|
||||||
|
if (pencarian_data) {
|
||||||
|
// delete the pendaftaran baru with no_telpon
|
||||||
|
await PendafaranBaruModel.deleteOne({ no_telpon });
|
||||||
|
}
|
||||||
|
|
||||||
|
const otp = Math.floor(Math.random() * 1000000);
|
||||||
|
// create pendaftaran baru
|
||||||
|
|
||||||
|
|
||||||
|
// create a 6 otp random otp code
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await axios.post('http://localhost:3012/send-otp', { number: no_telpon, otp });
|
||||||
|
const pendaftaran_baru = new PendafaranBaruModel({ no_telpon, nama, password, otp });
|
||||||
|
await pendaftaran_baru.save();
|
||||||
|
res.status(200).json('success');
|
||||||
|
return;
|
||||||
|
} catch (error: any) {
|
||||||
|
// console.log(error);
|
||||||
|
res.status(error.response.status).json(error.response.data);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// res.status(400).json('error dari backend');
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/verifikasi', async (req: Request, res: Response) => {
|
||||||
|
const { no_telpon, kode_otp } = req.body;
|
||||||
|
const pencarian_data = await PendafaranBaruModel.findOne({ no_telpon });
|
||||||
|
if (!pencarian_data) {
|
||||||
|
res.status(400).json('Nomor Telpon tidak ditemukan');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pencarian_data.otp == kode_otp) {
|
||||||
|
const user = new UserModel({ no_telpon, nama: pencarian_data.nama, password: pencarian_data.password });
|
||||||
|
await user.save();
|
||||||
|
await PendafaranBaruModel.deleteOne({ no_telpon });
|
||||||
|
res.status(200).json('success');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.status(400).json('Kode OTP Salah');
|
||||||
|
return
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
router.get('/user', (req: Request, res: Response) => {
|
||||||
|
res.sendFile(__dirname + '/user_after_login_ui/index.html');
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
router.get('/user/kirim-paket', async (req: Request, res: Response) => {
|
||||||
|
res.sendFile(__dirname + '/user_after_login_ui/paket.html');
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/user/kirim-paket', async (req: Request, res: Response) => {
|
||||||
|
console.log("kirim paket");
|
||||||
|
socket_client.emit('scan_dia', 'ini dari kirim-paket');
|
||||||
|
res.status(200).json("ini")
|
||||||
|
})
|
||||||
|
|
||||||
|
router.get('/user/kirim-paket1', async (req: Request, res: Response) => {
|
||||||
|
console.log("kirim paket");
|
||||||
|
socket_client.emit('scan_dia', 'ini dari kirim-paket');
|
||||||
|
res.status(200).json("ini")
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
router.post('/user/check', async (req: Request, res: Response) => {
|
||||||
|
if (!req.body) {
|
||||||
|
res.status(400).json('Bad Request');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { _id, no_telpon, password, createdAt } = req.body;
|
||||||
|
|
||||||
|
// console.log(_id , no_telpon , password , createdAt);
|
||||||
|
try {
|
||||||
|
// check the user by _id , no_telpon , password , createdAt
|
||||||
|
const user = await UserModel.findOne({ _id, no_telpon, password, createdAt });
|
||||||
|
if (!user) {
|
||||||
|
res.status(400).json('User not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(200).json('Success');
|
||||||
|
return;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
res.status(500).json('Terjadi Kesalahan Server');
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// This should be the last route
|
||||||
|
router.use((req: Request, res: Response) => {
|
||||||
|
res.status(404).sendFile(__dirname + '/user_ui/404.html');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default router;
|
56
routes/user_ui/404.html
Normal file
56
routes/user_ui/404.html
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>404 Halaman Tidak Ditemukan</title>
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="page-404">
|
||||||
|
<div class="content">
|
||||||
|
<div class="title-on-desktop">
|
||||||
|
<svg style="width: 600px; height: 200px" alignment-baseline="middle">
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip2">
|
||||||
|
<path d="M 0 0 L 600 0 L 600 80 L 0 80 L 0 0 L 0 125 L 600 125 L 600 200 L 0 200 Z" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<text x="300" y="190" style="width: 600px; height: 200px" text-anchor="middle" font-family="Lato" font-weight="700" font-size="250" fill="#505458" clip-path="url(#clip2)">4<tspan fill="#35b8e0">0</tspan>4</text>
|
||||||
|
</svg>
|
||||||
|
<div class="title">Halaman Tidak Ditemukan</div>
|
||||||
|
</div>
|
||||||
|
<h1 class="title-on-mobile">Error 404: Halaman Tidak Ditemukan</h1>
|
||||||
|
<p>Kamu sepertinya salah ambil belokan. Jangan khawatir... itu terjadi pada yang terbaik. Kamu mungkin ingin memeriksa koneksi internetmu. Berikut tips kecil yang mungkin membantumu kembali ke jalur yang benar.</p>
|
||||||
|
<a href="#" onclick="history.back(); return false;" class="btn btn-info">Kembali</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div><!--/#single-wrapper -->
|
||||||
|
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
210
routes/user_ui/daftar.html
Normal file
210
routes/user_ui/daftar.html
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Pendaftaran Penguna</title>
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
<!-- Toastr -->
|
||||||
|
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="single-wrapper">
|
||||||
|
<form action="#" class="frm-single">
|
||||||
|
<div class="inside">
|
||||||
|
<div class="title"><strong>Shenior</strong> Kurir</div>
|
||||||
|
<!-- /.title -->
|
||||||
|
<div class="frm-title">Pendaftaran Pengguna</div>
|
||||||
|
<!-- /.frm-title -->
|
||||||
|
<div class="frm-input"><input id="no_telpon" type="text" placeholder="No Telpon" class="frm-inp"
|
||||||
|
oninput="numberOnly(this)" maxlength="13" minlength="11"><i class="fa fa-phone frm-ico"></i>
|
||||||
|
</div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
<div class="frm-input"><input id="nama" type="text" placeholder="Nama" class="frm-inp"><i
|
||||||
|
class="fa fa-user frm-ico"></i></div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
<div class="frm-input"><input id="password" type="password" placeholder="Password" class="frm-inp"><i
|
||||||
|
class="fa fa-lock frm-ico"></i></div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
<div class="frm-input"><input id="konfirmasi_password" type="password" placeholder="Konfirmasi Password"
|
||||||
|
class="frm-inp"><i class="fa fa-lock frm-ico"></i></div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
|
||||||
|
<button type="button" class="frm-submit" onclick="daftar()">Mendaftar<i
|
||||||
|
class="fa fa-arrow-circle-right"></i></button>
|
||||||
|
<a href="/" class="a-link"><i class="fa fa-home"></i>Kembali Ke Halaman Utama.</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="frm-footer">Arifuddin Naawi Amanah © 2025.</div>
|
||||||
|
<!-- /.footer -->
|
||||||
|
</div>
|
||||||
|
<!-- .inside -->
|
||||||
|
</form>
|
||||||
|
<!-- /.frm-single -->
|
||||||
|
</div><!--/#single-wrapper -->
|
||||||
|
|
||||||
|
<div class="modal fade" id="modal-otp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-2">
|
||||||
|
<div class="modal-dialog modal-sm" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||||
|
aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel-2">Kode OTP</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="modal-kurir-nama">Kode OTP</label>
|
||||||
|
<input type="text" class="form-control" id="kode_otp" oninput="numberOnly(this)" maxlength="6"
|
||||||
|
placeholder="Masukkan Kode OTP ">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default btn-sm waves-effect waves-light"
|
||||||
|
data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light" onclick="verifikasi()">Verifikasi</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||||
|
|
||||||
|
<script src="/block/jquery.blockUI.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
<script src="/my-js.js"></script>
|
||||||
|
<script>
|
||||||
|
function daftar() {
|
||||||
|
const no_telpon = $("#no_telpon").val();
|
||||||
|
const nama = $("#nama").val();
|
||||||
|
const password = $("#password").val();
|
||||||
|
const konfirmasi_password = $("#konfirmasi_password").val();
|
||||||
|
|
||||||
|
if (no_telpon === "" || nama === "" || password === "" || konfirmasi_password === "") {
|
||||||
|
toastr.error("Form Harus Diisi Semua");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (password.length < 8) {
|
||||||
|
// toastr.error("Password Minimal 8 Karakter");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (no_telpon.length < 11) {
|
||||||
|
toastr.error("No Telpon Minimal 11 Karakter");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (password !== konfirmasi_password) {
|
||||||
|
toastr.error("Password Tidak Sama");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
no_telpon,
|
||||||
|
nama,
|
||||||
|
password
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/daftar",
|
||||||
|
type: "POST",
|
||||||
|
data: JSON.stringify(data),
|
||||||
|
contentType: "application/json",
|
||||||
|
beforeSend: function () {
|
||||||
|
// blockUI('Pendaftaran Sedang Diproses...');
|
||||||
|
},
|
||||||
|
success: function (response) {
|
||||||
|
// buka modal
|
||||||
|
$.unblockUI();
|
||||||
|
toastr.info("Silahkan Lakukan Verifikasi OTP<br>Kode OTP Telah Terkirim Ke Whatsapp Nomor Telpon Anda");
|
||||||
|
$('#modal-otp').modal('show');
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.log(xhr.responseJSON);
|
||||||
|
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||||
|
$.unblockUI();
|
||||||
|
// $('#modal-otp').modal('show');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function verifikasi() {
|
||||||
|
const no_telpon = $("#no_telpon").val();
|
||||||
|
const kode_otp = $("#kode_otp").val();
|
||||||
|
|
||||||
|
if(kode_otp === "") {
|
||||||
|
toastr.error("Kode OTP Harus Diisi");
|
||||||
|
// point to input
|
||||||
|
$("#kode_otp").focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
no_telpon,
|
||||||
|
kode_otp
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/verifikasi",
|
||||||
|
type: "POST",
|
||||||
|
data: JSON.stringify(data),
|
||||||
|
contentType: "application/json",
|
||||||
|
beforeSend: function () {
|
||||||
|
// close modal
|
||||||
|
$('#modal-otp').modal('hide');
|
||||||
|
blockUI('Verifikasi Sedang Diproses...');
|
||||||
|
|
||||||
|
},
|
||||||
|
success: function (response) {
|
||||||
|
$.unblockUI();
|
||||||
|
toastr.success("Verifikasi Berhasil<br>Silahkan Login");
|
||||||
|
// 2 sec the to halaman login
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = "/login";
|
||||||
|
}, 2500);
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||||
|
$.unblockUI();
|
||||||
|
// 1 sec then show modal
|
||||||
|
setTimeout(() => {
|
||||||
|
$('#modal-otp').modal('show');
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
235
routes/user_ui/index.html
Normal file
235
routes/user_ui/index.html
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Shenior Kurir | Halaman Utama</title>
|
||||||
|
|
||||||
|
<!-- Main Styles -->
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- mCustomScrollbar -->
|
||||||
|
<link rel="stylesheet" href="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
|
||||||
|
<!-- Sweet Alert -->
|
||||||
|
<link rel="stylesheet" href="/plugin/sweet-alert/sweetalert.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/fontello/fontello.css">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design-iconic-font/css/material-design-iconic-font.min.css">
|
||||||
|
<link rel="stylesheet" href="/fonts/material-design/css/materialdesignicons.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="main-menu">
|
||||||
|
<header class="header">
|
||||||
|
<a href="/admin" class="logo">Shenior Kurir</a>
|
||||||
|
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||||
|
<div class="user">
|
||||||
|
<a href="#" class="avatar"><img src="/images/person.png" alt=""><span class="status online"></span></a>
|
||||||
|
<h5 class="name"><a href="#">Visitor</a></h5>
|
||||||
|
<h5 class="position">Belum Login</h5>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.user -->
|
||||||
|
</header>
|
||||||
|
<!-- /.header -->
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<div class="navigation">
|
||||||
|
<h5 class="title">Navigasi</h5>
|
||||||
|
<!-- /.title -->
|
||||||
|
<ul class="menu js__accordion">
|
||||||
|
<li class="current active">
|
||||||
|
<a class="waves-effect" href="/"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||||
|
Utama</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect" href="/login"><i
|
||||||
|
class="menu-icon ico icon-login"></i><span>Login</span></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.navigation -->
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.main-menu -->
|
||||||
|
|
||||||
|
<div class="fixed-navbar">
|
||||||
|
<div class="pull-left">
|
||||||
|
<button type="button"
|
||||||
|
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||||
|
<h1 class="page-title">Halaman Utama</h1>
|
||||||
|
<!-- /.page-title -->
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-left -->
|
||||||
|
<div class="pull-right">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="/login" class="ico-item ico icon-login"></a>
|
||||||
|
</div>
|
||||||
|
<!-- /.pull-right -->
|
||||||
|
</div>
|
||||||
|
<!-- /.fixed-navbar -->
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="box-content card">
|
||||||
|
<img src="/images/habibie.jpg" alt="" style="width: 100%; border-radius: 30px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-4 col-md-4 col-xs-12">
|
||||||
|
<div class="box-content">
|
||||||
|
<h4 class="box-title">Jumlah Kurir</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
|
||||||
|
<!-- /.dropdown js__dropdown -->
|
||||||
|
<div class="content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<img src="/images/kurir.png" alt="" style="width: 100%;">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- show this icon ico icon-users-1 -->
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="right-content">
|
||||||
|
<h2 class="guru-counter"></h2>
|
||||||
|
<!-- /.counter -->
|
||||||
|
<p class="text">Orang</p>
|
||||||
|
<!-- /.text -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.right-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-4 col-xs-12">
|
||||||
|
<div class="box-content">
|
||||||
|
<h4 class="box-title">Jumlah User</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
|
||||||
|
<!-- /.dropdown js__dropdown -->
|
||||||
|
<div class="content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<img src="/images/kiriman.png" alt="" style="width: 100%;">
|
||||||
|
</div>
|
||||||
|
<!-- show this icon ico icon-users-1 -->
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="right-content">
|
||||||
|
<h2 class="murid-counter"></h2>
|
||||||
|
<!-- /.counter -->
|
||||||
|
<p class="text">Orang</p>
|
||||||
|
<!-- /.text -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.right-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-4 col-xs-12">
|
||||||
|
<div class="box-content">
|
||||||
|
<h4 class="box-title">Jumlah Kiriman</h4>
|
||||||
|
<!-- /.box-title -->
|
||||||
|
|
||||||
|
<!-- /.dropdown js__dropdown -->
|
||||||
|
<div class="content">
|
||||||
|
<div class="row small-spacing">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<img src="/images/kiriman2.png" alt="" style="width: 100%;">
|
||||||
|
</div>
|
||||||
|
<!-- show this icon ico icon-users-1 -->
|
||||||
|
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="right-content">
|
||||||
|
<h2 class="staf-counter"></h2>
|
||||||
|
<!-- /.counter -->
|
||||||
|
<p class="text">Orang</p>
|
||||||
|
<!-- /.text -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.right-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box-content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer">
|
||||||
|
<ul class="list-inline">
|
||||||
|
<li>Arifuddin Naawi Amanah © 2025.</li>
|
||||||
|
<!-- <li><a href="#">Privacy</a></li>
|
||||||
|
<li><a href="#">Terms</a></li>
|
||||||
|
<li><a href="#">Help</a></li> -->
|
||||||
|
</ul>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<!-- /.main-content -->
|
||||||
|
</div><!--/#wrapper -->
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
<!-- Full Screen Plugin -->
|
||||||
|
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
<script src="/my-js.js"></script>
|
||||||
|
<script src="/socket-io/client-dist/socket.io.js"></script>
|
||||||
|
<script>
|
||||||
|
console.log('hello');
|
||||||
|
const socket = io(); // Connects to your server
|
||||||
|
|
||||||
|
socket.emit('scan_dia', 'Hello from client!');
|
||||||
|
|
||||||
|
socket.on('connect', () => {
|
||||||
|
console.log('Connected to server:', socket.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('scan_dia_lagi', (data) => {
|
||||||
|
alert(data);
|
||||||
|
console.log('Received scan_dia_lagi event:', data); // ✅ Make sure you're logging the variable
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
105
routes/user_ui/login.html
Normal file
105
routes/user_ui/login.html
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
|
||||||
|
<title>Halaman Login Pengguna</title>
|
||||||
|
<link rel="stylesheet" href="/styles/style.min.css">
|
||||||
|
|
||||||
|
<!-- Waves Effect -->
|
||||||
|
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="single-wrapper">
|
||||||
|
<form action="#" class="frm-single">
|
||||||
|
<div class="inside">
|
||||||
|
<div class="title"><strong>Shenior</strong> Kurir</div>
|
||||||
|
<!-- /.title -->
|
||||||
|
<div class="frm-title">Login Pengguna</div>
|
||||||
|
<!-- /.frm-title -->
|
||||||
|
<div class="frm-input"><input type="text" id="username" placeholder="No Telpon" class="frm-inp"><i class="fa fa-user frm-ico"></i></div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
<div class="frm-input"><input type="password" id="password" placeholder="Password" class="frm-inp"><i class="fa fa-lock frm-ico"></i></div>
|
||||||
|
<!-- /.frm-input -->
|
||||||
|
|
||||||
|
<button type="button" class="frm-submit" onclick="login()">Login<i class="fa fa-arrow-circle-right"></i></button>
|
||||||
|
|
||||||
|
<a href="/daftar" class="a-link"><i class="fa fa-user-plus"></i>Belum Menjadi Pengguna? Mendaftar.</a>
|
||||||
|
<br><br>
|
||||||
|
<a href="/kurir/login" class="a-link"><i class="fa fa-motorcycle"></i>Login Kurir.</a>
|
||||||
|
|
||||||
|
<div class="frm-footer">Arifuddin Naawi Amanah © 2025.</div>
|
||||||
|
<!-- /.footer -->
|
||||||
|
</div>
|
||||||
|
<!-- .inside -->
|
||||||
|
</form>
|
||||||
|
<!-- /.frm-single -->
|
||||||
|
</div><!--/#single-wrapper -->
|
||||||
|
|
||||||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="/script/html5shiv.min.js"></script>
|
||||||
|
<script src="/script/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<!--
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="/scripts/jquery.min.js"></script>
|
||||||
|
<script src="/scripts/modernizr.min.js"></script>
|
||||||
|
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||||
|
<script src="/plugin/waves/waves.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Toastr -->
|
||||||
|
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||||
|
|
||||||
|
<script src="/block/jquery.blockUI.js"></script>
|
||||||
|
|
||||||
|
<script src="/scripts/main.min.js"></script>
|
||||||
|
<script src="/my-js.js"></script>
|
||||||
|
<script>
|
||||||
|
function login() {
|
||||||
|
var username = $("#username").val();
|
||||||
|
var password = $("#password").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/login",
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
no_telpon: username,
|
||||||
|
password: password
|
||||||
|
},
|
||||||
|
beforeSend: function () {
|
||||||
|
blockUI('Login Sedang Diproses...');
|
||||||
|
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$.unblockUI();
|
||||||
|
toastr.success("Login Berhasil");
|
||||||
|
// create local storage
|
||||||
|
localStorage.setItem('user', JSON.stringify(data));
|
||||||
|
localStorage.setItem('role', 'user');
|
||||||
|
// 2 sec the to halaman login
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = "/user";
|
||||||
|
}, 2500);
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
$.unblockUI();
|
||||||
|
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
33
socket.ts
Normal file
33
socket.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { Server as HttpServer } from 'http';
|
||||||
|
import { Server as SocketIOServer, Socket } from 'socket.io';
|
||||||
|
import { io as socketClient, Socket as ClientSocket } from 'socket.io-client';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const clientSocket: ClientSocket = socketClient(`http://localhost:3011`);
|
||||||
|
|
||||||
|
let io: SocketIOServer | null = null;
|
||||||
|
|
||||||
|
function init(server: HttpServer): SocketIOServer {
|
||||||
|
io = new SocketIOServer(server, {
|
||||||
|
cors: {
|
||||||
|
origin: "*", // ← Make sure this is set
|
||||||
|
methods: ["GET", "POST"]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return io;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIO(): SocketIOServer {
|
||||||
|
if (!io) {
|
||||||
|
throw new Error('Socket.io not initialized');
|
||||||
|
}
|
||||||
|
return io;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
init,
|
||||||
|
getIO,
|
||||||
|
clientSocket
|
||||||
|
};
|
BIN
tokens/kurir-bot/BrowserMetrics-spare.pma
Normal file
BIN
tokens/kurir-bot/BrowserMetrics-spare.pma
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Affiliation Database
Normal file
BIN
tokens/kurir-bot/Default/Affiliation Database
Normal file
Binary file not shown.
0
tokens/kurir-bot/Default/AutofillStrikeDatabase/LOG
Normal file
0
tokens/kurir-bot/Default/AutofillStrikeDatabase/LOG
Normal file
0
tokens/kurir-bot/Default/BudgetDatabase/LOCK
Normal file
0
tokens/kurir-bot/Default/BudgetDatabase/LOCK
Normal file
0
tokens/kurir-bot/Default/BudgetDatabase/LOG
Normal file
0
tokens/kurir-bot/Default/BudgetDatabase/LOG
Normal file
0
tokens/kurir-bot/Default/BudgetDatabase/LOG.old
Normal file
0
tokens/kurir-bot/Default/BudgetDatabase/LOG.old
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/004b78e6fdcffaff_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/004b78e6fdcffaff_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0095052ca6c03d82_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0095052ca6c03d82_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/00951553675af441_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/00951553675af441_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/00d7b23962a3f696_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/00d7b23962a3f696_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/010bcbd8b9bf3742_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/010bcbd8b9bf3742_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/01f9919abd047514_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/01f9919abd047514_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/02dfcaf4a5df59a3_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/02dfcaf4a5df59a3_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/033ff805c14f6c37_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/033ff805c14f6c37_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/035c191be69e1ad5_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/035c191be69e1ad5_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/040279cbb4baca88_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/040279cbb4baca88_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0518030b91362d63_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0518030b91362d63_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0518030b91362d63_s
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0518030b91362d63_s
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0520bd22e6b871bb_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0520bd22e6b871bb_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/05ad23198a2d2a78_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/05ad23198a2d2a78_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/05bd08af4ec4159f_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/05bd08af4ec4159f_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/060e2856913c23b3_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/060e2856913c23b3_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/066fb797e089d3a2_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/066fb797e089d3a2_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/09ed0401ea572806_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/09ed0401ea572806_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0ab2862c70940e20_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0ab2862c70940e20_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0ab796ac85dc5fcd_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0ab796ac85dc5fcd_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0bfec09851d9499e_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0bfec09851d9499e_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0c04c6f1722090cf_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0c04c6f1722090cf_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0e077edf5584647c_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0e077edf5584647c_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0e3a71b28cce179e_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0e3a71b28cce179e_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0e765eff43420de6_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0e765eff43420de6_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0f46293059a97ced_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0f46293059a97ced_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0fc88f9d9d400fdd_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/0fc88f9d9d400fdd_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/10414c27c0153a6f_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/10414c27c0153a6f_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/10666300d69029f4_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/10666300d69029f4_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/1084a51a0ca20ffd_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/1084a51a0ca20ffd_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/11322173c17f4ef0_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/11322173c17f4ef0_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/127577adad4ccafe_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/127577adad4ccafe_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/127577adad4ccafe_s
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/127577adad4ccafe_s
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/12ff702d033392a7_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/12ff702d033392a7_0
Normal file
Binary file not shown.
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/1317a46a02f85808_0
Normal file
BIN
tokens/kurir-bot/Default/Cache/Cache_Data/1317a46a02f85808_0
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user