Skip to content

Commit

Permalink
Add option to disable keychain
Browse files Browse the repository at this point in the history
  • Loading branch information
lhc70000 committed Nov 9, 2024
1 parent 80747ae commit 7ee2fbe
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 6 deletions.
12 changes: 7 additions & 5 deletions Info.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "OpenSubtitles",
"identifier": "io.iina.opensub",
"version": "1.0.0",
"description": "Description here",
"version": "0.9.1",
"description": "Official OpenSubtitles plugin for IINA",
"author": {
"name": "IINA Developers",
"email": "[email protected]",
"url": "https://iina.io"
"url": "https://github.com/iina/plugin-opensub"
},
"ghVersion": 4,
"ghRepo": "iina/plugin-opensub",
"entry": "dist/index.js",
"global": "dist/global.js",
"permissions": ["show-osd", "file-system", "network-request"],
Expand All @@ -23,6 +24,7 @@
],
"preferencesPage": "pref.html",
"preferenceDefaults": {
"languages": ""
"languages": "",
"save_login": "keychain"
}
}
76 changes: 76 additions & 0 deletions pref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<title>Document</title>
<style>
* {
box-sizing: border-box;
}

html {
margin: 0;
padding: 0;
}

body {
padding: 16px;
margin: 0;
font-size: 13px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

p {
margin: 0;
}

small,
.small {
font-size: 11px;
}

.secondary {
color: rgba(0, 0, 0, 0.5);
}

.pref-section {
margin-bottom: 12px;
}

.pref-help {
margin-top: 2px;
}
</style>
</head>

<body>
<div class="pref-section">
Login credentials
<div style="margin-top: 4px; line-height: 24px">
<div>
<label><input type="radio" name="save_login" value="keychain" data-pref-key />
Save in the system keychain</label>
</div>
<!--div>
<label><input type="radio" name="save_login" value="plaintext" data-pref-key />
Video not larger than:</label>
<input type="number" data-pref-key="max_video_height" style="width: 4em" />
p
</div -->
<div>
<label><input type="radio" name="save_login" value="no" data-pref-key />
Do not save</label>
</div>
</div>
<p class="small pref-help secondary">
If you store your login credentials in the system keychain,
you may need to authenticate with your system password when IINA starts.
If you choose not to save your login credentials,
you will need to enter your opensubtitles.com password every time.
</p>
</div>
</body>

</html>
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const {
console.log("Plugin is running");

const iinaVersion = parseInt(core.getVersion().build);
const keychainAvailable = iinaVersion >= 140;
const keychainAvailable =
iinaVersion >= 140 && preferences.get("save_login") === "keychain";

standaloneWindow.loadFile("dist/ui/window/index.html");

Expand Down

0 comments on commit 7ee2fbe

Please sign in to comment.