Skip to content

Instantly share code, notes, and snippets.

@KaKi87
Last active November 7, 2025 12:07
Show Gist options
  • Save KaKi87/4989f9ee01734ba82374aaa407eaf600 to your computer and use it in GitHub Desktop.
Save KaKi87/4989f9ee01734ba82374aaa407eaf600 to your computer and use it in GitHub Desktop.
kChat issue demo
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>kChat</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/destyle.min.css"
>
<style>
:root {
color-scheme: dark;
}
.App {
width: 100vw;
height: 100vh;
padding: 1rem;
font-family: sans-serif;
display: grid;
grid-template-columns: 3rem auto;
column-gap: 1rem;
}
.App__sidebar {
grid-column: 1 / 2;
display: flex;
flex-direction: column;
row-gap: 1rem;
}
.App__sidebar__button {
width: 100%;
aspect-ratio: 1;
text-align: center;
}
.App__container {
grid-column: 2 / 3;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 5px;
overflow: hidden;
}
.App__container:not(.App__container--active) {
display: none;
}
</style>
<script defer src="./renderer.js"></script>
</head>
<body class="App">
<aside class="App__sidebar">
<ul style="display: contents">
<li
style="display: contents"
><button
class="App__sidebar__button"
>Cplt</button></li>
</ul>
</aside>
<main class="App__container"></main>
<webview
class="App__container--active"
src="https://github.com/copilot"
partition="persist:githubCopilot"
></webview>
</body>
</html>
const path = require('node:path');
const {
app,
BrowserWindow,
session,
net
} = require('electron')
const createWindow = () => {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webviewTag: true
}
});
mainWindow.loadFile('index.html');
// mainWindow.webContents.openDevTools();
}
(async () => {
await app.whenReady();
for(const id of ['githubCopilot']){
const webviewSession = session.fromPartition(`persist:${id}`);
webviewSession.protocol.handle('https', request => new Promise(async resolve => {
const response = await net.fetch(request, { bypassCustomProtocolHandlers: true });
resolve(response);
}));
}
createWindow();
app.on(
'activate',
() => BrowserWindow.getAllWindows().length === 0 && createWindow()
);
app.on(
'window-all-closed',
() => process.platform !== 'darwin' && app.quit()
);
})().catch(console.error);
{
"name": "exotic-plough-represent-se0ju",
"productName": "exotic-plough-represent-se0ju",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "kaki",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "38.4.0"
}
}
document.querySelector('webview').openDevTools();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment