Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Himeyama committed Jul 27, 2024
0 parents commit 88092a2
Show file tree
Hide file tree
Showing 21 changed files with 2,728 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
www/main.js
token.txt
__main__.spec
dist/
build/
__pycache__/
Install.exe
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 ひかり

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.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# remote-shutdown
対象 PC と同一 LAN 上にあるスマホや PC から、シャットダウンまたは再起動ができるウェブアプリ兼サーバーです。

## インストール方法
https://github.com/Himeyama/remote-shutdown/releases よりインストーラーをダウンロードし、インストールを行います。

PC 起動時にアプリ (サーバー) が起動します。

> [!NOTE]
> `Win` + `R` のファイル名を指定して実行で `shell:startup` を実行するとショートカットがあります。
> または[スタートアップ](ms-settings:startupapps)で可能です。
## セットアップ
アプリをインストールした PC で http://127.0.0.1:50031 にアクセスすると、トークンと接続先 IP アドレスが得られます。
このトークンを使用して、シャットダウンまたは再起動が可能です。

初回起動時にファイアウォールが聞かれますが、有効にしてください。
有効にした場合、スマホまたは別の PC からアクセス可能になります。

> [!NOTE]
> 誤って無効にした場合、ファイル名を指定して実行 (`Win` + `R`) で `wf.msc` を実行し「受信」の remote_shutdown.exe の規則を削除し、再度アプリを実行してください。
スマホまたは別の PC からアプリがインストールされている PC に接続する場合は、上記のページに表示される IP アドレスを含むリンクにアクセスします。

## 使用法
アプリをインストールしている PC から得られたトークンを入力し、シャットダウンまたは再起動のボタンをクリックします。

<img src="docs/ScreenShot01.png" width="300" />


## 開発環境
以下、開発者向けの説明です。

- Python 3.8.10 (pyenv install 3.8)
- Poetry (pip install poetry)

```bash
poetry shell # 仮想環境立ち上げ
poetry install # 依存パッケージインストール
```

## 実行

```bash
poetry run task build-script # スクリプトをコンパイル
poetry run task main # サーバー起動
```

## 実行ファイル作成
PyInstaller で実行ファイルを作成します。

```bash
poetry run task build-script # Webpack
poetry run task build # PyInstaller で実行ファイル作成
```

## インストーラー作成
nsis でインストーラーを作成します。

```bash
poetry run task pack
```
45 changes: 45 additions & 0 deletions app.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- mode: python ; coding: utf-8 -*-


a = Analysis(
['remote_shutdown\\__main__.py'],
pathex=[],
binaries=[],
datas=[("www\\index.html", "www"), ("www/main.css", "www"), ("www\\main.js", "www"), ("www\\icon.ico", "www")],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='remote_shutdown',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon="www\\icon.ico"
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='remote_shutdown',
)
Binary file added docs/ScreenShot01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 88092a2

Please # to comment.