Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
# Support TIK

Session gh init
```sh
user_session
__Host-user_session_same_site
centang secure
```

![image](https://github.com/acadcsirt/lapor/assets/11188109/08458fda-8991-4dd5-8331-255f6a61afff)

```sh
_gh_sess
tz
dotcom_user
logged_in
has_recent_activity
_device_id
preferred_color_mode
color_mode
_octo
```
18 changes: 9 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Title -->
<title>Issues | Support HelpDesk</title>
<title>Lapor Insiden | Acad CSIRT</title>

<!-- Development css (used in all pages) -->
<link rel="stylesheet" id="stylesheet" href="src/css/style.css"> <!-- Production css (used in all pages) -->
Expand Down Expand Up @@ -93,7 +93,7 @@ <h2 class="text-2xl font-semibold text-gray-200 px-4 max-h-9 overflow-hidden hid
-6 c469 -33 947 205 1214 605 229 342 291 790 163 1173 -24 70 -76 192 -94
217 -10 16 -14 14 -45 -18z"/>
</g>
</svg><span class="text-gray-700 dark:text-gray-200">Support</span>
</svg><span class="text-gray-700 dark:text-gray-200">Lapor</span>
<h2 class="text-3xl font-semibold mx-auto logo-compact hidden">
<!-- <img class="inline-block w-7 h-auto -mt-1" src="../src/img/logo.png"> -->
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-7 h-7 -mt-1" viewBox="0 0 300.000000 300.000000">
Expand Down Expand Up @@ -307,7 +307,7 @@ <h3 class="text-md font-bold">Customizer</h3>
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286zm1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94z"/>
</svg>
<i class="mr-2 fas fa-question-circle"></i> Help &amp; Support
<i class="mr-2 fas fa-question-circle"></i> Help &amp; Lapor
</a>
</li>
<li class="relative">
Expand Down Expand Up @@ -342,13 +342,13 @@ <h3 class="text-md font-bold">Customizer</h3>
<!-- row -->
<div class="flex flex-wrap flex-row">
<div class="flex-shrink max-w-full px-4 w-full">
<p class="text-xl font-bold mt-3 mb-5">Buat Issues Baru</p>
<p class="text-xl font-bold mt-3 mb-5">Lapor Insiden</p>
</div>
<div class="flex-shrink max-w-full px-4 w-full mb-6">
<div class="p-6 bg-white dark:bg-gray-800 rounded-lg shadow-lg h-full">
<form id="issuesform" action="" method="POST" class="flex flex-wrap flex-row -mx-4">
<form id="issuesform" action="" method="POST" class="flex flex-wrap flex-row -mx-4" onsubmit="event.preventDefault();">
<div class="flex-shrink max-w-full px-4 w-full mb-4">
<label for="inputtittle" class="inline-block mb-2">Judul Pengaduan</label>
<label for="inputtittle" class="inline-block mb-2">Judul Insiden</label>
<input type="text" class="w-full leading-5 relative py-2 px-4 rounded text-gray-800 bg-white border border-gray-300 overflow-x-auto focus:outline-none focus:border-gray-400 focus:ring-0 dark:text-gray-300 dark:bg-gray-700 dark:border-gray-700 dark:focus:border-gray-600" id="inputtittle">
</div>

Expand Down Expand Up @@ -385,12 +385,12 @@ <h3 class="text-md font-bold">Customizer</h3>
</div>

<div class="flex-shrink max-w-full px-4 w-full">
<label for="inputbody" class="inline-block mb-2">Body</label>
<label for="inputbody" class="inline-block mb-2">Deskripsi</label>
<textarea class="w-full h-32 py-2 px-4 rounded text-gray-800 bg-white border border-gray-300 overflow-x-auto focus:outline-none focus:border-gray-400 focus:ring-0 dark:text-gray-300 dark:bg-gray-700 dark:border-gray-700 dark:focus:border-gray-600" id="inputbody"></textarea>
</div>

<div class="flex-shrink max-w-full px-4 w-full">
<button id="submitButton" class="py-2 px-4 mb-3 block lg:inline-block text-center rounded leading-5 text-gray-100 bg-indigo-500 border border-indigo-500 hover:text-white hover:bg-indigo-600 hover:ring-0 hover:border-indigo-600 focus:bg-indigo-600 focus:border-indigo-600 focus:outline-none focus:ring-0">Tambah Pengajuan <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="inline-block ltr:ml-1 rtl:mr-1 bi bi-plus-lg" viewBox="0 0 16 16" ><path d="M8 0a1 1 0 0 1 1 1v6h6a1 1 0 1 1 0 2H9v6a1 1 0 1 1-2 0V9H1a1 1 0 0 1 0-2h6V1a1 1 0 0 1 1-1z"></path></svg></button>
<button id="submitButton" class="py-2 px-4 mb-3 block lg:inline-block text-center rounded leading-5 text-gray-100 bg-indigo-500 border border-indigo-500 hover:text-white hover:bg-indigo-600 hover:ring-0 hover:border-indigo-600 focus:bg-indigo-600 focus:border-indigo-600 focus:outline-none focus:ring-0">Kirim Laporan <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="inline-block ltr:ml-1 rtl:mr-1 bi bi-plus-lg" viewBox="0 0 16 16" ><path d="M8 0a1 1 0 0 1 1 1v6h6a1 1 0 1 1 0 2H9v6a1 1 0 1 1-2 0V9H1a1 1 0 0 1 0-2h6V1a1 1 0 0 1 1-1z"></path></svg></button>
</div>
</form>

Expand Down Expand Up @@ -447,7 +447,7 @@ <h3 id="modalMessage" class="mb-5 text-lg font-normal text-gray-500 dark:text-gr


<!-- <script src="js/controller/script.js" type="module"></script> -->
<script src="js/controller/issues.js" type="module" ></script>
<script src="js/controller/issues.js" type="module"></script>


<!--start::Global javascript (used in all pages)-->
Expand Down
1 change: 1 addition & 0 deletions js/controller/bot.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 28 additions & 52 deletions js/controller/issues.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,31 @@

import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
import Swal from "https://cdn.skypack.dev/sweetalert2@11.1.2";

document.addEventListener('DOMContentLoaded', () => {
const uhuy = 'Z2hwX2lmVW94RGVyaWdxWDdicXg4RzdFNklMczlQTUtGVTJnaVlZZg==';
const octokit = new Octokit({
auth: atob(uhuy)
});

const form = document.getElementById('issuesform');

form.addEventListener('submit', async (e) => {
e.preventDefault();

const title = document.getElementById('inputtittle').value;
const body = document.getElementById('inputbody').value;
const milestone = parseInt(document.getElementById('inputmilestone').value);
const assigneeSelect = document.getElementById('inputassigness');
const assignees = [assigneeSelect.options[assigneeSelect.selectedIndex].value];

const labelsSelect = document.getElementById('inputlabels');
const labels = Array.from(labelsSelect.selectedOptions, option => option.value);


try {
const response = await octokit.request('POST /repos/dtiulbi/question-ticketing/issues', {
owner: 'dtiulbi',
repo: 'question-ticketing',
title,
assignees,
milestone,
labels,
body,
headers: {
'X-GitHub-Api-Version': '2022-11-28',
'Accept': 'application/vnd.github.v3+json'

}
});
console.log('Issue created:', response);
showModal('Pengajuan Tiket Layanan Akan Proses', response);

} catch (error) {
console.error('Failed to create issue:', error);
showModalerror('Gagal Mengirim Pengajuan Pastikan Sudah Diisi Semua', error);

}
});
});

function showModal(message) {
import {onClick,getValue} from "https://jscroot.github.io/element/croot.js";
import {postWithBearer} from "https://jscroot.github.io/api/github.js";
import { iteungbot } from "./bot.js";

onClick("submitButton",kirimIssues);

function kirimIssues(){
let data = {
title : getValue("inputtittle"),
assignees : [getValue("inputassigness")],
milestone : Number(getValue("inputmilestone")),
labels : [getValue("inputlabels")],
body : getValue("inputbody"),
}
postWithBearer("https://api.github.com/repos/acadcsirt/lapor/issues",atob(iteungbot),data,responseFunction)
}

function responseFunction(response){
console.log('Issue created:', response);
if(response.message === "Validation Failed"){
showModalerror('Gagal Mengirim Laporan Pastikan Sudah Diisi Semua ' + response.errors[0].code);
} else{
showModal('ID Laporan ' + response.id);
}
}

function showModal(message) {
Swal.fire({
title: 'Selamat!',
text: message,
Expand All @@ -60,7 +36,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
}

function showModalerror(message, error) {
function showModalerror(message, error) {
Swal.fire({
icon: 'error',
title: 'Oops...',
Expand Down