Skip to content

Commit

Permalink
Setsuzoku 0.2: Make project build-ready and correct package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
daniwasonline committed Nov 24, 2022
1 parent ca18525 commit a622232
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 161 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
.next
app
dist
renderer/out
5 changes: 3 additions & 2 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ directories:
files:
- from: .
filter:
- package.json
- app
- main
- renderer

publish: null
34 changes: 0 additions & 34 deletions main/nextron/background.old.js

This file was deleted.

86 changes: 0 additions & 86 deletions main/nextron/helpers/create-window.js

This file was deleted.

5 changes: 0 additions & 5 deletions main/nextron/helpers/index.js

This file was deleted.

7 changes: 0 additions & 7 deletions main/nextron/preload.js

This file was deleted.

9 changes: 0 additions & 9 deletions nextron.config.js

This file was deleted.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
"private": true,
"private": false,
"name": "setsuzoku",
"description": "My application description",
"description": "A simplistic SSH host manager for Windows. Built with Next.js, Electron, and powered by OpenSSH.",
"version": "0.1.0",
"author": "Yoshihide Shiono <shiono.yoshihide@gmail.com>",
"author": "Dani <git@danny.works>",
"main": "main/index.js",
"scripts": {
"clean": "rimraf dist renderer/.next renderer/out",
"dev": "electron .",
"build": "next build renderer && next export renderer",
"pack-app": "npm run build && electron-builder --dir",
"dist": "npm run build && electron-builder",
"dev:nextron": "nextron",
"build:nextron": "nextron build",
"postinstall:nextron": "electron-builder install-app-deps"
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {
"@next/font": "^13.0.4",
Expand Down
25 changes: 14 additions & 11 deletions renderer/pages/connect/[...host].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ export default function Connected(props) {
const [ status, setStatus ] = useState("connecting");
const [ displayName, setDisplayName ] = useState(null);
useEffect(() => {
if (props.host !== null) window.setsuzoku.listing.connect(props.host);
if (router.isReady) {
if (router?.query?.host !== null) window.setsuzoku.listing.connect(router?.query?.host);
else router.push("/");

window.onmessage = (event) => {
// event.source === window means the message is coming from the preload
// script, as opposed to from an <iframe> or other source.
if (event.source === window && event.data?.type === "connect") {
console.log(event.data)
if (displayName === null) setDisplayName(event.data.payload.displayName);
setStatus(event.data.payload.status);
window.onmessage = (event) => {
// event.source === window means the message is coming from the preload
// script, as opposed to from an <iframe> or other source.
if (event.source === window && event.data?.type === "connect") {
console.log(event.data)
if (displayName === null) setDisplayName(event.data.payload.displayName);
setStatus(event.data.payload.status);
};
};
};
}, []);
}, [router.isReady]);
return (
<div className="flex flex-col space-y-4 w-full">
{
Expand Down Expand Up @@ -55,7 +58,7 @@ export default function Connected(props) {
<div className="flex items-center justify-center w-full">
<IoSad className="text-6xl" />
</div>
<h1 className="text-2xl font-bold font-Inter text-center">Failed to connect to <span className="lg:hidden">server</span> <code className="text-xl hidden lg:inline-block">{props.host}</code></h1>
<h1 className="text-2xl font-bold font-Inter text-center">Failed to connect to <span className="lg:hidden">server</span> <code className="text-xl hidden lg:inline-block">{router?.query?.host}</code></h1>
<div className="flex flex-row items-center justify-evenly w-full gap-x-4">
<button className="bg-gray-50 text-black rounded-2xl px-6 py-2 font-bold font-Inter text-lg" onClick={() => router.reload()}>Reconnect</button>
<button className="bg-gray-50 text-black rounded-2xl px-6 py-2 font-bold font-Inter text-lg" onClick={() => router.push("/")}>Go home</button>
Expand All @@ -81,7 +84,7 @@ export default function Connected(props) {
);
};

export function getServerSideProps(context) {
export function UNUSED_getServerSideProps(context) {
if (context.query.host) return {
props: {
host: context.query?.host || null
Expand Down
2 changes: 2 additions & 0 deletions renderer/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down
2 changes: 1 addition & 1 deletion renderer/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
},
},
fontFamily: {
"Inter": ["var(--font-inter)"],
"Inter": ["var(--font-inter)", "Inter"],
}
},
plugins: [
Expand Down

0 comments on commit a622232

Please sign in to comment.