Skip to content

Instantly share code, notes, and snippets.

View tjmonsi's full-sized avatar

Toni-Jan Keith Monserrat tjmonsi

View GitHub Profile
@tjmonsi
tjmonsi / connectnetwork.src
Created December 29, 2023 05:46
Grey Hack Game connectnetwork
if params.len != 1 then
exit("Usage: connectnetwork [network_device]")
end if
network_device = params[0]
// START
crypto = include_lib("/lib/crypto.so")
if not crypto then
async handleSubmit (e) {
// after nung console.log(values)
const { username, password } = values;
// window.fetch MDN docs
const response = await fetch('http://localhost:8080/auth/login', {
method: 'POST',
headers: {
'Content-type': 'application/json'
import { html } from 'lit';
import { Page as BlogPage } from '../blog/index.js'
export class Page extends BlogPage {
async editBlog (event) {
event.preventDefault();
const { _id } = this.blog || {};
const { target: form } = event;
const title = form.title.value;
import { LitElement, html } from 'lit';
import { proxy } from 'comlink';
import { state } from '../../worker/index.js';
export class Component extends LitElement {
// ... constructor
async connectedCallback () {
super.connectedCallback();
import { home } from './base/home.js';
import { createBlog } from './blog/create-blog.js';
import { getBlog } from './blog/get-blog.js';
import { getManyBlog } from './blog/get-many-blog.js';
import { updateBlog } from './blog/update-blog.js';
import { deleteBlog } from './blog/delete-blog.js';
import { createUser } from './user/create-blog.js';
import { login } from './auth/login.js'
import { logout } from './auth/logout.js'
import { checkAuth } from './auth/check-auth.js';
export async function checkAuth (request) {
const { user } = request;
const { username } = user;
return {
success: true,
username
};
}
// import { root } from './root/index.js';
import { blog } from './blog/index.js';
import { blogId } from './blog/_id/index.js';
import { user } from './user/index.js';
import { authLogin, authLogout, checkAuth } from './auth/index.js';
export const paths = {
// '/': root,
'/blog': blog,
'/blog/:id': blogId,
import { post } from './login/index.js';
import { get } from './logout/index.js';
import { get as getCheckAuth } from './check-auth/index.js'
export const authLogin = {
post
};
export const authLogout = {
get
export const get = {
description: 'Check authentication of a user',
operationId: 'checkAuth',
tags: [
'Auth'
],
responses: {
200: {
description: 'Check authentication of a user',
content: {
import { LitElement, html } from 'lit';
import { state } from '../../worker/index.js';
export class Page extends LitElement {
connectedCallback () {
super.connectedCallback();
this.logout();
}
async logout () {