Browse Source

modify bat shell

fish 1 month ago
parent
commit
8f1edb3341

+ 13 - 1
README.md

@@ -4,4 +4,16 @@
 [![](https://img.shields.io/badge/Python-3.11.5-brightgreen.svg)](https://git.yoqi.me/lyq/set_github_secret)
 
 
-设置GitHub secret 工具
+设置GitHub secret 工具
+
+## Usage
+
+1、编辑配置 account.json, repo,以及key=value
+
+2、windows 双击 `scripts/start-set_github_secret.bat`,返回201状态码设置成功
+
+
+## License
+
+## Reference
+

+ 2 - 0
docs/Index.md

@@ -0,0 +1,2 @@
+# Index
+

+ 2 - 2
main.py

@@ -7,12 +7,12 @@
 @Desc    :   enter point
 '''
 from set_github_secret import GithubApi
+from set_github_secret.utils.frozen_dir import get_app_path
 import json,os,sys
 
 if __name__=='__main__':
     
-    # current_run_path = os.path.dirname(os.path.realpath(__file__))   错误: windows exe 定位到 temp目录
-    current_run_path = sys.path[0]
+    current_run_path = get_app_path()
     if os.path.exists("account.json"):
         with open("account.json", "r") as file:
             data = json.load(file)

+ 19 - 0
scripts/start-set_github_secret.bat

@@ -0,0 +1,19 @@
+@echo off
+REM ***************************************************************************
+REM @Contact :   liuyuqi.gov@msn.cn
+REM @Time    :   2023/11/10 01:01:31
+REM @Version :   1.0
+REM @License :   (C)Copyright 2019 liuyuqi.
+REM @Desc    :   ÉèÖÃgithub secret
+REM ÅäÖÃ account.json 
+REM repo_path Ñ¡Ïî: ²Ö¿â·¾¶
+REM %1 - ext_name
+REM %2 - characters replaced
+REM %3 - new characters
+REM ***************************************************************************
+
+set PATH=%PATH%;%~dp0
+
+set_github_secret
+
+pause

+ 0 - 1
set_github_secret/set_github_secret.py

@@ -8,7 +8,6 @@
 '''
 
 import requests
-from nacl import encoding, public
 import json,sys
 import base64
 

+ 0 - 0
set_github_secret/utils/__init__.py


+ 18 - 0
set_github_secret/utils/frozen_dir.py

@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+"""
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2024/04/12
+@License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
+@Desc    :   
+"""
+import sys  
+import os  
+   
+def get_app_path() -> str:  
+    """Returns the base application path."""  
+    if hasattr(sys, 'frozen'):  
+        # Handles PyInstaller  
+        return os.path.dirname(sys.executable)  #使用 pyinstaller 打包后的 exe 目录
+    # return os.path.dirname(os.path.dirname(os.path.dirname(__file__))) # 没打包前的py目录
+    return sys.path[0]