mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-17 22:29:38 +00:00
Compare commits
324 Commits
release-1.
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a26e1448ab | ||
![]() |
59a8d5c577 | ||
![]() |
ef5e34331e | ||
![]() |
cc5da53f23 | ||
![]() |
5d0128e2af | ||
![]() |
101f14c4d6 | ||
![]() |
49939dd963 | ||
![]() |
257218c5a1 | ||
![]() |
808c275167 | ||
![]() |
5d49c97662 | ||
![]() |
16311d2eff | ||
![]() |
4a23d31b03 | ||
![]() |
97088fb943 | ||
![]() |
b987f539f8 | ||
![]() |
117d2950ea | ||
![]() |
0aa0e06194 | ||
![]() |
2ddce17442 | ||
![]() |
ae127fb837 | ||
![]() |
f7fa4bf081 | ||
![]() |
9cdbc5e328 | ||
![]() |
778cc0ec74 | ||
![]() |
451313f414 | ||
![]() |
2c6b048721 | ||
![]() |
adb0647fdc | ||
![]() |
f06f2cc9fc | ||
![]() |
8fd5de8b75 | ||
![]() |
20f5d7e250 | ||
![]() |
6125553e40 | ||
![]() |
ec3332a248 | ||
![]() |
7a7cb4d8fd | ||
![]() |
a815b4c431 | ||
![]() |
f20c520123 | ||
![]() |
4675073530 | ||
![]() |
ad979d6b86 | ||
![]() |
1abe50b40a | ||
![]() |
d03513ea3d | ||
![]() |
2560bd4315 | ||
![]() |
99303f82e7 | ||
![]() |
1d38e90b2b | ||
![]() |
0513fa7b23 | ||
![]() |
fde5bc7fe2 | ||
![]() |
6e4f9d0459 | ||
![]() |
2176853993 | ||
![]() |
32645bb3cf | ||
![]() |
47f7753b99 | ||
![]() |
6a0d9cb53a | ||
![]() |
97c7b4d4dd | ||
![]() |
095d9fcfc2 | ||
![]() |
f2e43a55f9 | ||
![]() |
1c628866b6 | ||
![]() |
4995ea430c | ||
![]() |
6df2e71cdb | ||
![]() |
b3409c56ab | ||
![]() |
e617596a9b | ||
![]() |
b903283b76 | ||
![]() |
4b167af46f | ||
![]() |
d396ceefed | ||
![]() |
db55349be9 | ||
![]() |
32563f1491 | ||
![]() |
1a6ba2ebad | ||
![]() |
f7151dc9dd | ||
![]() |
abcc95654c | ||
![]() |
2fa7daac19 | ||
![]() |
9b1d81d28c | ||
![]() |
f1f3a8ce24 | ||
![]() |
ddb5bf24d7 | ||
![]() |
32d090e514 | ||
![]() |
56e22ad4ab | ||
![]() |
c97b1fa174 | ||
![]() |
9e73bffd51 | ||
![]() |
18f25c5ef4 | ||
![]() |
05bb059b41 | ||
![]() |
791761fd8f | ||
![]() |
515033fc88 | ||
![]() |
676efb060e | ||
![]() |
df9557786d | ||
![]() |
fdfa95790c | ||
![]() |
26a04b8988 | ||
![]() |
3eb2a7c7fd | ||
![]() |
4759073cc4 | ||
![]() |
a2693a2978 | ||
![]() |
ecc5cf1d37 | ||
![]() |
be0180a415 | ||
![]() |
331f8e3c9f | ||
![]() |
fe769d84b3 | ||
![]() |
c512923a8e | ||
![]() |
1b4d4598e1 | ||
![]() |
3c5ebd4ec4 | ||
![]() |
22fe95d424 | ||
![]() |
256239dda9 | ||
![]() |
04ed04e863 | ||
![]() |
765832a307 | ||
![]() |
9cc9fb95eb | ||
![]() |
b5007ad65e | ||
![]() |
5b82845458 | ||
![]() |
8087296918 | ||
![]() |
a7a5ffe633 | ||
![]() |
ef6fdfb4a4 | ||
![]() |
282081dfe7 | ||
![]() |
25c9044261 | ||
![]() |
c473720d35 | ||
![]() |
df6906ecc9 | ||
![]() |
e3412a7f92 | ||
![]() |
dbd91eeebf | ||
![]() |
cf5b61fb88 | ||
![]() |
6157ac2b68 | ||
![]() |
9894d89a0c | ||
![]() |
17ad99cd5d | ||
![]() |
62445407ea | ||
![]() |
2aa07629c5 | ||
![]() |
92f76eeebe | ||
![]() |
c429e03f42 | ||
![]() |
ec6494b13f | ||
![]() |
737b6e6379 | ||
![]() |
e6fee04fde | ||
![]() |
cc715afb90 | ||
![]() |
8e63507dbd | ||
![]() |
5f8cb2d794 | ||
![]() |
66352b99d5 | ||
![]() |
e181fb7950 | ||
![]() |
379fa1e9e3 | ||
![]() |
5366657a3f | ||
![]() |
1a048d61c3 | ||
![]() |
30be5c41ec | ||
![]() |
ef99b5a525 | ||
![]() |
74d7589809 | ||
![]() |
c59b9c47ab | ||
![]() |
9d0887cb92 | ||
![]() |
9865aecb70 | ||
![]() |
40b25415d8 | ||
![]() |
b0f3deccba | ||
![]() |
6286139a81 | ||
![]() |
61961cc157 | ||
![]() |
71d86f752e | ||
![]() |
6db391d6e3 | ||
![]() |
34fbe67c53 | ||
![]() |
387d4c98bd | ||
![]() |
fce24322f7 | ||
![]() |
f80ded4304 | ||
![]() |
1cbdd5f6aa | ||
![]() |
25cb540499 | ||
![]() |
fbd5081bbe | ||
![]() |
0e7b221d03 | ||
![]() |
fbef9a1ae8 | ||
![]() |
642ffb90f9 | ||
![]() |
eaab177667 | ||
![]() |
aa4a464498 | ||
![]() |
07687789a6 | ||
![]() |
7670e87dc2 | ||
![]() |
a8157cd805 | ||
![]() |
820c0776e4 | ||
![]() |
25f86b5dba | ||
![]() |
e313b6fa6e | ||
![]() |
72c3d62724 | ||
![]() |
b2256919ee | ||
![]() |
50ea2181da | ||
![]() |
e5d2afa352 | ||
![]() |
e0995c6835 | ||
![]() |
b1e9307c0f | ||
![]() |
fc56b108e2 | ||
![]() |
44a1caa8cd | ||
![]() |
a4bf0788aa | ||
![]() |
b5a6bf1866 | ||
![]() |
ee4d55cf2c | ||
![]() |
238684b167 | ||
![]() |
416e9e7bac | ||
![]() |
d91778b7ea | ||
![]() |
61463d6a89 | ||
![]() |
8e3a946ec1 | ||
![]() |
c06ce580a2 | ||
![]() |
e419de1f08 | ||
![]() |
d6acb8bb62 | ||
![]() |
15f6cd586b | ||
![]() |
babede641e | ||
![]() |
b709537a02 | ||
![]() |
d880f59834 | ||
![]() |
6f3259a3f2 | ||
![]() |
7c457255bb | ||
![]() |
79689febf2 | ||
![]() |
1c383651ec | ||
![]() |
8210340278 | ||
![]() |
d62a52fa3b | ||
![]() |
1fe335d3bc | ||
![]() |
6fa93a184a | ||
![]() |
9f3d5e543a | ||
![]() |
d494abf0ac | ||
![]() |
7dace75ac1 | ||
![]() |
7690504161 | ||
![]() |
a32f8129dc | ||
![]() |
fc2f067d21 | ||
![]() |
20a6b490a3 | ||
![]() |
83c5e00a8d | ||
![]() |
732e94d4b4 | ||
![]() |
2eb57e1ac6 | ||
![]() |
f1e4933fca | ||
![]() |
42b1fd0293 | ||
![]() |
1fe9cc69ef | ||
![]() |
65c1e7ce71 | ||
![]() |
4e9de8ca87 | ||
![]() |
d01462cd36 | ||
![]() |
d69e758fa1 | ||
![]() |
40993aba06 | ||
![]() |
ac032b1b9d | ||
![]() |
cc02e1a18a | ||
![]() |
30841b1926 | ||
![]() |
c8c0489018 | ||
![]() |
065a4b9ae4 | ||
![]() |
b9a0931fff | ||
![]() |
385396f920 | ||
![]() |
df92a8f998 | ||
![]() |
e1366bbbd3 | ||
![]() |
c465a22f3c | ||
![]() |
1f42868161 | ||
![]() |
4aa9ee69be | ||
![]() |
65e81bda35 | ||
![]() |
c593c570d6 | ||
![]() |
c783a347e3 | ||
![]() |
0cafeefffa | ||
![]() |
8e877c6730 | ||
![]() |
25be46f2c4 | ||
![]() |
888dc500d0 | ||
![]() |
4125acb31d | ||
![]() |
19d7b54c5d | ||
![]() |
e46fd07736 | ||
![]() |
02b3dac86f | ||
![]() |
c7f0a7a8b7 | ||
![]() |
1279520676 | ||
![]() |
d8ae906816 | ||
![]() |
57dc72b45b | ||
![]() |
4500196675 | ||
![]() |
2c1a8cf77d | ||
![]() |
a77727f3c6 | ||
![]() |
899dd14eea | ||
![]() |
db616bbfe7 | ||
![]() |
4758c09db1 | ||
![]() |
737319774d | ||
![]() |
e975512d0c | ||
![]() |
f2b02a16c5 | ||
![]() |
25594609d9 | ||
![]() |
ab1b8fec8f | ||
![]() |
3af9d80643 | ||
![]() |
173112b5cc | ||
![]() |
f59c924b20 | ||
![]() |
d30a0bde9c | ||
![]() |
e31eb2241f | ||
![]() |
e5fa056cc2 | ||
![]() |
146c7bfcc7 | ||
![]() |
25482cc360 | ||
![]() |
c3cbfa9a8e | ||
![]() |
f251d3343c | ||
![]() |
b17c25a9a8 | ||
![]() |
9d3b187528 | ||
![]() |
9236307c39 | ||
![]() |
5c1ceaeba4 | ||
![]() |
8de9ea5df4 | ||
![]() |
734ad802fd | ||
![]() |
db04e4acfb | ||
![]() |
c745fa92e0 | ||
![]() |
b6775636e5 | ||
![]() |
d6b04b2889 | ||
![]() |
64ff6ad9dc | ||
![]() |
a2d38710fd | ||
![]() |
ba7234260e | ||
![]() |
ffedb0d8bb | ||
![]() |
90c3b55876 | ||
![]() |
a9dbe464d6 | ||
![]() |
223c2b98a9 | ||
![]() |
a440cf6a9e | ||
![]() |
8019ca9924 | ||
![]() |
6d9b662a52 | ||
![]() |
cb280773f7 | ||
![]() |
f0456922d8 | ||
![]() |
8aeaef9724 | ||
![]() |
e516ca2606 | ||
![]() |
13358a8fde | ||
![]() |
6fb4cdbf2c | ||
![]() |
32f57cb8b5 | ||
![]() |
54a93033f8 | ||
![]() |
12a0c892f0 | ||
![]() |
361c6bb7c5 | ||
![]() |
6bcd2fe261 | ||
![]() |
e3c8d282ed | ||
![]() |
f288cf7aa7 | ||
![]() |
39708ef33d | ||
![]() |
fcbfd31884 | ||
![]() |
c8fa1669f0 | ||
![]() |
95f20bba3e | ||
![]() |
be80c981d7 | ||
![]() |
2687633662 | ||
![]() |
4d455e752d | ||
![]() |
3d791be85a | ||
![]() |
9f6ea484be | ||
![]() |
4c75fa2f41 | ||
![]() |
405e2a4d72 | ||
![]() |
75e388cffa | ||
![]() |
cc64b6969f | ||
![]() |
642eb2f417 | ||
![]() |
464624290f | ||
![]() |
770a7684da | ||
![]() |
daead7a5f7 | ||
![]() |
e5c2badb8d | ||
![]() |
bb2b25a889 | ||
![]() |
96e183e8b2 | ||
![]() |
3b6be1434b | ||
![]() |
0304d68187 | ||
![]() |
39d2c186a9 | ||
![]() |
439ef054e9 | ||
![]() |
872b5cc262 | ||
![]() |
ce7eae2d9d | ||
![]() |
b0c1bc3619 | ||
![]() |
de4b4be0df | ||
![]() |
6788cc7407 | ||
![]() |
892f8b10fe | ||
![]() |
45dce586af | ||
![]() |
8e05ff94dd | ||
![]() |
c173ffcc97 | ||
![]() |
ef3c7e9459 | ||
![]() |
d4e163ed5c | ||
![]() |
a0e43047da | ||
![]() |
554e084c4d | ||
![]() |
b0544db1a2 | ||
![]() |
9deed0b8b8 | ||
![]() |
e13c65b1e7 | ||
![]() |
ebd275fb81 |
76
.github/workflows/build-linux.yml
vendored
Normal file
76
.github/workflows/build-linux.yml
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
name: Build Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build_x64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- run: npm install
|
||||
working-directory: simpliplay
|
||||
|
||||
- run: npx electron-builder --linux --x64
|
||||
working-directory: simpliplay
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-x64-snap
|
||||
path: simpliplay/dist/*.snap
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-x64-appimage
|
||||
path: simpliplay/dist/*.AppImage
|
||||
|
||||
build_arm64:
|
||||
runs-on: ubuntu-22.04-arm
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Use ARM64 package.json
|
||||
run: |
|
||||
mv simpliplay/package.json simpliplay/package-unused.json
|
||||
mv simpliplay/package-arm64-linux.json simpliplay/package.json
|
||||
|
||||
- run: npm install
|
||||
working-directory: simpliplay
|
||||
|
||||
- run: npx electron-builder --linux AppImage --arm64
|
||||
working-directory: simpliplay
|
||||
|
||||
- run: sudo apt-get update && sudo apt-get install --only-upgrade libgdk-pixbuf-2.0-0
|
||||
|
||||
- run: sudo snap install snapcraft --classic
|
||||
|
||||
- run: sudo snap install gnome-3-28-1804
|
||||
|
||||
- run: sudo snap install gtk-common-themes
|
||||
|
||||
- run: sudo snap install core22
|
||||
|
||||
- run: SNAPCRAFT_BUILD_ENVIRONMENT=host USE_SYSTEM_FPM=true npx electron-builder --linux snap --arm64
|
||||
working-directory: simpliplay
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-arm64-appimage
|
||||
path: simpliplay/dist/*.AppImage
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-arm64-snap
|
||||
path: simpliplay/dist/*.snap
|
41
.github/workflows/build-macos.yml
vendored
Normal file
41
.github/workflows/build-macos.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: Build macOS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Clean up caches
|
||||
run: |
|
||||
npm cache clean --force
|
||||
rm -rf ~/Library/Caches/electron-builder
|
||||
working-directory: simpliplay
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: simpliplay
|
||||
|
||||
- name: Create DMGs
|
||||
run: npx electron-builder --mac --x64 --arm64 --universal
|
||||
working-directory: simpliplay
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds
|
||||
# Upload only the final signed DMGs
|
||||
path: simpliplay/dist/*.dmg
|
64
.github/workflows/build-win.yml
vendored
Normal file
64
.github/workflows/build-win.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: Build Windows
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build-x64:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: simpliplay
|
||||
|
||||
- name: Build Windows (x64)
|
||||
env:
|
||||
CSC_IDENTITY_AUTO_DISCOVERY: false
|
||||
run: npx electron-builder --win --x64
|
||||
working-directory: simpliplay
|
||||
|
||||
- name: Upload artifacts (x64)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-x64
|
||||
path: simpliplay/dist/
|
||||
|
||||
build-arm64:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: simpliplay
|
||||
|
||||
- name: Build Windows (arm64)
|
||||
env:
|
||||
CSC_IDENTITY_AUTO_DISCOVERY: false
|
||||
run: npx electron-builder --win --arm64
|
||||
working-directory: simpliplay
|
||||
|
||||
- name: Upload artifacts (arm64)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: builds-arm64
|
||||
path: simpliplay/dist/
|
129
.github/workflows/draft-release.yml
vendored
Normal file
129
.github/workflows/draft-release.yml
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
name: Draft Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
create-draft-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare folder
|
||||
run: mkdir -p all-artifacts
|
||||
|
||||
- name: Poll for expected artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
echo "Polling (every 15 seconds) until all required artifacts are available..."
|
||||
|
||||
REQUIRED=("linux-x64-appimage" "linux-x64-snap" "linux-arm64-snap" "builds" "builds-x64" "builds-arm64")
|
||||
|
||||
while true; do
|
||||
echo "⏳ Checking artifacts..."
|
||||
|
||||
rm -rf all-artifacts
|
||||
mkdir -p all-artifacts
|
||||
|
||||
gh run download --dir all-artifacts || true
|
||||
|
||||
missing=0
|
||||
for ARTIFACT in "${REQUIRED[@]}"; do
|
||||
if [ ! -d "all-artifacts/$ARTIFACT" ]; then
|
||||
echo "❌ Missing: $ARTIFACT"
|
||||
missing=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$missing" -eq 0 ]; then
|
||||
echo "✅ All required artifacts found."
|
||||
break
|
||||
fi
|
||||
|
||||
echo "🔁 Not all artifacts were found. Retrying in 15 seconds..."
|
||||
sleep 15
|
||||
done
|
||||
|
||||
- name: Extract ZIP files and prepare list of files to upload
|
||||
run: |
|
||||
set -e
|
||||
echo "🔍 Extracting ZIP files and collecting allowed SimpliPlay files..."
|
||||
|
||||
find all-artifacts -type f -name '*.zip' | while read -r zipfile; do
|
||||
extract_dir="${zipfile%.zip}"
|
||||
echo "📦 Extracting $zipfile to $extract_dir"
|
||||
unzip -o "$zipfile" -d "$extract_dir"
|
||||
done
|
||||
|
||||
rm -f upload-files.txt
|
||||
find all-artifacts -type f \( -iname '*.exe' -o -iname '*.dmg' -o -iname '*.AppImage' \) | grep 'SimpliPlay' > upload-files.txt
|
||||
|
||||
echo "Filtered files to upload:"
|
||||
cat upload-files.txt
|
||||
|
||||
- name: Create empty draft release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: "draft-${{ github.run_number }}"
|
||||
draft: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Rename files if duplicates exist on release
|
||||
id: rename
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
sanitize_filename() {
|
||||
echo "$1" | tr ' ' '-'
|
||||
}
|
||||
|
||||
release_tag="draft-${{ github.run_number }}"
|
||||
existing_assets=$(gh release view "$release_tag" --json assets --jq '.assets[].name' || echo "")
|
||||
echo "Existing assets on release $release_tag:"
|
||||
echo "$existing_assets"
|
||||
|
||||
rm -f upload-files-renamed.txt
|
||||
touch upload-files-renamed.txt
|
||||
|
||||
while IFS= read -r filepath; do
|
||||
filename=$(basename "$filepath")
|
||||
dirname=$(basename "$(dirname "$filepath")")
|
||||
|
||||
safe_filename=$(sanitize_filename "$filename")
|
||||
|
||||
if echo "$existing_assets" | grep -qx "$safe_filename"; then
|
||||
extension="${filename##*.}"
|
||||
name="${filename%.*}"
|
||||
safe_name=$(sanitize_filename "$name")
|
||||
newname="${safe_name}-${dirname}.${extension}"
|
||||
echo "Renaming $filename to $newname because it exists in release"
|
||||
cp "$filepath" "all-artifacts/$newname"
|
||||
echo "all-artifacts/$newname" >> upload-files-renamed.txt
|
||||
else
|
||||
if [[ "$filename" != "$safe_filename" ]]; then
|
||||
cp "$filepath" "all-artifacts/$safe_filename"
|
||||
echo "all-artifacts/$safe_filename" >> upload-files-renamed.txt
|
||||
else
|
||||
echo "$filepath" >> upload-files-renamed.txt
|
||||
fi
|
||||
fi
|
||||
done < upload-files.txt
|
||||
|
||||
echo "Final list of files to upload:"
|
||||
cat upload-files-renamed.txt
|
||||
|
||||
- name: Upload assets to draft release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
release_tag="draft-${{ github.run_number }}"
|
||||
while IFS= read -r filepath; do
|
||||
echo "Uploading $filepath"
|
||||
gh release upload "$release_tag" "$filepath" --clobber
|
||||
done < upload-files-renamed.txt
|
6
ADDONS.md
Normal file
6
ADDONS.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Addons
|
||||
Addons in SimpliPlay desktop are a new feature introduced in v2.0.4. They are simply regular JavaScript files with the `.simpliplay` extension.
|
||||
|
||||
The process of loading an addon adds a script element with the src tag, along with other necessary info to distinguish it from a non-addon script tag.
|
||||
When you unload an addon, it removes this element, but any lasting effects created by the addon (such as changing the app's background color) will last until you restart the app (closing and opening it again).
|
||||
Non-lasting effects, like context menus (that use event listeners), will disappear upon unloading.
|
15
ANTIVIRUS.md
Normal file
15
ANTIVIRUS.md
Normal file
@ -0,0 +1,15 @@
|
||||
# SimpliPlay - Antiviruses
|
||||
Especially for the desktop version, many antiviruses flag SimpliPlay as a malicious app. This is a false positive, in other words, the antivirus
|
||||
thinks SimpliPlay is malicious when it isn't.
|
||||
|
||||
To resolve these problems, it depends on your situation, operating system, and antivirus.
|
||||
|
||||
## Scans and Closes
|
||||
In case your antivirus repeatedly scans and/or closes SimpliPlay by force, you should whitelist the app by going to their software whitelisting page,
|
||||
or force your antivirus to not flag SimpliPlay by whitelisting and/or using Task Manager (Windows) or Activity Monitor (macOS) to force-close the scan operations (though this might require adminstrator privileges).
|
||||
|
||||
## Quarantined Files
|
||||
In case your antivirus flags important files in the SimpliPlay app required for it to run, you'll need to unquarantine them by going to your antiviruses
|
||||
*Quarantine* page. Unquarantine any files related to the SimpliPlay app.
|
||||
|
||||
From testing with antiviruses, we have found that SimpliPlay seems to be the most flagged on **Windows**. You most likely won't need to do anything on other operating systems.
|
3
CONTRIBUTING.md
Normal file
3
CONTRIBUTING.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Contributing
|
||||
To contribute to the SimpliPlay desktop project, simply fork the repository, make your changes, and make a pull request to whichever branch you changed.
|
||||
Your pull request may take a while to be accepted, but once accepted, a new release for the app will be created and will be shipped to all users.
|
24
README.md
24
README.md
@ -1,20 +1,30 @@
|
||||
# simpliplay-desktop
|
||||
The desktop version of SimpliPlay.
|
||||
The desktop version of SimpliPlay, a simple, cross-platform media player.
|
||||
|
||||
## simpliplay
|
||||
[Electron](https://electronjs.org) version of SimpliPlay for Windows, macOS, and Linux (x64 and ARM64).
|
||||
|
||||
## simpliplay-lite
|
||||
## [simpliplay-lite](https://github.com/A-Star100/simpliplay-desktop/tree/lite)
|
||||
[Neutralinojs](https://neutralino.js.org) version of SimpliPlay (significantly smaller filesize) for Windows (x64 only), macOS, and Linux (both x64 and ARM64).
|
||||
|
||||
## simpliplay-nwjs
|
||||
[NW.js](https://nwjs.io) version of SimpliPlay for Windows, macOS, and Linux (x64 and ARM64).
|
||||
> [!WARNING]
|
||||
> This version of SimpliPlay has been [officially discontinued](https://simpliplay.netlify.app/docs/blog/lite-ver-end) and **will not** receive any more security updates.
|
||||
> It is still stable and secure, but has not received a few patches (e.g, the infamous **[memory leak issue](https://github.com/A-Star100/simpliplay-desktop/issues/4)**) that the web version, Chrome extension, and main desktop version all have.
|
||||
|
||||
## [simpliplay-nwjs](https://github.com/A-Star100/simpliplay-desktop/tree/nwjs)
|
||||
[NW.js](https://nwjs.io) version of SimpliPlay for Windows, macOS, and Linux (x64 and ARM64).
|
||||
> [!IMPORTANT]
|
||||
> This version is an example NW.js configuration, it won't be used in production, but you can use it if you would like. Files in this version won't be updated, so refer to files from the Electron release for production usage.
|
||||
|
||||
## [simpliplay-legacy](https://github.com/A-Star100/simpliplay-desktop/tree/legacy)
|
||||
[Legacy](https://simpliplay.netlify.app/legacy) version of SimpliPlay for Windows, macOS, and Linux (x64 and x86).
|
||||
> [!CAUTION]
|
||||
> This version uses a very old, legacy version of NW.js that supports Windows XP and macOS 10.6 or later.
|
||||
> Unless the main desktop version isn't supported on your operating system, **please don't use the legacy version**, it will open you up to **security issues** on newer devices!
|
||||
___
|
||||
|
||||
## Setup
|
||||
Read the docs ([Electron - Quick Start](https://www.electronjs.org/docs/latest/tutorial/quick-start), [Neutralinojs - Your First App](https://neutralino.js.org/docs/getting-started/your-first-neutralinojs-app), [NW.js - Getting Started (For Users)](https://nwjs.readthedocs.io/en/latest/For%20Users/Getting%20Started/#write-nwjs-app))
|
||||
|
||||
Read the docs ([Electron - Tutorial](https://www.electronjs.org/docs/latest/tutorial/tutorial-prerequisites), [Neutralinojs - Your First App](https://neutralino.js.org/docs/getting-started/your-first-neutralinojs-app), [NW.js - Getting Started (For Users)](https://nwjs.readthedocs.io/en/latest/For%20Users/Getting%20Started/#write-nwjs-app))
|
||||
|
||||
## Mirrors
|
||||
Self-hosted mirror available [here](https://new-git.anirudhsevugan.me/anirudh/simpliplay-desktop/src/branch/main/).
|
||||
**The server may not always be up. If it isn't, you can contact me at: (personal at anirudhsevugan dot me)**.
|
||||
|
1099
simpliplay-lite/package-lock.json
generated
1099
simpliplay-lite/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@neutralinojs/neu": "^11.3.1"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Neutralinojs and contributors
|
||||
|
||||
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.
|
@ -1,15 +0,0 @@
|
||||
# neutralinojs-minimal
|
||||
|
||||
The default template for a Neutralinojs app. It's possible to use your favorite frontend framework by using [these steps](https://neutralino.js.org/docs/getting-started/using-frontend-libraries).
|
||||
|
||||
## Contributors
|
||||
|
||||
[](https://github.com/neutralinojs/neutralinojs-minimal/graphs/contributors)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
## Icon credits
|
||||
|
||||
- `trayIcon.png` - Made by [Freepik](https://www.freepik.com) and downloaded from [Flaticon](https://www.flaticon.com)
|
@ -1,28 +0,0 @@
|
||||
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
|
||||
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
|
||||
|
||||
That work is also covered by the Apache 2 License, following copyright:
|
||||
Copyright (c) 2013-2015 Brightcove
|
||||
|
||||
|
||||
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.
|
@ -1,92 +0,0 @@
|
||||
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION AND CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
@ -1,14 +0,0 @@
|
||||
# dash.js BSD License Agreement
|
||||
|
||||
The copyright in this software is being made available under the BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license.
|
||||
|
||||
**Copyright (c) 2015, Dash Industry Forum.
|
||||
**All rights reserved.**
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dash Industry Forum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**
|
||||
|
@ -1,83 +0,0 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/neutralinojs/neutralinojs/main/schemas/neutralino.config.schema.json",
|
||||
"applicationId": "com.anirudhsevugan.simpliplay-lite",
|
||||
"version": "1.0.0",
|
||||
"defaultMode": "window",
|
||||
"port": 0,
|
||||
"documentRoot": "/resources/",
|
||||
"url": "/",
|
||||
"enableServer": true,
|
||||
"enableNativeAPI": true,
|
||||
"tokenSecurity": "one-time",
|
||||
"logging": {
|
||||
"enabled": true,
|
||||
"writeToLogFile": true
|
||||
},
|
||||
"nativeAllowList": [
|
||||
"app.*",
|
||||
"os.*",
|
||||
"debug.log"
|
||||
],
|
||||
"globalVariables": {
|
||||
"TEST1": "Hello",
|
||||
"TEST2": [
|
||||
2,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"TEST3": {
|
||||
"value1": 10,
|
||||
"value2": {}
|
||||
}
|
||||
},
|
||||
"modes": {
|
||||
"window": {
|
||||
"title": "SimpliPlay Lite",
|
||||
"width": 800,
|
||||
"height": 500,
|
||||
"minWidth": 400,
|
||||
"minHeight": 200,
|
||||
"center": true,
|
||||
"fullScreen": false,
|
||||
"alwaysOnTop": false,
|
||||
"icon": "/resources/icons/icon.png",
|
||||
"enableInspector": true,
|
||||
"borderless": false,
|
||||
"maximize": false,
|
||||
"hidden": false,
|
||||
"resizable": true,
|
||||
"exitProcessOnClose": false
|
||||
},
|
||||
"browser": {
|
||||
"globalVariables": {
|
||||
"TEST": "Test value browser"
|
||||
},
|
||||
"nativeBlockList": [
|
||||
"filesystem.*"
|
||||
]
|
||||
},
|
||||
"cloud": {
|
||||
"url": "/resources/#cloud",
|
||||
"nativeAllowList": [
|
||||
"app.*"
|
||||
]
|
||||
},
|
||||
"chrome": {
|
||||
"width": 800,
|
||||
"height": 500,
|
||||
"args": "--user-agent=\"Neutralinojs chrome mode\"",
|
||||
"nativeBlockList": [
|
||||
"filesystem.*",
|
||||
"os.*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"binaryName": "simpliplay",
|
||||
"resourcesPath": "/resources/",
|
||||
"extensionsPath": "/extensions/",
|
||||
"clientLibrary": "/resources/js/neutralino.js",
|
||||
"binaryVersion": "5.6.0",
|
||||
"clientVersion": "5.6.0"
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
INFO 2025-02-02 04:28:35,259 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:30:07,305 Reloading the application... api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:30:25,477 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:31:23,167 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:33:00,403 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:33:20,146 Reloading the application... api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:33:20,204 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:33:20,207 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:33:20,752 NE_RS_UNBLDRE: Unable to load application resource file /resources/fonts/inter.ttf api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:33:25,555 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:33:26,610 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:33:26,611 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:33:26,676 NE_RS_UNBLDRE: Unable to load application resource file /resources/fonts/inter.ttf api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:39:49,855 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:39:50,877 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:39:50,878 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.js api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:39:50,937 NE_RS_UNBLDRE: Unable to load application resource file /resources/fonts/inter.ttf api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:40:59,335 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 04:42:21,305 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:47:03,173 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/dash.all.min.js.map api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
ERROR 2025-02-02 04:47:03,174 NE_RS_UNBLDRE: Unable to load application resource file /resources/lib/hls.min.js.map api/debug/debug.cpp:20 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 06:38:06,459 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 06:45:56,054 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 06:56:23,357 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 07:04:32,553 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
||||
INFO 2025-02-02 07:06:05,107 Auth info was exported to ./.tmp/auth_info.json api/debug/debug.cpp:17 sevuganfamily@unknown-host
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 29 KiB |
Binary file not shown.
Before Width: | Height: | Size: 232 KiB |
Binary file not shown.
Before Width: | Height: | Size: 965 B |
@ -1,508 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!--<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">-->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="lib/dash.js"></script>
|
||||
<script src="lib/hls.js"></script>
|
||||
<title>SimpliPlay Lite</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: "Inter";
|
||||
src: url("fonts/inter.ttf") format("truetype");
|
||||
}
|
||||
body {
|
||||
font-family: "Inter", Arial, sans-serif;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
background: linear-gradient(135deg, #0d5a9d, #0e7aff);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#saveSettingsBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog-overlay,
|
||||
.subtitles-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.dialog,
|
||||
.subtitles-dialog {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.dialog input[type="url"],
|
||||
.subtitles-dialog input[type="url"] {
|
||||
width: 80%;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.dialog button,
|
||||
.subtitles-dialog button {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog button:hover,
|
||||
.subtitles-dialog button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#customControls {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#customControls button,
|
||||
input[type="range"] {
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#customControls button {
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#customControls button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#showDialogBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
flex-grow: 1;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
video, iframe {
|
||||
display: flex;
|
||||
margin: 20px auto;
|
||||
background: black;
|
||||
width: 80vw;
|
||||
height: 80vh;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.gap-box {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#showDialogBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#settingsBtn {
|
||||
background: #1a73e8;
|
||||
font-size: 18px;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#settingsBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#settingsPanel {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: black;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
z-index: 10000;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>SimpliPlay</h1>
|
||||
<small>Lite Edition</small>
|
||||
<div class="dialog-overlay" id="dialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Select how you want to load media:</p>
|
||||
<button id="chooseFileBtn" style="display:none;">Choose a File</button>
|
||||
<button id="enterUrlBtn">Enter a URL</button>
|
||||
<button id="hideDialogBtn">Go back</button>
|
||||
<input type="file" id="fileInput" accept="video/*,audio/*" style="display: none;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-overlay" id="urlDialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Enter the media URL:</p>
|
||||
<input type="url" id="urlInput" placeholder="Enter URL here">
|
||||
<button id="submitUrlBtn">Submit</button>
|
||||
<button id="cancelUrlBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="subtitles-overlay" id="subtitlesOverlay">
|
||||
<div class="subtitles-dialog">
|
||||
<p>Enter subtitle URL:</p>
|
||||
<input type="url" id="subtitlesInput" placeholder="Enter subtitle URL here">
|
||||
<button id="submitSubtitlesBtn">Submit</button>
|
||||
<button id="cancelSubtitlesBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<video id="mediaPlayer" autoplay controls></video>
|
||||
|
||||
<div id="customControls">
|
||||
<button id="playPauseBtn">Pause</button>
|
||||
<input type="range" id="seekBar" min="0" value="0" step="0.1">
|
||||
<span id="timeDisplay">00:00 / 00:00</span>
|
||||
<button id="volumeBtn">🔊</button>
|
||||
<input type="range" id="volumeBar" min="0" max="1" step="0.1" value="1">
|
||||
<button id="fullscreenBtn">⛶</button>
|
||||
<button id="ccBtn">Add CC</button> <!-- CC button -->
|
||||
</div>
|
||||
|
||||
<div class="gap-box"></div>
|
||||
<button id="showDialogBtn">Play more media</button>
|
||||
|
||||
<!-- Settings gear button -->
|
||||
<button id="settingsBtn">⚙️</button>
|
||||
|
||||
<!-- Settings panel -->
|
||||
<div class="dialog-overlay" id="settingsDialogOverlay">
|
||||
<div id="settingsPanel">
|
||||
<label for="autoplayCheckbox">Autoplay:</label>
|
||||
<input type="checkbox" id="autoplayCheckbox" checked><br>
|
||||
<label for="loopCheckbox">Loop:</label>
|
||||
<input type="checkbox" id="loopCheckbox"><br>
|
||||
<button id="saveSettingsBtn">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const dialogOverlay = document.getElementById('dialogOverlay');
|
||||
const chooseFileBtn = document.getElementById('chooseFileBtn');
|
||||
const enterUrlBtn = document.getElementById('enterUrlBtn');
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const mediaPlayer = document.getElementById('mediaPlayer');
|
||||
const showDialogBtn = document.getElementById('showDialogBtn');
|
||||
const hideDialogBtn = document.getElementById('hideDialogBtn');
|
||||
const playPauseBtn = document.getElementById('playPauseBtn');
|
||||
const seekBar = document.getElementById('seekBar');
|
||||
const timeDisplay = document.getElementById('timeDisplay');
|
||||
const volumeBar = document.getElementById('volumeBar');
|
||||
const settingsBtn = document.getElementById('settingsBtn');
|
||||
const settingsPanel = document.getElementById('settingsPanel');
|
||||
const autoplayCheckbox = document.getElementById('autoplayCheckbox');
|
||||
const loopCheckbox = document.getElementById('loopCheckbox');
|
||||
const saveSettingsBtn = document.getElementById('saveSettingsBtn');
|
||||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||
const urlDialogOverlay = document.getElementById('urlDialogOverlay');
|
||||
const settingsDialogOverlay = document.getElementById('settingsDialogOverlay');
|
||||
const urlInput = document.getElementById('urlInput');
|
||||
const submitUrlBtn = document.getElementById('submitUrlBtn');
|
||||
const cancelUrlBtn = document.getElementById('cancelUrlBtn');
|
||||
const ccBtn = document.getElementById('ccBtn'); // CC button
|
||||
const subtitlesOverlay = document.getElementById('subtitlesOverlay');
|
||||
const subtitlesInput = document.getElementById('subtitlesInput');
|
||||
const submitSubtitlesBtn = document.getElementById('submitSubtitlesBtn');
|
||||
const cancelSubtitlesBtn = document.getElementById('cancelSubtitlesBtn');
|
||||
const customControls = document.getElementById('customControls');
|
||||
|
||||
// Handle submit subtitle URL
|
||||
submitSubtitlesBtn.addEventListener('click', () => {
|
||||
const subtitleUrl = subtitlesInput.value;
|
||||
if (subtitleUrl) {
|
||||
const track = document.createElement('track');
|
||||
track.kind = 'subtitles';
|
||||
track.label = 'English';
|
||||
track.srclang = 'en';
|
||||
track.src = subtitleUrl;
|
||||
mediaPlayer.appendChild(track);
|
||||
subtitlesOverlay.style.display = 'none';
|
||||
subtitlesInput.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Function to add subtitles dynamically (e.g., after URL input)
|
||||
function addSubtitles(url) {
|
||||
subtitleTrack.src = url;
|
||||
subtitleTrack.track.mode = 'showing'; // Enable subtitles by default
|
||||
subtitleBtn.textContent = 'Subtitles On'; // Set button text to indicate subtitles are on
|
||||
}
|
||||
|
||||
|
||||
let autoplayEnabled = true;
|
||||
let loopEnabled = false;
|
||||
|
||||
// Handle submit URL button in custom dialog
|
||||
submitUrlBtn.addEventListener('click', () => {
|
||||
let url = urlInput.value;
|
||||
|
||||
// Check if URL is a valid URL and doesn't contain "http" or "https"
|
||||
if (url && !url.startsWith('http') && !url.startsWith('https')) {
|
||||
// Assuming it's a URL and needs the protocol added
|
||||
url = 'http://' + url; // You can also choose 'https://' if preferred
|
||||
}
|
||||
|
||||
if (url) {
|
||||
if (url.includes('.m3u8')) {
|
||||
// HLS stream
|
||||
if (Hls.isSupported()) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
const hls = new Hls();
|
||||
mediaPlayer.pause();
|
||||
hls.loadSource(url);
|
||||
hls.attachMedia(mediaPlayer);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||||
mediaPlayer.play();
|
||||
urlInput.value = "";
|
||||
customControls.style.display = 'flex';
|
||||
});
|
||||
} else {
|
||||
alert('HLS not supported on your browser.');
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
}
|
||||
} else if (url.includes('.mpd')) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
const player = dashjs.MediaPlayer().create();
|
||||
// MPEG-DASH stream
|
||||
player.initialize(mediaPlayer, url, true);
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
} else {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
mediaPlayer.src = url;
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
mediaPlayer.play();
|
||||
}
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
dialogOverlay.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// Handle CC button to show subtitle modal
|
||||
ccBtn.addEventListener('click', () => {
|
||||
subtitlesOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Handle cancel subtitle modal
|
||||
cancelSubtitlesBtn.addEventListener('click', () => {
|
||||
subtitlesOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Show the dialog on page load
|
||||
window.onload = function () {
|
||||
dialogOverlay.style.display = 'block';
|
||||
};
|
||||
|
||||
// Handle "Choose a File" button
|
||||
chooseFileBtn.addEventListener('click', () => {
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
// Handle file input
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
const file = event.target.files[0];
|
||||
if (file) {
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
mediaPlayer.src = fileURL;
|
||||
dialogOverlay.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// Handle "Enter a URL" button
|
||||
enterUrlBtn.addEventListener('click', () => {
|
||||
urlDialogOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Handle cancel button in URL dialog
|
||||
cancelUrlBtn.addEventListener('click', () => {
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Handle custom play/pause button
|
||||
playPauseBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.paused) {
|
||||
mediaPlayer.play();
|
||||
playPauseBtn.textContent = 'Pause';
|
||||
} else {
|
||||
mediaPlayer.pause();
|
||||
playPauseBtn.textContent = 'Play';
|
||||
}
|
||||
});
|
||||
|
||||
// Volume button toggling mute/unmute
|
||||
volumeBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.muted) {
|
||||
mediaPlayer.muted = false;
|
||||
volumeBtn.textContent = '🔊'; // Unmute icon
|
||||
} else {
|
||||
mediaPlayer.muted = true;
|
||||
volumeBtn.textContent = '🔇'; // Mute icon
|
||||
}
|
||||
});
|
||||
|
||||
// Handle URL input on Enter key
|
||||
urlInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
submitUrlBtn.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle Subtitles input on Enter key
|
||||
subtitlesInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
submitSubtitlesBtn.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle URL submission
|
||||
|
||||
// YouTube ID extractor
|
||||
function getYouTubeID(url) {
|
||||
const match = url.match(/[?&]v=([a-zA-Z0-9_-]+)/);
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
|
||||
// Vimeo ID extractor
|
||||
function getVimeoID(url) {
|
||||
const match = url.match(/vimeo.com\/(\d+)/);
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
|
||||
// Update seek bar and time display
|
||||
mediaPlayer.addEventListener('timeupdate', () => {
|
||||
seekBar.max = mediaPlayer.duration || 0;
|
||||
seekBar.value = mediaPlayer.currentTime;
|
||||
const current = formatTime(mediaPlayer.currentTime);
|
||||
const total = formatTime(mediaPlayer.duration);
|
||||
timeDisplay.textContent = `${current} / ${total}`;
|
||||
});
|
||||
|
||||
// Seek media
|
||||
seekBar.addEventListener('input', () => {
|
||||
mediaPlayer.currentTime = seekBar.value;
|
||||
});
|
||||
|
||||
// Handle volume
|
||||
volumeBar.addEventListener('input', () => {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
});
|
||||
|
||||
// Show settings panel
|
||||
settingsBtn.addEventListener('click', () => {
|
||||
settingsDialogOverlay.style.display = 'block';
|
||||
settingsPanel.style.display = 'block';
|
||||
});
|
||||
|
||||
// Save settings
|
||||
saveSettingsBtn.addEventListener('click', () => {
|
||||
autoplayEnabled = autoplayCheckbox.checked;
|
||||
loopEnabled = loopCheckbox.checked;
|
||||
mediaPlayer.autoplay = autoplayEnabled;
|
||||
mediaPlayer.loop = loopEnabled;
|
||||
settingsPanel.style.display = 'none';
|
||||
settingsDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Format time
|
||||
function formatTime(time) {
|
||||
const minutes = Math.floor(time / 60) || 0;
|
||||
const seconds = Math.floor(time % 60) || 0;
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
// Show dialog
|
||||
showDialogBtn.addEventListener('click', () => {
|
||||
dialogOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Hide dialog
|
||||
hideDialogBtn.addEventListener('click', () => {
|
||||
dialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Fullscreen functionality
|
||||
fullscreenBtn.addEventListener('click', () => {
|
||||
if (!document.fullscreenElement) {
|
||||
mediaPlayer.requestFullscreen();
|
||||
} else {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,99 +0,0 @@
|
||||
// This is just a sample app. You can structure your Neutralinojs app code as you wish.
|
||||
// This example app is written with vanilla JavaScript and HTML.
|
||||
// Feel free to use any frontend framework you like :)
|
||||
// See more details: https://neutralino.js.org/docs/how-to/use-a-frontend-library
|
||||
|
||||
/*
|
||||
Function to display information about the Neutralino app.
|
||||
This function updates the content of the 'info' element in the HTML
|
||||
with details regarding the running Neutralino application, including
|
||||
its ID, port, operating system, and version information.
|
||||
*/
|
||||
function showInfo() {
|
||||
document.getElementById('info').innerHTML = `
|
||||
${NL_APPID} is running on port ${NL_PORT} inside ${NL_OS}
|
||||
<br/><br/>
|
||||
<span>server: v${NL_VERSION} . client: v${NL_CVERSION}</span>
|
||||
`;
|
||||
}
|
||||
|
||||
/*
|
||||
Function to open the official Neutralino documentation in the default web browser.
|
||||
*/
|
||||
function openDocs() {
|
||||
Neutralino.os.open("https://neutralino.js.org/docs");
|
||||
}
|
||||
|
||||
/*
|
||||
Function to open a tutorial video on Neutralino's official YouTube channel in the default web browser.
|
||||
*/
|
||||
function openTutorial() {
|
||||
Neutralino.os.open("https://www.youtube.com/c/CodeZri");
|
||||
}
|
||||
|
||||
/*
|
||||
Function to set up a system tray menu with options specific to the window mode.
|
||||
This function checks if the application is running in window mode, and if so,
|
||||
it defines the tray menu items and sets up the tray accordingly.
|
||||
*/
|
||||
function setTray() {
|
||||
// Tray menu is only available in window mode
|
||||
if(NL_MODE != "window") {
|
||||
console.log("INFO: Tray menu is only available in the window mode.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Define tray menu items
|
||||
let tray = {
|
||||
icon: "/resources/icons/trayIcon.png",
|
||||
menuItems: [
|
||||
{id: "VERSION", text: "Get version"},
|
||||
{id: "SEP", text: "-"},
|
||||
{id: "QUIT", text: "Quit"}
|
||||
]
|
||||
};
|
||||
|
||||
// Set the tray menu
|
||||
Neutralino.os.setTray(tray);
|
||||
}
|
||||
|
||||
/*
|
||||
Function to handle click events on the tray menu items.
|
||||
This function performs different actions based on the clicked item's ID,
|
||||
such as displaying version information or exiting the application.
|
||||
*/
|
||||
function onTrayMenuItemClicked(event) {
|
||||
switch(event.detail.id) {
|
||||
case "VERSION":
|
||||
// Display version information
|
||||
Neutralino.os.showMessageBox("Version information",
|
||||
`Neutralinojs server: v${NL_VERSION} | Neutralinojs client: v${NL_CVERSION}`);
|
||||
break;
|
||||
case "QUIT":
|
||||
// Exit the application
|
||||
Neutralino.app.exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Function to handle the window close event by gracefully exiting the Neutralino application.
|
||||
*/
|
||||
function onWindowClose() {
|
||||
Neutralino.app.exit();
|
||||
}
|
||||
|
||||
// Initialize Neutralino
|
||||
Neutralino.init();
|
||||
|
||||
// Register event listeners
|
||||
Neutralino.events.on("trayMenuItemClicked", onTrayMenuItemClicked);
|
||||
Neutralino.events.on("windowClose", onWindowClose);
|
||||
|
||||
// Conditional initialization: Set up system tray if not running on macOS
|
||||
if(NL_OS != "Darwin") { // TODO: Fix https://github.com/neutralinojs/neutralinojs/issues/615
|
||||
setTray();
|
||||
}
|
||||
|
||||
// Display app information
|
||||
showInfo();
|
@ -1,834 +0,0 @@
|
||||
// Type definitions for Neutralino 5.6.0
|
||||
// Project: https://github.com/neutralinojs
|
||||
// Definitions project: https://github.com/neutralinojs/neutralino.js
|
||||
|
||||
declare namespace Neutralino {
|
||||
|
||||
namespace filesystem {
|
||||
interface DirectoryEntry {
|
||||
entry: string;
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
interface FileReaderOptions {
|
||||
pos: number;
|
||||
size: number;
|
||||
}
|
||||
interface DirectoryReaderOptions {
|
||||
recursive: boolean;
|
||||
}
|
||||
interface OpenedFile {
|
||||
id: number;
|
||||
eof: boolean;
|
||||
pos: number;
|
||||
lastRead: number;
|
||||
}
|
||||
interface Stats {
|
||||
size: number;
|
||||
isFile: boolean;
|
||||
isDirectory: boolean;
|
||||
createdAt: number;
|
||||
modifiedAt: number;
|
||||
}
|
||||
interface Watcher {
|
||||
id: number;
|
||||
path: string;
|
||||
}
|
||||
interface CopyOptions {
|
||||
recursive: boolean;
|
||||
overwrite: boolean;
|
||||
skip: boolean;
|
||||
}
|
||||
interface PathParts {
|
||||
rootName: string;
|
||||
rootDirectory: string;
|
||||
rootPath: string;
|
||||
relativePath: string;
|
||||
parentPath: string;
|
||||
filename: string;
|
||||
stem: string;
|
||||
extension: string;
|
||||
}
|
||||
function createDirectory(path: string): Promise<void>;
|
||||
function remove(path: string): Promise<void>;
|
||||
function writeFile(path: string, data: string): Promise<void>;
|
||||
function appendFile(path: string, data: string): Promise<void>;
|
||||
function writeBinaryFile(path: string, data: ArrayBuffer): Promise<void>;
|
||||
function appendBinaryFile(path: string, data: ArrayBuffer): Promise<void>;
|
||||
function readFile(path: string, options?: FileReaderOptions): Promise<string>;
|
||||
function readBinaryFile(path: string, options?: FileReaderOptions): Promise<ArrayBuffer>;
|
||||
function openFile(path: string): Promise<number>;
|
||||
function createWatcher(path: string): Promise<number>;
|
||||
function removeWatcher(id: number): Promise<number>;
|
||||
function getWatchers(): Promise<Watcher[]>;
|
||||
function updateOpenedFile(id: number, event: string, data?: any): Promise<void>;
|
||||
function getOpenedFileInfo(id: number): Promise<OpenedFile>;
|
||||
function readDirectory(path: string, options?: DirectoryReaderOptions): Promise<DirectoryEntry[]>;
|
||||
function copy(source: string, destination: string, options?: CopyOptions): Promise<void>;
|
||||
function move(source: string, destination: string): Promise<void>;
|
||||
function getStats(path: string): Promise<Stats>;
|
||||
function getAbsolutePath(path: string): Promise<string>;
|
||||
function getRelativePath(path: string, base?: string): Promise<string>;
|
||||
function getPathParts(path: string): Promise<PathParts>;
|
||||
}
|
||||
namespace os {
|
||||
// debug
|
||||
enum LoggerType {
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
INFO = "INFO"
|
||||
}
|
||||
// os
|
||||
enum Icon {
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
INFO = "INFO",
|
||||
QUESTION = "QUESTION"
|
||||
}
|
||||
enum MessageBoxChoice {
|
||||
OK = "OK",
|
||||
OK_CANCEL = "OK_CANCEL",
|
||||
YES_NO = "YES_NO",
|
||||
YES_NO_CANCEL = "YES_NO_CANCEL",
|
||||
RETRY_CANCEL = "RETRY_CANCEL",
|
||||
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
|
||||
}
|
||||
//clipboard
|
||||
enum ClipboardFormat {
|
||||
unknown = "unknown",
|
||||
text = "text",
|
||||
image = "image"
|
||||
}
|
||||
// NL_GLOBALS
|
||||
enum Mode {
|
||||
window = "window",
|
||||
browser = "browser",
|
||||
cloud = "cloud",
|
||||
chrome = "chrome"
|
||||
}
|
||||
enum OperatingSystem {
|
||||
Linux = "Linux",
|
||||
Windows = "Windows",
|
||||
Darwin = "Darwin",
|
||||
FreeBSD = "FreeBSD",
|
||||
Unknown = "Unknown"
|
||||
}
|
||||
enum Architecture {
|
||||
x64 = "x64",
|
||||
arm = "arm",
|
||||
itanium = "itanium",
|
||||
ia32 = "ia32",
|
||||
unknown = "unknown"
|
||||
}
|
||||
interface ExecCommandOptions {
|
||||
stdIn?: string;
|
||||
background?: boolean;
|
||||
cwd?: string;
|
||||
}
|
||||
interface ExecCommandResult {
|
||||
pid: number;
|
||||
stdOut: string;
|
||||
stdErr: string;
|
||||
exitCode: number;
|
||||
}
|
||||
interface SpawnedProcess {
|
||||
id: number;
|
||||
pid: number;
|
||||
}
|
||||
interface Envs {
|
||||
[key: string]: string;
|
||||
}
|
||||
interface OpenDialogOptions {
|
||||
multiSelections?: boolean;
|
||||
filters?: Filter[];
|
||||
defaultPath?: string;
|
||||
}
|
||||
interface FolderDialogOptions {
|
||||
defaultPath?: string;
|
||||
}
|
||||
interface SaveDialogOptions {
|
||||
forceOverwrite?: boolean;
|
||||
filters?: Filter[];
|
||||
defaultPath?: string;
|
||||
}
|
||||
interface Filter {
|
||||
name: string;
|
||||
extensions: string[];
|
||||
}
|
||||
interface TrayOptions {
|
||||
icon: string;
|
||||
menuItems: TrayMenuItem[];
|
||||
}
|
||||
interface TrayMenuItem {
|
||||
id?: string;
|
||||
text: string;
|
||||
isDisabled?: boolean;
|
||||
isChecked?: boolean;
|
||||
}
|
||||
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2" | "temp";
|
||||
function execCommand(command: string, options?: ExecCommandOptions): Promise<ExecCommandResult>;
|
||||
function spawnProcess(command: string, cwd?: string): Promise<SpawnedProcess>;
|
||||
function updateSpawnedProcess(id: number, event: string, data?: any): Promise<void>;
|
||||
function getSpawnedProcesses(): Promise<SpawnedProcess[]>;
|
||||
function getEnv(key: string): Promise<string>;
|
||||
function getEnvs(): Promise<Envs>;
|
||||
function showOpenDialog(title?: string, options?: OpenDialogOptions): Promise<string[]>;
|
||||
function showFolderDialog(title?: string, options?: FolderDialogOptions): Promise<string>;
|
||||
function showSaveDialog(title?: string, options?: SaveDialogOptions): Promise<string>;
|
||||
function showNotification(title: string, content: string, icon?: Icon): Promise<void>;
|
||||
function showMessageBox(title: string, content: string, choice?: MessageBoxChoice, icon?: Icon): Promise<string>;
|
||||
function setTray(options: TrayOptions): Promise<void>;
|
||||
function open(url: string): Promise<void>;
|
||||
function getPath(name: KnownPath): Promise<string>;
|
||||
}
|
||||
namespace computer {
|
||||
interface MemoryInfo {
|
||||
physical: {
|
||||
total: number;
|
||||
available: number;
|
||||
};
|
||||
virtual: {
|
||||
total: number;
|
||||
available: number;
|
||||
};
|
||||
}
|
||||
interface KernelInfo {
|
||||
variant: string;
|
||||
version: string;
|
||||
}
|
||||
interface OSInfo {
|
||||
name: string;
|
||||
description: string;
|
||||
version: string;
|
||||
}
|
||||
interface CPUInfo {
|
||||
vendor: string;
|
||||
model: string;
|
||||
frequency: number;
|
||||
architecture: string;
|
||||
logicalThreads: number;
|
||||
physicalCores: number;
|
||||
physicalUnits: number;
|
||||
}
|
||||
interface Display {
|
||||
id: number;
|
||||
resolution: Resolution;
|
||||
dpi: number;
|
||||
bpp: number;
|
||||
refreshRate: number;
|
||||
}
|
||||
interface Resolution {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
interface MousePosition {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
function getMemoryInfo(): Promise<MemoryInfo>;
|
||||
function getArch(): Promise<string>;
|
||||
function getKernelInfo(): Promise<KernelInfo>;
|
||||
function getOSInfo(): Promise<OSInfo>;
|
||||
function getCPUInfo(): Promise<CPUInfo>;
|
||||
function getDisplays(): Promise<Display[]>;
|
||||
function getMousePosition(): Promise<MousePosition>;
|
||||
}
|
||||
namespace storage {
|
||||
function setData(key: string, data: string): Promise<void>;
|
||||
function getData(key: string): Promise<string>;
|
||||
function getKeys(): Promise<string[]>;
|
||||
}
|
||||
namespace debug {
|
||||
// debug
|
||||
enum LoggerType {
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
INFO = "INFO"
|
||||
}
|
||||
// os
|
||||
enum Icon {
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
INFO = "INFO",
|
||||
QUESTION = "QUESTION"
|
||||
}
|
||||
enum MessageBoxChoice {
|
||||
OK = "OK",
|
||||
OK_CANCEL = "OK_CANCEL",
|
||||
YES_NO = "YES_NO",
|
||||
YES_NO_CANCEL = "YES_NO_CANCEL",
|
||||
RETRY_CANCEL = "RETRY_CANCEL",
|
||||
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
|
||||
}
|
||||
//clipboard
|
||||
enum ClipboardFormat {
|
||||
unknown = "unknown",
|
||||
text = "text",
|
||||
image = "image"
|
||||
}
|
||||
// NL_GLOBALS
|
||||
enum Mode {
|
||||
window = "window",
|
||||
browser = "browser",
|
||||
cloud = "cloud",
|
||||
chrome = "chrome"
|
||||
}
|
||||
enum OperatingSystem {
|
||||
Linux = "Linux",
|
||||
Windows = "Windows",
|
||||
Darwin = "Darwin",
|
||||
FreeBSD = "FreeBSD",
|
||||
Unknown = "Unknown"
|
||||
}
|
||||
enum Architecture {
|
||||
x64 = "x64",
|
||||
arm = "arm",
|
||||
itanium = "itanium",
|
||||
ia32 = "ia32",
|
||||
unknown = "unknown"
|
||||
}
|
||||
function log(message: string, type?: LoggerType): Promise<void>;
|
||||
}
|
||||
namespace app {
|
||||
interface OpenActionOptions {
|
||||
url: string;
|
||||
}
|
||||
interface RestartOptions {
|
||||
args: string;
|
||||
}
|
||||
function exit(code?: number): Promise<void>;
|
||||
function killProcess(): Promise<void>;
|
||||
function restartProcess(options?: RestartOptions): Promise<void>;
|
||||
function getConfig(): Promise<any>;
|
||||
function broadcast(event: string, data?: any): Promise<void>;
|
||||
function readProcessInput(readAll?: boolean): Promise<string>;
|
||||
function writeProcessOutput(data: string): Promise<void>;
|
||||
function writeProcessError(data: string): Promise<void>;
|
||||
}
|
||||
namespace window {
|
||||
interface WindowOptions extends WindowSizeOptions, WindowPosOptions {
|
||||
title?: string;
|
||||
icon?: string;
|
||||
fullScreen?: boolean;
|
||||
alwaysOnTop?: boolean;
|
||||
enableInspector?: boolean;
|
||||
borderless?: boolean;
|
||||
maximize?: boolean;
|
||||
hidden?: boolean;
|
||||
maximizable?: boolean;
|
||||
useSavedState?: boolean;
|
||||
exitProcessOnClose?: boolean;
|
||||
extendUserAgentWith?: string;
|
||||
injectGlobals?: boolean;
|
||||
injectClientLibrary?: boolean;
|
||||
injectScript?: string;
|
||||
processArgs?: string;
|
||||
}
|
||||
interface WindowSizeOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
resizable?: boolean;
|
||||
}
|
||||
interface WindowPosOptions {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
function setTitle(title: string): Promise<void>;
|
||||
function getTitle(): Promise<string>;
|
||||
function maximize(): Promise<void>;
|
||||
function unmaximize(): Promise<void>;
|
||||
function isMaximized(): Promise<boolean>;
|
||||
function minimize(): Promise<void>;
|
||||
function unminimize(): Promise<void>;
|
||||
function isMinimized(): Promise<boolean>;
|
||||
function setFullScreen(): Promise<void>;
|
||||
function exitFullScreen(): Promise<void>;
|
||||
function isFullScreen(): Promise<boolean>;
|
||||
function show(): Promise<void>;
|
||||
function hide(): Promise<void>;
|
||||
function isVisible(): Promise<boolean>;
|
||||
function focus(): Promise<void>;
|
||||
function setIcon(icon: string): Promise<void>;
|
||||
function move(x: number, y: number): Promise<void>;
|
||||
function center(): Promise<void>;
|
||||
type DraggableRegionOptions = {
|
||||
/**
|
||||
* If set to `true`, the region will always capture the pointer,
|
||||
* ensuring dragging doesn't break on fast pointer movement.
|
||||
* Note that it prevents child elements from receiving any pointer events.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
alwaysCapture?: boolean;
|
||||
/**
|
||||
* Minimum distance between cursor's starting and current position
|
||||
* after which dragging is started. This helps prevent accidental dragging
|
||||
* while interacting with child elements.
|
||||
* Defaults to `10`. (In pixels.)
|
||||
*/
|
||||
dragMinDistance?: number;
|
||||
};
|
||||
function setDraggableRegion(domElementOrId: string | HTMLElement, options?: DraggableRegionOptions): Promise<{
|
||||
success: true;
|
||||
message: string;
|
||||
}>;
|
||||
function unsetDraggableRegion(domElementOrId: string | HTMLElement): Promise<{
|
||||
success: true;
|
||||
message: string;
|
||||
}>;
|
||||
function setSize(options: WindowSizeOptions): Promise<void>;
|
||||
function getSize(): Promise<WindowSizeOptions>;
|
||||
function getPosition(): Promise<WindowPosOptions>;
|
||||
function setAlwaysOnTop(onTop: boolean): Promise<void>;
|
||||
function create(url: string, options?: WindowOptions): Promise<void>;
|
||||
function snapshot(path: string): Promise<void>;
|
||||
}
|
||||
namespace events {
|
||||
interface Response {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp";
|
||||
function on(event: string, handler: (ev: CustomEvent) => void): Promise<Response>;
|
||||
function off(event: string, handler: (ev: CustomEvent) => void): Promise<Response>;
|
||||
function dispatch(event: string, data?: any): Promise<Response>;
|
||||
function broadcast(event: string, data?: any): Promise<void>;
|
||||
}
|
||||
namespace extensions {
|
||||
interface ExtensionStats {
|
||||
loaded: string[];
|
||||
connected: string[];
|
||||
}
|
||||
function dispatch(extensionId: string, event: string, data?: any): Promise<void>;
|
||||
function broadcast(event: string, data?: any): Promise<void>;
|
||||
function getStats(): Promise<ExtensionStats>;
|
||||
}
|
||||
namespace updater {
|
||||
interface Manifest {
|
||||
applicationId: string;
|
||||
version: string;
|
||||
resourcesURL: string;
|
||||
}
|
||||
function checkForUpdates(url: string): Promise<Manifest>;
|
||||
function install(): Promise<void>;
|
||||
}
|
||||
namespace clipboard {
|
||||
interface ClipboardImage {
|
||||
width: number;
|
||||
height: number;
|
||||
bpp: number;
|
||||
bpr: number;
|
||||
redMask: number;
|
||||
greenMask: number;
|
||||
blueMask: number;
|
||||
redShift: number;
|
||||
greenShift: number;
|
||||
blueShift: number;
|
||||
data: ArrayBuffer;
|
||||
}
|
||||
// debug
|
||||
enum LoggerType {
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
INFO = "INFO"
|
||||
}
|
||||
// os
|
||||
enum Icon {
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
INFO = "INFO",
|
||||
QUESTION = "QUESTION"
|
||||
}
|
||||
enum MessageBoxChoice {
|
||||
OK = "OK",
|
||||
OK_CANCEL = "OK_CANCEL",
|
||||
YES_NO = "YES_NO",
|
||||
YES_NO_CANCEL = "YES_NO_CANCEL",
|
||||
RETRY_CANCEL = "RETRY_CANCEL",
|
||||
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
|
||||
}
|
||||
//clipboard
|
||||
enum ClipboardFormat {
|
||||
unknown = "unknown",
|
||||
text = "text",
|
||||
image = "image"
|
||||
}
|
||||
// NL_GLOBALS
|
||||
enum Mode {
|
||||
window = "window",
|
||||
browser = "browser",
|
||||
cloud = "cloud",
|
||||
chrome = "chrome"
|
||||
}
|
||||
enum OperatingSystem {
|
||||
Linux = "Linux",
|
||||
Windows = "Windows",
|
||||
Darwin = "Darwin",
|
||||
FreeBSD = "FreeBSD",
|
||||
Unknown = "Unknown"
|
||||
}
|
||||
enum Architecture {
|
||||
x64 = "x64",
|
||||
arm = "arm",
|
||||
itanium = "itanium",
|
||||
ia32 = "ia32",
|
||||
unknown = "unknown"
|
||||
}
|
||||
function getFormat(): Promise<ClipboardFormat>;
|
||||
function readText(): Promise<string>;
|
||||
function readImage(format?: string): Promise<ClipboardImage | null>;
|
||||
function writeText(data: string): Promise<void>;
|
||||
function writeImage(image: ClipboardImage): Promise<void>;
|
||||
function clear(): Promise<void>;
|
||||
}
|
||||
namespace resources {
|
||||
interface Stats {
|
||||
size: number;
|
||||
isFile: boolean;
|
||||
isDirectory: boolean;
|
||||
}
|
||||
function getFiles(): Promise<string[]>;
|
||||
function getStats(path: string): Promise<Stats>;
|
||||
function extractFile(path: string, destination: string): Promise<void>;
|
||||
function extractDirectory(path: string, destination: string): Promise<void>;
|
||||
function readFile(path: string): Promise<string>;
|
||||
function readBinaryFile(path: string): Promise<ArrayBuffer>;
|
||||
}
|
||||
namespace server {
|
||||
function mount(path: string, target: string): Promise<void>;
|
||||
function unmount(path: string): Promise<void>;
|
||||
function getMounts(): Promise<void>;
|
||||
}
|
||||
namespace custom {
|
||||
function getMethods(): Promise<string[]>;
|
||||
}
|
||||
interface InitOptions {
|
||||
exportCustomMethods?: boolean;
|
||||
}
|
||||
function init(options?: InitOptions): void;
|
||||
type ErrorCode = "NE_FS_DIRCRER" | "NE_FS_RMDIRER" | "NE_FS_FILRDER" | "NE_FS_FILWRER" | "NE_FS_FILRMER" | "NE_FS_NOPATHE" | "NE_FS_COPYFER" | "NE_FS_MOVEFER" | "NE_OS_INVMSGA" | "NE_OS_INVKNPT" | "NE_ST_INVSTKY" | "NE_ST_STKEYWE" | "NE_RT_INVTOKN" | "NE_RT_NATPRME" | "NE_RT_APIPRME" | "NE_RT_NATRTER" | "NE_RT_NATNTIM" | "NE_CL_NSEROFF" | "NE_EX_EXTNOTC" | "NE_UP_CUPDMER" | "NE_UP_CUPDERR" | "NE_UP_UPDNOUF" | "NE_UP_UPDINER";
|
||||
interface Error {
|
||||
code: ErrorCode;
|
||||
message: string;
|
||||
}
|
||||
interface OpenActionOptions {
|
||||
url: string;
|
||||
}
|
||||
interface RestartOptions {
|
||||
args: string;
|
||||
}
|
||||
interface MemoryInfo {
|
||||
physical: {
|
||||
total: number;
|
||||
available: number;
|
||||
};
|
||||
virtual: {
|
||||
total: number;
|
||||
available: number;
|
||||
};
|
||||
}
|
||||
interface KernelInfo {
|
||||
variant: string;
|
||||
version: string;
|
||||
}
|
||||
interface OSInfo {
|
||||
name: string;
|
||||
description: string;
|
||||
version: string;
|
||||
}
|
||||
interface CPUInfo {
|
||||
vendor: string;
|
||||
model: string;
|
||||
frequency: number;
|
||||
architecture: string;
|
||||
logicalThreads: number;
|
||||
physicalCores: number;
|
||||
physicalUnits: number;
|
||||
}
|
||||
interface Display {
|
||||
id: number;
|
||||
resolution: Resolution;
|
||||
dpi: number;
|
||||
bpp: number;
|
||||
refreshRate: number;
|
||||
}
|
||||
interface Resolution {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
interface MousePosition {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
interface ClipboardImage {
|
||||
width: number;
|
||||
height: number;
|
||||
bpp: number;
|
||||
bpr: number;
|
||||
redMask: number;
|
||||
greenMask: number;
|
||||
blueMask: number;
|
||||
redShift: number;
|
||||
greenShift: number;
|
||||
blueShift: number;
|
||||
data: ArrayBuffer;
|
||||
}
|
||||
interface ExtensionStats {
|
||||
loaded: string[];
|
||||
connected: string[];
|
||||
}
|
||||
interface DirectoryEntry {
|
||||
entry: string;
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
interface FileReaderOptions {
|
||||
pos: number;
|
||||
size: number;
|
||||
}
|
||||
interface DirectoryReaderOptions {
|
||||
recursive: boolean;
|
||||
}
|
||||
interface OpenedFile {
|
||||
id: number;
|
||||
eof: boolean;
|
||||
pos: number;
|
||||
lastRead: number;
|
||||
}
|
||||
interface Stats {
|
||||
size: number;
|
||||
isFile: boolean;
|
||||
isDirectory: boolean;
|
||||
createdAt: number;
|
||||
modifiedAt: number;
|
||||
}
|
||||
interface Watcher {
|
||||
id: number;
|
||||
path: string;
|
||||
}
|
||||
interface CopyOptions {
|
||||
recursive: boolean;
|
||||
overwrite: boolean;
|
||||
skip: boolean;
|
||||
}
|
||||
interface PathParts {
|
||||
rootName: string;
|
||||
rootDirectory: string;
|
||||
rootPath: string;
|
||||
relativePath: string;
|
||||
parentPath: string;
|
||||
filename: string;
|
||||
stem: string;
|
||||
extension: string;
|
||||
}
|
||||
interface ExecCommandOptions {
|
||||
stdIn?: string;
|
||||
background?: boolean;
|
||||
cwd?: string;
|
||||
}
|
||||
interface ExecCommandResult {
|
||||
pid: number;
|
||||
stdOut: string;
|
||||
stdErr: string;
|
||||
exitCode: number;
|
||||
}
|
||||
interface SpawnedProcess {
|
||||
id: number;
|
||||
pid: number;
|
||||
}
|
||||
interface Envs {
|
||||
[key: string]: string;
|
||||
}
|
||||
interface OpenDialogOptions {
|
||||
multiSelections?: boolean;
|
||||
filters?: Filter[];
|
||||
defaultPath?: string;
|
||||
}
|
||||
interface FolderDialogOptions {
|
||||
defaultPath?: string;
|
||||
}
|
||||
interface SaveDialogOptions {
|
||||
forceOverwrite?: boolean;
|
||||
filters?: Filter[];
|
||||
defaultPath?: string;
|
||||
}
|
||||
interface Filter {
|
||||
name: string;
|
||||
extensions: string[];
|
||||
}
|
||||
interface TrayOptions {
|
||||
icon: string;
|
||||
menuItems: TrayMenuItem[];
|
||||
}
|
||||
interface TrayMenuItem {
|
||||
id?: string;
|
||||
text: string;
|
||||
isDisabled?: boolean;
|
||||
isChecked?: boolean;
|
||||
}
|
||||
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2" | "temp";
|
||||
interface Manifest {
|
||||
applicationId: string;
|
||||
version: string;
|
||||
resourcesURL: string;
|
||||
}
|
||||
interface WindowOptions extends WindowSizeOptions, WindowPosOptions {
|
||||
title?: string;
|
||||
icon?: string;
|
||||
fullScreen?: boolean;
|
||||
alwaysOnTop?: boolean;
|
||||
enableInspector?: boolean;
|
||||
borderless?: boolean;
|
||||
maximize?: boolean;
|
||||
hidden?: boolean;
|
||||
maximizable?: boolean;
|
||||
useSavedState?: boolean;
|
||||
exitProcessOnClose?: boolean;
|
||||
extendUserAgentWith?: string;
|
||||
injectGlobals?: boolean;
|
||||
injectClientLibrary?: boolean;
|
||||
injectScript?: string;
|
||||
processArgs?: string;
|
||||
}
|
||||
interface WindowSizeOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
resizable?: boolean;
|
||||
}
|
||||
interface WindowPosOptions {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
interface Response {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp";
|
||||
|
||||
}
|
||||
|
||||
// debug
|
||||
enum LoggerType {
|
||||
WARNING = 'WARNING',
|
||||
ERROR = 'ERROR',
|
||||
INFO = 'INFO'
|
||||
}
|
||||
|
||||
// os
|
||||
enum Icon {
|
||||
WARNING = 'WARNING',
|
||||
ERROR = 'ERROR',
|
||||
INFO = 'INFO',
|
||||
QUESTION = 'QUESTION'
|
||||
}
|
||||
|
||||
enum MessageBoxChoice {
|
||||
OK = 'OK',
|
||||
OK_CANCEL = 'OK_CANCEL',
|
||||
YES_NO = 'YES_NO',
|
||||
YES_NO_CANCEL = 'YES_NO_CANCEL',
|
||||
RETRY_CANCEL = 'RETRY_CANCEL',
|
||||
ABORT_RETRY_IGNORE = 'ABORT_RETRY_IGNORE'
|
||||
}
|
||||
|
||||
//clipboard
|
||||
enum ClipboardFormat {
|
||||
unknown = 'unknown',
|
||||
text = 'text',
|
||||
image = 'image'
|
||||
}
|
||||
|
||||
// NL_GLOBALS
|
||||
enum Mode {
|
||||
window = 'window',
|
||||
browser = 'browser',
|
||||
cloud = 'cloud',
|
||||
chrome = 'chrome'
|
||||
}
|
||||
|
||||
enum OperatingSystem {
|
||||
Linux = 'Linux',
|
||||
Windows = 'Windows',
|
||||
Darwin = 'Darwin',
|
||||
FreeBSD = 'FreeBSD',
|
||||
Unknown = 'Unknown'
|
||||
}
|
||||
|
||||
enum Architecture {
|
||||
x64 = 'x64',
|
||||
arm = 'arm',
|
||||
itanium = 'itanium',
|
||||
ia32 = 'ia32',
|
||||
unknown = 'unknown'
|
||||
}
|
||||
|
||||
|
||||
interface Response {
|
||||
success: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
'ready' |
|
||||
'trayMenuItemClicked' |
|
||||
'windowClose' |
|
||||
'serverOffline' |
|
||||
'clientConnect' |
|
||||
'clientDisconnect' |
|
||||
'appClientConnect' |
|
||||
'appClientDisconnect' |
|
||||
'extClientConnect' |
|
||||
'extClientDisconnect' |
|
||||
'extensionReady' |
|
||||
'neuDev_reloadApp'
|
||||
|
||||
|
||||
// --- globals ---
|
||||
/** Mode of the application: window, browser, cloud, or chrome */
|
||||
declare const NL_MODE: Mode;
|
||||
/** Application port */
|
||||
declare const NL_PORT: number;
|
||||
/** Command-line arguments */
|
||||
declare const NL_ARGS: string[];
|
||||
/** Basic authentication token */
|
||||
declare const NL_TOKEN: string;
|
||||
/** Neutralinojs client version */
|
||||
declare const NL_CVERSION: string;
|
||||
/** Application identifier */
|
||||
declare const NL_APPID: string;
|
||||
/** Application version */
|
||||
declare const NL_APPVERSION: string;
|
||||
/** Application path */
|
||||
declare const NL_PATH: string;
|
||||
/** Application data path */
|
||||
declare const NL_DATAPATH: string;
|
||||
/** Returns true if extensions are enabled */
|
||||
declare const NL_EXTENABLED: boolean;
|
||||
/** Returns true if the client library is injected */
|
||||
declare const NL_GINJECTED: boolean;
|
||||
/** Returns true if globals are injected */
|
||||
declare const NL_CINJECTED: boolean;
|
||||
/** Operating system name: Linux, Windows, Darwin, FreeBSD, or Uknown */
|
||||
declare const NL_OS: OperatingSystem;
|
||||
/** CPU architecture: x64, arm, itanium, ia32, or unknown */
|
||||
declare const NL_ARCH: Architecture;
|
||||
/** Neutralinojs server version */
|
||||
declare const NL_VERSION: string;
|
||||
/** Current working directory */
|
||||
declare const NL_CWD: string;
|
||||
/** Identifier of the current process */
|
||||
declare const NL_PID: string;
|
||||
/** Source of application resources: bundle or directory */
|
||||
declare const NL_RESMODE: string;
|
||||
/** Release commit of the client library */
|
||||
declare const NL_CCOMMIT: string;
|
||||
/** An array of custom methods */
|
||||
declare const NL_CMETHODS: string[];
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,507 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!--<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">-->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="lib/dash.js"></script>
|
||||
<script src="lib/hls.js"></script>
|
||||
<title>SimpliPlay</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: "Inter";
|
||||
src: url("fonts/inter.ttf") format("truetype");
|
||||
}
|
||||
body {
|
||||
font-family: "Inter", Arial, sans-serif;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
background: linear-gradient(135deg, #083358, #1a73e8);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#saveSettingsBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog-overlay,
|
||||
.subtitles-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.dialog,
|
||||
.subtitles-dialog {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.dialog input[type="url"],
|
||||
.subtitles-dialog input[type="url"] {
|
||||
width: 80%;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.dialog button,
|
||||
.subtitles-dialog button {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog button:hover,
|
||||
.subtitles-dialog button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#customControls {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#customControls button,
|
||||
input[type="range"] {
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#customControls button {
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#customControls button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#showDialogBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
flex-grow: 1;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
video, iframe {
|
||||
display: flex;
|
||||
margin: 20px auto;
|
||||
background: black;
|
||||
width: 80vw;
|
||||
height: 80vh;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.gap-box {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#showDialogBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#settingsBtn {
|
||||
background: #1a73e8;
|
||||
font-size: 18px;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#settingsBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#settingsPanel {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: black;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
z-index: 10000;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>SimpliPlay</h1>
|
||||
<div class="dialog-overlay" id="dialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Select how you want to load media:</p>
|
||||
<button id="chooseFileBtn">Choose a File</button>
|
||||
<button id="enterUrlBtn">Enter a URL</button>
|
||||
<button id="hideDialogBtn">Go back</button>
|
||||
<input type="file" id="fileInput" accept="video/*,audio/*" style="display: none;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-overlay" id="urlDialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Enter the media URL:</p>
|
||||
<input type="url" id="urlInput" placeholder="Enter URL here">
|
||||
<button id="submitUrlBtn">Submit</button>
|
||||
<button id="cancelUrlBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="subtitles-overlay" id="subtitlesOverlay">
|
||||
<div class="subtitles-dialog">
|
||||
<p>Enter subtitle URL:</p>
|
||||
<input type="url" id="subtitlesInput" placeholder="Enter subtitle URL here">
|
||||
<button id="submitSubtitlesBtn">Submit</button>
|
||||
<button id="cancelSubtitlesBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<video id="mediaPlayer" autoplay controls></video>
|
||||
|
||||
<div id="customControls">
|
||||
<button id="playPauseBtn">Pause</button>
|
||||
<input type="range" id="seekBar" min="0" value="0" step="0.1">
|
||||
<span id="timeDisplay">00:00 / 00:00</span>
|
||||
<button id="volumeBtn">🔊</button>
|
||||
<input type="range" id="volumeBar" min="0" max="1" step="0.1" value="1">
|
||||
<button id="fullscreenBtn">⛶</button>
|
||||
<button id="ccBtn">Add CC</button> <!-- CC button -->
|
||||
</div>
|
||||
|
||||
<div class="gap-box"></div>
|
||||
<button id="showDialogBtn">Play more media</button>
|
||||
|
||||
<!-- Settings gear button -->
|
||||
<button id="settingsBtn">⚙️</button>
|
||||
|
||||
<!-- Settings panel -->
|
||||
<div class="dialog-overlay" id="settingsDialogOverlay">
|
||||
<div id="settingsPanel">
|
||||
<label for="autoplayCheckbox">Autoplay:</label>
|
||||
<input type="checkbox" id="autoplayCheckbox" checked><br>
|
||||
<label for="loopCheckbox">Loop:</label>
|
||||
<input type="checkbox" id="loopCheckbox"><br>
|
||||
<button id="saveSettingsBtn">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const dialogOverlay = document.getElementById('dialogOverlay');
|
||||
const chooseFileBtn = document.getElementById('chooseFileBtn');
|
||||
const enterUrlBtn = document.getElementById('enterUrlBtn');
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const mediaPlayer = document.getElementById('mediaPlayer');
|
||||
const showDialogBtn = document.getElementById('showDialogBtn');
|
||||
const hideDialogBtn = document.getElementById('hideDialogBtn');
|
||||
const playPauseBtn = document.getElementById('playPauseBtn');
|
||||
const seekBar = document.getElementById('seekBar');
|
||||
const timeDisplay = document.getElementById('timeDisplay');
|
||||
const volumeBar = document.getElementById('volumeBar');
|
||||
const settingsBtn = document.getElementById('settingsBtn');
|
||||
const settingsPanel = document.getElementById('settingsPanel');
|
||||
const autoplayCheckbox = document.getElementById('autoplayCheckbox');
|
||||
const loopCheckbox = document.getElementById('loopCheckbox');
|
||||
const saveSettingsBtn = document.getElementById('saveSettingsBtn');
|
||||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||
const urlDialogOverlay = document.getElementById('urlDialogOverlay');
|
||||
const settingsDialogOverlay = document.getElementById('settingsDialogOverlay');
|
||||
const urlInput = document.getElementById('urlInput');
|
||||
const submitUrlBtn = document.getElementById('submitUrlBtn');
|
||||
const cancelUrlBtn = document.getElementById('cancelUrlBtn');
|
||||
const ccBtn = document.getElementById('ccBtn'); // CC button
|
||||
const subtitlesOverlay = document.getElementById('subtitlesOverlay');
|
||||
const subtitlesInput = document.getElementById('subtitlesInput');
|
||||
const submitSubtitlesBtn = document.getElementById('submitSubtitlesBtn');
|
||||
const cancelSubtitlesBtn = document.getElementById('cancelSubtitlesBtn');
|
||||
const customControls = document.getElementById('customControls');
|
||||
|
||||
// Handle submit subtitle URL
|
||||
submitSubtitlesBtn.addEventListener('click', () => {
|
||||
const subtitleUrl = subtitlesInput.value;
|
||||
if (subtitleUrl) {
|
||||
const track = document.createElement('track');
|
||||
track.kind = 'subtitles';
|
||||
track.label = 'English';
|
||||
track.srclang = 'en';
|
||||
track.src = subtitleUrl;
|
||||
mediaPlayer.appendChild(track);
|
||||
subtitlesOverlay.style.display = 'none';
|
||||
subtitlesInput.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Function to add subtitles dynamically (e.g., after URL input)
|
||||
function addSubtitles(url) {
|
||||
subtitleTrack.src = url;
|
||||
subtitleTrack.track.mode = 'showing'; // Enable subtitles by default
|
||||
subtitleBtn.textContent = 'Subtitles On'; // Set button text to indicate subtitles are on
|
||||
}
|
||||
|
||||
|
||||
let autoplayEnabled = true;
|
||||
let loopEnabled = false;
|
||||
|
||||
// Handle submit URL button in custom dialog
|
||||
submitUrlBtn.addEventListener('click', () => {
|
||||
let url = urlInput.value;
|
||||
|
||||
// Check if URL is a valid URL and doesn't contain "http" or "https"
|
||||
if (url && !url.startsWith('http') && !url.startsWith('https')) {
|
||||
// Assuming it's a URL and needs the protocol added
|
||||
url = 'http://' + url; // You can also choose 'https://' if preferred
|
||||
}
|
||||
|
||||
if (url) {
|
||||
if (url.includes('.m3u8')) {
|
||||
// HLS stream
|
||||
if (Hls.isSupported()) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
const hls = new Hls();
|
||||
mediaPlayer.pause();
|
||||
hls.loadSource(url);
|
||||
hls.attachMedia(mediaPlayer);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||||
mediaPlayer.play();
|
||||
urlInput.value = "";
|
||||
customControls.style.display = 'flex';
|
||||
});
|
||||
} else {
|
||||
alert('HLS not supported on your browser.');
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
}
|
||||
} else if (url.includes('.mpd')) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
const player = dashjs.MediaPlayer().create();
|
||||
// MPEG-DASH stream
|
||||
player.initialize(mediaPlayer, url, true);
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
} else {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
mediaPlayer.src = url;
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
mediaPlayer.play();
|
||||
}
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
dialogOverlay.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// Handle CC button to show subtitle modal
|
||||
ccBtn.addEventListener('click', () => {
|
||||
subtitlesOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Handle cancel subtitle modal
|
||||
cancelSubtitlesBtn.addEventListener('click', () => {
|
||||
subtitlesOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Show the dialog on page load
|
||||
window.onload = function () {
|
||||
dialogOverlay.style.display = 'block';
|
||||
};
|
||||
|
||||
// Handle "Choose a File" button
|
||||
chooseFileBtn.addEventListener('click', () => {
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
// Handle file input
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
const file = event.target.files[0];
|
||||
if (file) {
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
mediaPlayer.src = fileURL;
|
||||
dialogOverlay.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// Handle "Enter a URL" button
|
||||
enterUrlBtn.addEventListener('click', () => {
|
||||
urlDialogOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Handle cancel button in URL dialog
|
||||
cancelUrlBtn.addEventListener('click', () => {
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Handle custom play/pause button
|
||||
playPauseBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.paused) {
|
||||
mediaPlayer.play();
|
||||
playPauseBtn.textContent = 'Pause';
|
||||
} else {
|
||||
mediaPlayer.pause();
|
||||
playPauseBtn.textContent = 'Play';
|
||||
}
|
||||
});
|
||||
|
||||
// Volume button toggling mute/unmute
|
||||
volumeBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.muted) {
|
||||
mediaPlayer.muted = false;
|
||||
volumeBtn.textContent = '🔊'; // Unmute icon
|
||||
} else {
|
||||
mediaPlayer.muted = true;
|
||||
volumeBtn.textContent = '🔇'; // Mute icon
|
||||
}
|
||||
});
|
||||
|
||||
// Handle URL input on Enter key
|
||||
urlInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
submitUrlBtn.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle Subtitles input on Enter key
|
||||
subtitlesInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
submitSubtitlesBtn.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle URL submission
|
||||
|
||||
// YouTube ID extractor
|
||||
function getYouTubeID(url) {
|
||||
const match = url.match(/[?&]v=([a-zA-Z0-9_-]+)/);
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
|
||||
// Vimeo ID extractor
|
||||
function getVimeoID(url) {
|
||||
const match = url.match(/vimeo.com\/(\d+)/);
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
|
||||
// Update seek bar and time display
|
||||
mediaPlayer.addEventListener('timeupdate', () => {
|
||||
seekBar.max = mediaPlayer.duration || 0;
|
||||
seekBar.value = mediaPlayer.currentTime;
|
||||
const current = formatTime(mediaPlayer.currentTime);
|
||||
const total = formatTime(mediaPlayer.duration);
|
||||
timeDisplay.textContent = `${current} / ${total}`;
|
||||
});
|
||||
|
||||
// Seek media
|
||||
seekBar.addEventListener('input', () => {
|
||||
mediaPlayer.currentTime = seekBar.value;
|
||||
});
|
||||
|
||||
// Handle volume
|
||||
volumeBar.addEventListener('input', () => {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
});
|
||||
|
||||
// Show settings panel
|
||||
settingsBtn.addEventListener('click', () => {
|
||||
settingsDialogOverlay.style.display = 'block';
|
||||
settingsPanel.style.display = 'block';
|
||||
});
|
||||
|
||||
// Save settings
|
||||
saveSettingsBtn.addEventListener('click', () => {
|
||||
autoplayEnabled = autoplayCheckbox.checked;
|
||||
loopEnabled = loopCheckbox.checked;
|
||||
mediaPlayer.autoplay = autoplayEnabled;
|
||||
mediaPlayer.loop = loopEnabled;
|
||||
settingsPanel.style.display = 'none';
|
||||
settingsDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Format time
|
||||
function formatTime(time) {
|
||||
const minutes = Math.floor(time / 60) || 0;
|
||||
const seconds = Math.floor(time % 60) || 0;
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
// Show dialog
|
||||
showDialogBtn.addEventListener('click', () => {
|
||||
dialogOverlay.style.display = 'block';
|
||||
});
|
||||
|
||||
// Hide dialog
|
||||
hideDialogBtn.addEventListener('click', () => {
|
||||
dialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
// Fullscreen functionality
|
||||
fullscreenBtn.addEventListener('click', () => {
|
||||
if (!document.fullscreenElement) {
|
||||
mediaPlayer.requestFullscreen();
|
||||
} else {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,20 +0,0 @@
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#neutralinoapp {
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#neutralinoapp h1{
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
#neutralinoapp > div {
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Credits</title>
|
||||
</head>
|
||||
<body>
|
||||
This is sample credits page.
|
||||
|
||||
To get correct credits page, set `generate_about_credits=true` in args.gn.
|
||||
|
||||
<!-- credits.js tries to access $('print-link').hidden and .onclick -->
|
||||
<a id="print-link" href="#" hidden>Print</a>
|
||||
|
||||
<!-- browser_tests checks "webkit" in this page -->
|
||||
Layout tests are based on layout tests from webkit.org.
|
||||
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
# fonts
|
||||
folder for custom fonts
|
@ -1,87 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<script src="player.js"></script>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Content-Security-Policy" content="
|
||||
default-src 'self';
|
||||
script-src 'self';
|
||||
style-src 'self';
|
||||
img-src 'self' data:;
|
||||
media-src * blob: file:;
|
||||
connect-src *;
|
||||
font-src 'self';
|
||||
object-src 'none';
|
||||
child-src 'none';
|
||||
form-action 'self';
|
||||
">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script src="lib/dash.js"></script>
|
||||
<script src="lib/hls.js"></script>
|
||||
<title>SimpliPlay</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>SimpliPlay</h1>
|
||||
<div class="dialog-overlay" id="dialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Select how you want to load media:</p>
|
||||
<button id="chooseFileBtn">Choose a File</button>
|
||||
<button id="enterUrlBtn">Enter a URL</button>
|
||||
<button id="hideDialogBtn">Go back</button>
|
||||
<input type="file" id="fileInput" accept="video/*,audio/*">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-overlay" id="urlDialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Enter media URL:</p>
|
||||
<input type="url" id="urlInput" placeholder="Enter media URL here">
|
||||
<button id="submitUrlBtn">Submit</button>
|
||||
<button id="cancelUrlBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="subtitles-overlay" id="subtitlesOverlay">
|
||||
<div class="subtitles-dialog">
|
||||
<p>Enter subtitles URL:</p>
|
||||
<input type="url" id="subtitlesInput" placeholder="Enter subtitles URL here">
|
||||
<button id="submitSubtitlesBtn">Submit</button>
|
||||
<button id="cancelSubtitlesBtn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<video id="mediaPlayer" autoplay controls></video>
|
||||
|
||||
<div id="customControls">
|
||||
<button id="playPauseBtn">Pause</button>
|
||||
<input type="range" id="seekBar" min="0" value="0" step="0.1">
|
||||
<span id="timeDisplay">00:00 / 00:00</span>
|
||||
<button id="volumeBtn">🔊</button>
|
||||
<input type="range" id="volumeBar" min="0" max="1" step="0.1" value="1">
|
||||
<button id="fullscreenBtn">⛶</button>
|
||||
<button id="ccBtn">Add Subtitles</button> <!-- CC button -->
|
||||
</div>
|
||||
|
||||
<div class="gap-box"></div>
|
||||
<button id="showDialogBtn">Play more media</button>
|
||||
|
||||
<!-- Settings gear button -->
|
||||
<button id="settingsBtn">⚙️</button>
|
||||
|
||||
<!-- Settings panel -->
|
||||
<div class="dialog-overlay" id="settingsDialogOverlay">
|
||||
<div id="settingsPanel">
|
||||
<label for="autoplayCheckbox">Autoplay:</label>
|
||||
<input type="checkbox" id="autoplayCheckbox" checked><br>
|
||||
<label for="loopCheckbox">Loop:</label>
|
||||
<input type="checkbox" id="loopCheckbox"><br>
|
||||
<button id="saveSettingsBtn">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,14 +0,0 @@
|
||||
# dash.js BSD License Agreement
|
||||
|
||||
The copyright in this software is being made available under the BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license.
|
||||
|
||||
**Copyright (c) 2015, Dash Industry Forum.
|
||||
**All rights reserved.**
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dash Industry Forum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,28 +0,0 @@
|
||||
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
|
||||
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
|
||||
|
||||
That work is also covered by the Apache 2 License, following copyright:
|
||||
Copyright (c) 2013-2015 Brightcove
|
||||
|
||||
|
||||
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.
|
File diff suppressed because one or more lines are too long
2656
simpliplay-nwjs/package-lock.json
generated
2656
simpliplay-nwjs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "SimpliPlay",
|
||||
"main": "index.html"
|
||||
}
|
||||
|
@ -1,190 +0,0 @@
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
src: url('fonts/Inter_18pt-Regular.ttf') format('truetype');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Inter-header';
|
||||
src: url('fonts/Inter_24pt-Bold.ttf');
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Inter-header", Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Inter", Arial, sans-serif;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
background: linear-gradient(135deg, #083358, #1a73e8);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#saveSettingsBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#saveSettingsBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog-overlay,
|
||||
.subtitles-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.dialog,
|
||||
.subtitles-dialog {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.dialog input[type="url"],
|
||||
.subtitles-dialog input[type="url"] {
|
||||
width: 80%;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.dialog button,
|
||||
.subtitles-dialog button {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog button:hover,
|
||||
.subtitles-dialog button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#customControls {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#customControls button,
|
||||
input[type="range"] {
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#customControls button {
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#customControls button:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#showDialogBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
flex-grow: 1;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
video, iframe {
|
||||
display: flex;
|
||||
margin: 20px auto;
|
||||
background: black;
|
||||
width: 80vw;
|
||||
height: 80vh;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.gap-box {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#showDialogBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: #1a73e8;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#settingsBtn {
|
||||
background: #1a73e8;
|
||||
font-size: 18px;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#settingsBtn:hover {
|
||||
background: #0c63d9;
|
||||
}
|
||||
|
||||
#fileInput {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#settingsPanel {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #ffffff;
|
||||
color: black;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
z-index: 10000;
|
||||
text-align: center;
|
||||
}
|
@ -1 +1,11 @@
|
||||
Source code for SimpliPlay.
|
||||
|
||||
--BUILD STUFF--
|
||||
SimpliPlay uses Electron Builder for desktop builds, but includes an example Electron Forge config that will work as expected but does not support native actions such as file picking from the explorer; the package.json uses electron-builder specific actions for that.
|
||||
|
||||
--CI/CD--
|
||||
We now use CI/CD (specifically GitHub Actions, at one point CircleCI) for builds, but Linux ARM64 snaps in particular were annoying to get started with. After multiple attempts, it finally worked as expected (with a few really stupid workarounds required that shouldn't even be needed).
|
||||
|
||||
--DEPENDENCIES--
|
||||
Other than Electron and Electron Builder, there is one more dependency called "Nothing".
|
||||
Its name is very self explanatory, isn't it?
|
||||
|
105
simpliplay/index-es.html
Normal file
105
simpliplay/index-es.html
Normal file
@ -0,0 +1,105 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<!-- this is the Spanish version of SimpliPlay, you can find the translation status at https://crowdin.com/project/simpliplay -->
|
||||
<script src="player-es.js"></script>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Content-Security-Policy" content="
|
||||
default-src 'self';
|
||||
script-src 'self';
|
||||
style-src 'self';
|
||||
img-src 'self' data:;
|
||||
media-src * blob: file:;
|
||||
connect-src *;
|
||||
font-src 'self';
|
||||
object-src 'none';
|
||||
child-src 'none';
|
||||
form-action 'self';
|
||||
worker-src 'self' blob:;
|
||||
">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script src="lib/dash.js"></script>
|
||||
<script src="lib/hls.js"></script>
|
||||
<!--<script src="lib/midi.js"></script>-->
|
||||
<title>SimpliJuega</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>SimpliJuega</h1>
|
||||
<div class="dialog-overlay" id="dialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Seleccione cómo desea cargar los medios:</p>
|
||||
<button id="chooseFileBtn">Seleccionar un archivo</button>
|
||||
<button id="enterUrlBtn">Introduzca una URL</button>
|
||||
<button id="hideDialogBtn">Volver atrás</button>
|
||||
<input type="file" id="fileInput" accept="video/*,audio/*">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-overlay" id="urlDialogOverlay">
|
||||
<div class="dialog">
|
||||
<p>Introduzca la URL del medio:</p>
|
||||
<input type="url" id="urlInput" placeholder="Introduzca aquí la URL del medio">
|
||||
<button id="submitUrlBtn">Enviar</button>
|
||||
<button id="cancelUrlBtn">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="subtitles-overlay" id="subtitlesOverlay">
|
||||
<div class="subtitles-dialog">
|
||||
<p>Introduzca la URL de los subtítulos:</p>
|
||||
<input type="url" id="subtitlesInput" placeholder="Introduzca aquí la URL de los subtítulos">
|
||||
<button id="submitSubtitlesBtn">Enviar</button>
|
||||
<button id="cancelSubtitlesBtn">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<video id="mediaPlayer" autoplay controls></video>
|
||||
|
||||
<midi-player
|
||||
src=""
|
||||
sound-font visualizer="#myVisualizer"
|
||||
id="midiplayer"
|
||||
>
|
||||
</midi-player>
|
||||
<midi-visualizer type="piano-roll" id="myVisualizer"></midi-visualizer>
|
||||
|
||||
<div id="customControls">
|
||||
<button id="playPauseBtn">Pausa</button>
|
||||
<input type="range" id="seekBar" min="0" value="0" step="0.1">
|
||||
<span id="timeDisplay">00:00 / 00:00</span>
|
||||
<button id="volumeBtn">🔊</button>
|
||||
<input type="range" id="volumeBar" min="0" max="1" step="0.1" value="1">
|
||||
<button id="fullscreenBtn">⛶</button>
|
||||
<button id="ccBtn">Añadir subtítulos</button> <!-- CC button -->
|
||||
</div>
|
||||
|
||||
<div class="gap-box"></div>
|
||||
<button id="showDialogBtn">Reproduce más contenido multimedia</button>
|
||||
|
||||
<!-- Settings gear button -->
|
||||
<button id="settingsBtn">⚙️</button>
|
||||
|
||||
<!-- Settings panel -->
|
||||
<div class="dialog-overlay" id="settingsDialogOverlay">
|
||||
<div id="settingsPanel">
|
||||
<label for="autoplayCheckbox">Reproducción automática:</label>
|
||||
<input type="checkbox" id="autoplayCheckbox" checked><br>
|
||||
<label for="loopCheckbox">Bucle:</label>
|
||||
<input type="checkbox" id="loopCheckbox"><br>
|
||||
<label for="controlsCheckbox">Controles:</label>
|
||||
<input type="checkbox" id="controlsCheckbox" checked><br>
|
||||
<label for="controlsCheckbox">Colores vivos:</label>
|
||||
<input type="checkbox" id="colorsCheckbox"><br>
|
||||
<p class="settings-info"><em>La configuración solo se aplica a esta sesión.</em></p>
|
||||
<button id="saveSettingsBtn">Guardar configuración</button>
|
||||
</div>
|
||||
</div>
|
||||
<script src="./renderer.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -15,7 +15,7 @@
|
||||
object-src 'none';
|
||||
child-src 'none';
|
||||
form-action 'self';
|
||||
worker-src 'self';
|
||||
worker-src 'self' blob:;
|
||||
">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
|
||||
@ -26,6 +26,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>SimpliPlay</h1>
|
||||
<div class="dialog-overlay" id="dialogOverlay">
|
||||
<div class="dialog">
|
||||
@ -80,6 +81,11 @@
|
||||
<input type="checkbox" id="autoplayCheckbox" checked><br>
|
||||
<label for="loopCheckbox">Loop:</label>
|
||||
<input type="checkbox" id="loopCheckbox"><br>
|
||||
<label for="controlsCheckbox">Controls:</label>
|
||||
<input type="checkbox" id="controlsCheckbox" checked><br>
|
||||
<label for="controlsCheckbox">Vivid Colors:</label>
|
||||
<input type="checkbox" id="colorsCheckbox"><br>
|
||||
<p class="settings-info"><em>Settings apply for this session only.</em></p>
|
||||
<button id="saveSettingsBtn">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
462
simpliplay/main-es.js
Normal file
462
simpliplay/main-es.js
Normal file
@ -0,0 +1,462 @@
|
||||
const { app, BrowserWindow, Menu, MenuItem, shell, dialog, globalShortcut } = require('electron');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const { pathToFileURL } = require("url");
|
||||
const { checkForUpdate } = require('./updateChecker');
|
||||
let gpuAccel = "";
|
||||
let didRegisterShortcuts = false;
|
||||
let version = "2.1.3.0"
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
if (process.argv.includes('--use-gl')) {
|
||||
app.commandLine.appendSwitch('disable-features', 'Metal');
|
||||
app.commandLine.appendSwitch('use-gl', 'desktop');
|
||||
}
|
||||
}
|
||||
|
||||
// random change just to make sure that snapcraft releases fixed version on new channel to delete arm64 versions
|
||||
|
||||
let mainWindow;
|
||||
if (process.argv.includes('--disable-gpu')) {
|
||||
app.disableHardwareAcceleration();
|
||||
gpuAccel = "disabled";
|
||||
}
|
||||
|
||||
// Handle file opening from Finder or File Explorer
|
||||
app.on('open-file', (event, filePath) => {
|
||||
event.preventDefault();
|
||||
openFile(filePath);
|
||||
});
|
||||
|
||||
const openFile = (filePath) => {
|
||||
app.whenReady().then(() => {
|
||||
const fileURL = pathToFileURL(filePath).href;
|
||||
|
||||
if (mainWindow) {
|
||||
if (mainWindow.webContents.isLoading()) {
|
||||
mainWindow.webContents.once("did-finish-load", () => {
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
});
|
||||
} else {
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
}
|
||||
} else {
|
||||
createWindow(() => {
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const takeSnapshot = async () => {
|
||||
if (!mainWindow) return;
|
||||
|
||||
try {
|
||||
const image = await mainWindow.webContents.capturePage();
|
||||
const png = image.toPNG();
|
||||
const snapshotsDir = path.join(os.homedir(), 'simpliplay-snapshots');
|
||||
fs.mkdirSync(snapshotsDir, { recursive: true });
|
||||
const filePath = path.join(snapshotsDir, `snapshot-${Date.now()}.png`);
|
||||
fs.writeFileSync(filePath, png);
|
||||
|
||||
const { response } = await dialog.showMessageBox(mainWindow, {
|
||||
type: 'info',
|
||||
title: 'Instantánea guardada',
|
||||
message: `Instantánea guardada en:\n${filePath}`,
|
||||
buttons: ['Vale', 'Abrir archivo'],
|
||||
defaultId: 0,
|
||||
});
|
||||
|
||||
if (response === 1) shell.openPath(filePath);
|
||||
} catch (error) {
|
||||
dialog.showErrorBox("Error de instantánea", `No se pudo capturar la instantánea: ${error.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
const createWindow = (onReadyCallback) => {
|
||||
if (!app.isReady()) {
|
||||
app.whenReady().then(() => createWindow(onReadyCallback));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWindow) mainWindow.close();
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "preload.js"),
|
||||
contextIsolation: true,
|
||||
enableRemoteModule: false,
|
||||
nodeIntegration: false, // Keep this false for security
|
||||
sandbox: true,
|
||||
},
|
||||
});
|
||||
|
||||
mainWindow.loadFile("index.html");
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
if (process.argv.includes('--use-gl')) {
|
||||
mainWindow.webContents.on('did-finish-load', () => {
|
||||
mainWindow.webContents.executeJavaScript("navigator.userAgent").then(ua => {
|
||||
console.log("User Agent:", ua);
|
||||
});
|
||||
|
||||
mainWindow.webContents.executeJavaScript("chrome.loadTimes ? chrome.loadTimes() : {}").then(loadTimes => {
|
||||
console.log("GPU Info (legacy):", loadTimes);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
|
||||
if (gpuAccel === "disabled") {
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
type: 'warning',
|
||||
buttons: ['Vale'],
|
||||
defaultId: 0,
|
||||
title: '¡Atención!',
|
||||
message: "Desactivar la aceleración de la GPU reduce considerablemente el rendimiento y no es recomendable, pero si tienes curiosidad, no voy a impedírtelo.",
|
||||
});
|
||||
}
|
||||
|
||||
if (onReadyCallback) onReadyCallback();
|
||||
});
|
||||
|
||||
setupContextMenu();
|
||||
};
|
||||
|
||||
|
||||
// Set up context menu (prevents errors if `mainWindow` is undefined)
|
||||
const setupContextMenu = () => {
|
||||
if (!mainWindow) return;
|
||||
|
||||
const contextMenu = new Menu();
|
||||
contextMenu.append(new MenuItem({ label: 'Toma una instantánea', click: takeSnapshot }));
|
||||
contextMenu.append(new MenuItem({ type: 'separator' }));
|
||||
contextMenu.append(new MenuItem({ label: 'Inspeccionar', click: () => mainWindow.webContents.openDevTools() }));
|
||||
|
||||
mainWindow.webContents.on('context-menu', (event) => {
|
||||
event.preventDefault();
|
||||
contextMenu.popup({ window: mainWindow });
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Set up application menu
|
||||
const setupMenu = () => {
|
||||
const menu = Menu.getApplicationMenu();
|
||||
if (!menu) return;
|
||||
|
||||
const fileMenu = menu.items.find(item => item.label === 'File');
|
||||
if (fileMenu && !fileMenu.submenu.items.some(item => item.label === 'Toma una instantánea')) {
|
||||
fileMenu.submenu.append(new MenuItem({ label: 'Toma una instantánea', accelerator: 'CommandOrControl+Shift+S', click: takeSnapshot }));
|
||||
}
|
||||
|
||||
const appMenu = menu.items.find(item => item.label === 'SimpliPlay');
|
||||
|
||||
if (appMenu && !appMenu.submenu.items.some(item => item.label === 'Buscar actualizaciones')) {
|
||||
const submenu = appMenu.submenu;
|
||||
const separatorIndex = submenu.items.findIndex(item => item.type === 'separator');
|
||||
|
||||
const updateMenuItem = new MenuItem({
|
||||
label: 'Buscar actualizaciones',
|
||||
accelerator: 'CommandOrControl+Shift+U',
|
||||
click: () => checkForUpdate(version)
|
||||
});
|
||||
|
||||
if (separatorIndex === -1) {
|
||||
// No separator found — just append
|
||||
submenu.append(updateMenuItem);
|
||||
} else {
|
||||
// Insert right before the separator
|
||||
submenu.insert(separatorIndex, updateMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const helpMenu = menu.items.find(item => item.label === 'Help');
|
||||
if (helpMenu) {
|
||||
const addMenuItem = (label, url) => {
|
||||
if (!helpMenu.submenu.items.some(item => item.label === label)) {
|
||||
helpMenu.submenu.append(new MenuItem({ label, click: () => shell.openExternal(url) }));
|
||||
}
|
||||
};
|
||||
|
||||
addMenuItem('Código fuente', 'https://github.com/A-Star100/simpliplay-desktop');
|
||||
addMenuItem('Sitio web', 'https://simpliplay.netlify.app');
|
||||
addMenuItem('Centro de ayuda', 'https://simpliplay.netlify.app/help');
|
||||
|
||||
// Check for Updates
|
||||
if (!helpMenu.submenu.items.some(item => item.label === 'Buscar actualizaciones')) {
|
||||
helpMenu.submenu.append(
|
||||
new MenuItem({
|
||||
label: 'Buscar actualizaciones',
|
||||
accelerator: 'CommandOrControl+Shift+U',
|
||||
click: () => checkForUpdate(version)
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (!helpMenu.submenu.items.some(item => item.label === 'Salir')) {
|
||||
helpMenu.submenu.append(new MenuItem({ type: 'separator' }));
|
||||
helpMenu.submenu.append(new MenuItem({ label: 'Salir', click: () => app.quit() }));
|
||||
}
|
||||
}
|
||||
|
||||
const loadedAddons = new Map(); // key: addon filepath, value: MenuItem
|
||||
|
||||
const newMenuItems = menu ? [...menu.items] : [];
|
||||
|
||||
let addonsMenu;
|
||||
|
||||
// Check if Add-ons menu already exists
|
||||
const existingAddonsMenuItem = newMenuItems.find(item => item.label === 'Add-ons');
|
||||
|
||||
if (existingAddonsMenuItem) {
|
||||
addonsMenu = existingAddonsMenuItem.submenu;
|
||||
} else {
|
||||
addonsMenu = new Menu();
|
||||
|
||||
// "Load Add-on" menu item
|
||||
addonsMenu.append(new MenuItem({
|
||||
label: 'Cargar complemento',
|
||||
accelerator: 'CommandOrControl+Shift+A',
|
||||
click: async () => {
|
||||
const result = await dialog.showOpenDialog(mainWindow, {
|
||||
title: 'Cargar complemento',
|
||||
filters: [{ name: 'JavaScript Files', extensions: ['simpliplay'] }],
|
||||
properties: ['openFile'],
|
||||
});
|
||||
|
||||
if (!result.canceled && result.filePaths.length > 0) {
|
||||
const filePath = result.filePaths[0];
|
||||
const fileName = path.basename(filePath);
|
||||
const fileURL = pathToFileURL(filePath).href;
|
||||
|
||||
// Check if an addon with the same filename is already loaded
|
||||
const alreadyLoaded = [...loadedAddons.keys()].some(
|
||||
loadedPath => path.basename(loadedPath) === fileName
|
||||
);
|
||||
|
||||
if (alreadyLoaded) {
|
||||
await dialog.showMessageBox(mainWindow, {
|
||||
type: 'error',
|
||||
title: 'No se pudo cargar el complemento',
|
||||
message: `Un complemento llamado "${fileName}" ya se ha cargado anteriormente.`,
|
||||
buttons: ['Vale']
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!loadedAddons.has(filePath)) {
|
||||
mainWindow.webContents.send('load-addon', fileURL);
|
||||
|
||||
const addonMenuItem = new MenuItem({
|
||||
label: fileName,
|
||||
type: 'checkbox',
|
||||
checked: true,
|
||||
click: (menuItem) => {
|
||||
if (menuItem.checked) {
|
||||
fs.access(filePath, (err) => {
|
||||
if (!err) {
|
||||
mainWindow.webContents.send('load-addon', fileURL);
|
||||
} else {
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
type: 'error',
|
||||
title: 'No se pudo cargar el complemento',
|
||||
message: `El complemento "${fileName}" no se ha encontrado o ya no existe.`,
|
||||
buttons: ['Vale']
|
||||
}).then(() => {
|
||||
// Delay unchecking to ensure dialog closes first
|
||||
setTimeout(() => {
|
||||
menuItem.checked = false;
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
mainWindow.webContents.send('unload-addon', fileURL);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!addonsMenu.items.some(item => item.type === 'separator')) {
|
||||
addonsMenu.append(new MenuItem({ type: 'separator' }));
|
||||
}
|
||||
|
||||
addonsMenu.append(addonMenuItem);
|
||||
loadedAddons.set(filePath, addonMenuItem);
|
||||
|
||||
// Rebuild the menu after adding the new addon item
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(newMenuItems));
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
// "About Addons" menu item (info dialog version)
|
||||
addonsMenu.append(new MenuItem({
|
||||
label: 'Acerca de los complementos',
|
||||
click: async () => {
|
||||
const result = await dialog.showMessageBox(mainWindow, {
|
||||
type: 'info',
|
||||
buttons: ['De acuerdo'],
|
||||
defaultId: 0,
|
||||
title: 'Acerca de los complementos',
|
||||
message: 'Los complementos pueden hacer casi cualquier cosa, desde añadir funciones al reproductor multimedia hasta añadir un juego completo dentro de la aplicación.',
|
||||
detail: 'Los complementos son archivos JavaScript normales del lado del cliente con la extensión [.simpliplay].'
|
||||
});
|
||||
|
||||
if (result.response === 0) {
|
||||
console.log('El usuario hizo clic en Aceptar.');
|
||||
// no need for dialog.closeDialog()
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
// Add the Add-ons menu only once here:
|
||||
newMenuItems.push(new MenuItem({ label: 'Add-ons', submenu: addonsMenu }));
|
||||
|
||||
// Set the application menu after adding Add-ons menu
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(newMenuItems));
|
||||
}
|
||||
|
||||
|
||||
// Re-apply the full menu if you add newMenuItems outside of the if above
|
||||
//Menu.setApplicationMenu(Menu.buildFromTemplate(newMenuItems));
|
||||
|
||||
|
||||
//Menu.setApplicationMenu(menu);
|
||||
};
|
||||
|
||||
const setupShortcuts = () => {
|
||||
if (didRegisterShortcuts === false) {
|
||||
globalShortcut.register('CommandOrControl+Q', () => {
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
|
||||
|
||||
if (!focusedWindow) return; // Do nothing if no window is focused
|
||||
|
||||
dialog.showMessageBox(focusedWindow, {
|
||||
type: 'question',
|
||||
buttons: ['Cancelar', 'Salir'],
|
||||
defaultId: 1,
|
||||
title: '¿Renunciar?',
|
||||
message: '¿Estás seguro de que quieres salir de SimpliJuega?',
|
||||
}).then(({ response }) => {
|
||||
if (response === 1) app.quit();
|
||||
});
|
||||
});
|
||||
|
||||
globalShortcut.register('CommandOrControl+Shift+S', () => {
|
||||
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
|
||||
|
||||
if (!focusedWindow) return; // Do nothing if no window is focused
|
||||
|
||||
takeSnapshot();
|
||||
});
|
||||
|
||||
globalShortcut.register('CommandOrControl+S', () => {
|
||||
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
|
||||
|
||||
if (!focusedWindow) return; // Do nothing if no window is focused
|
||||
|
||||
takeSnapshot();
|
||||
});
|
||||
|
||||
// globalShortcut.register('CommandOrControl+Shift+S', takeSnapshot);
|
||||
didRegisterShortcuts = true;
|
||||
}
|
||||
};
|
||||
|
||||
function unregisterShortcuts() {
|
||||
didRegisterShortcuts = false;
|
||||
globalShortcut.unregisterAll();
|
||||
console.log("Shortcuts unregistered");
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow();
|
||||
setupMenu();
|
||||
|
||||
|
||||
mainWindow?.on("focus", () => {
|
||||
if (!didRegisterShortcuts) setupShortcuts();
|
||||
});
|
||||
|
||||
mainWindow?.on("blur", unregisterShortcuts);
|
||||
|
||||
// Store but delay opening
|
||||
const args = process.argv.slice(2);
|
||||
const fileArg = args.find(isValidFileArg);
|
||||
|
||||
if (fileArg) {
|
||||
app.whenReady().then(() => {
|
||||
if (mainWindow) openFileSafely(fileArg);
|
||||
});
|
||||
}
|
||||
|
||||
app.on("open-file", (event, filePath) => {
|
||||
event.preventDefault();
|
||||
openFileSafely(filePath);
|
||||
});
|
||||
|
||||
if (["win32", "linux"].includes(process.platform)) {
|
||||
if (!app.requestSingleInstanceLock()) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on("second-instance", (event, argv) => {
|
||||
const fileArg = argv.find(isValidFileArg);
|
||||
if (fileArg) openFileSafely(fileArg);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let hasOpenedFile = false;
|
||||
|
||||
function openFileSafely(filePath) {
|
||||
if (!hasOpenedFile) {
|
||||
hasOpenedFile = true;
|
||||
|
||||
const absPath = path.resolve(filePath); // ensure absolute path
|
||||
|
||||
if (mainWindow?.webContents) {
|
||||
const winFileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path
|
||||
mainWindow.webContents.send("play-media", winFileURL);
|
||||
}
|
||||
|
||||
setTimeout(() => (hasOpenedFile = false), 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function isValidFileArg(arg) {
|
||||
if (!arg || arg.startsWith('-') || arg.includes('electron')) return false;
|
||||
|
||||
const resolvedPath = path.resolve(arg);
|
||||
if (!fs.existsSync(resolvedPath)) return false;
|
||||
|
||||
// Reject known executable/script extensions
|
||||
const badExtensions = ['.exe', '.bat', '.cmd', '.sh', '.msi', '.com', '.vbs', '.ps1', '.jar', '.scr'];
|
||||
const ext = path.extname(resolvedPath).toLowerCase();
|
||||
|
||||
return !badExtensions.includes(ext);
|
||||
}
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
globalShortcut.unregisterAll();
|
||||
app.quit();
|
||||
/* once bug fixed replace above with:
|
||||
if (process.platform !== 'darwin') app.quit() */
|
||||
});
|
||||
|
||||
app.on("will-quit", () => {
|
||||
globalShortcut.unregisterAll();
|
||||
});
|
@ -2,8 +2,26 @@ const { app, BrowserWindow, Menu, MenuItem, shell, dialog, globalShortcut } = re
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const { pathToFileURL } = require("url");
|
||||
const { checkForUpdate } = require('./updateChecker');
|
||||
let gpuAccel = "";
|
||||
let didRegisterShortcuts = false;
|
||||
let version = "2.1.4.0"
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
if (process.argv.includes('--use-gl')) {
|
||||
app.commandLine.appendSwitch('disable-features', 'Metal');
|
||||
app.commandLine.appendSwitch('use-gl', 'desktop');
|
||||
}
|
||||
}
|
||||
|
||||
// random change just to make sure that snapcraft releases fixed version on new channel to delete arm64 versions
|
||||
|
||||
let mainWindow;
|
||||
if (process.argv.includes('--disable-gpu')) {
|
||||
app.disableHardwareAcceleration();
|
||||
gpuAccel = "disabled";
|
||||
}
|
||||
|
||||
// Handle file opening from Finder or File Explorer
|
||||
app.on('open-file', (event, filePath) => {
|
||||
@ -13,22 +31,25 @@ app.on('open-file', (event, filePath) => {
|
||||
|
||||
const openFile = (filePath) => {
|
||||
app.whenReady().then(() => {
|
||||
const fileURL = pathToFileURL(filePath).href;
|
||||
|
||||
if (mainWindow) {
|
||||
if (mainWindow.webContents.isLoading()) {
|
||||
mainWindow.webContents.once("did-finish-load", () => {
|
||||
mainWindow.webContents.send("play-media", filePath);
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
});
|
||||
} else {
|
||||
mainWindow.webContents.send("play-media", filePath);
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
}
|
||||
} else {
|
||||
createWindow(() => {
|
||||
mainWindow.webContents.send("play-media", filePath);
|
||||
mainWindow.webContents.send("play-media", fileURL);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const takeSnapshot = async () => {
|
||||
if (!mainWindow) return;
|
||||
|
||||
@ -68,18 +89,47 @@ const createWindow = (onReadyCallback) => {
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "preload.js"),
|
||||
contextIsolation: true,
|
||||
enableRemoteModule: false,
|
||||
nodeIntegration: false, // Keep this false for security
|
||||
sandbox: true,
|
||||
},
|
||||
});
|
||||
|
||||
mainWindow.loadFile("index.html");
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
if (process.argv.includes('--use-gl')) {
|
||||
mainWindow.webContents.on('did-finish-load', () => {
|
||||
mainWindow.webContents.executeJavaScript("navigator.userAgent").then(ua => {
|
||||
console.log("User Agent:", ua);
|
||||
});
|
||||
|
||||
mainWindow.webContents.executeJavaScript("chrome.loadTimes ? chrome.loadTimes() : {}").then(loadTimes => {
|
||||
console.log("GPU Info (legacy):", loadTimes);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
|
||||
if (gpuAccel === "disabled") {
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
type: 'warning',
|
||||
buttons: ['Ok'],
|
||||
defaultId: 0,
|
||||
title: 'Warning!',
|
||||
message: "Disabling GPU acceleration greatly decreases performance and is not recommended, but if you're curious, I don't wanna stop you.",
|
||||
});
|
||||
}
|
||||
|
||||
if (onReadyCallback) onReadyCallback();
|
||||
});
|
||||
|
||||
setupContextMenu();
|
||||
};
|
||||
|
||||
|
||||
// Set up context menu (prevents errors if `mainWindow` is undefined)
|
||||
const setupContextMenu = () => {
|
||||
if (!mainWindow) return;
|
||||
@ -95,6 +145,7 @@ const setupContextMenu = () => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Set up application menu
|
||||
const setupMenu = () => {
|
||||
const menu = Menu.getApplicationMenu();
|
||||
@ -105,6 +156,28 @@ const setupMenu = () => {
|
||||
fileMenu.submenu.append(new MenuItem({ label: 'Take a Snapshot', accelerator: 'CommandOrControl+Shift+S', click: takeSnapshot }));
|
||||
}
|
||||
|
||||
const appMenu = menu.items.find(item => item.label === 'SimpliPlay');
|
||||
|
||||
if (appMenu && !appMenu.submenu.items.some(item => item.label === 'Check for Updates')) {
|
||||
const submenu = appMenu.submenu;
|
||||
const separatorIndex = submenu.items.findIndex(item => item.type === 'separator');
|
||||
|
||||
const updateMenuItem = new MenuItem({
|
||||
label: 'Check for Updates',
|
||||
accelerator: 'CommandOrControl+Shift+U',
|
||||
click: () => checkForUpdate(version)
|
||||
});
|
||||
|
||||
if (separatorIndex === -1) {
|
||||
// No separator found — just append
|
||||
submenu.append(updateMenuItem);
|
||||
} else {
|
||||
// Insert right before the separator
|
||||
submenu.insert(separatorIndex, updateMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const helpMenu = menu.items.find(item => item.label === 'Help');
|
||||
if (helpMenu) {
|
||||
const addMenuItem = (label, url) => {
|
||||
@ -117,52 +190,282 @@ const setupMenu = () => {
|
||||
addMenuItem('Website', 'https://simpliplay.netlify.app');
|
||||
addMenuItem('Help Center', 'https://simpliplay.netlify.app/help');
|
||||
|
||||
// Check for Updates
|
||||
if (!helpMenu.submenu.items.some(item => item.label === 'Check for Updates')) {
|
||||
helpMenu.submenu.append(
|
||||
new MenuItem({
|
||||
label: 'Check for Updates',
|
||||
accelerator: 'CommandOrControl+Shift+U',
|
||||
click: () => checkForUpdate(version)
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (!helpMenu.submenu.items.some(item => item.label === 'Quit')) {
|
||||
helpMenu.submenu.append(new MenuItem({ type: 'separator' }));
|
||||
helpMenu.submenu.append(new MenuItem({ label: 'Quit', click: () => app.quit() }));
|
||||
}
|
||||
}
|
||||
|
||||
Menu.setApplicationMenu(menu);
|
||||
const loadedAddons = new Map(); // key: addon filepath, value: MenuItem
|
||||
|
||||
const newMenuItems = menu ? [...menu.items] : [];
|
||||
|
||||
let addonsMenu;
|
||||
|
||||
// Check if Add-ons menu already exists
|
||||
const existingAddonsMenuItem = newMenuItems.find(item => item.label === 'Add-ons');
|
||||
|
||||
if (existingAddonsMenuItem) {
|
||||
addonsMenu = existingAddonsMenuItem.submenu;
|
||||
} else {
|
||||
addonsMenu = new Menu();
|
||||
|
||||
// "Load Add-on" menu item
|
||||
addonsMenu.append(new MenuItem({
|
||||
label: 'Load Add-on',
|
||||
accelerator: 'CommandOrControl+Shift+A',
|
||||
click: async () => {
|
||||
const result = await dialog.showOpenDialog(mainWindow, {
|
||||
title: 'Load Add-on',
|
||||
filters: [{ name: 'JavaScript Files', extensions: ['simpliplay'] }],
|
||||
properties: ['openFile'],
|
||||
});
|
||||
|
||||
if (!result.canceled && result.filePaths.length > 0) {
|
||||
const filePath = result.filePaths[0];
|
||||
const fileName = path.basename(filePath);
|
||||
const fileURL = pathToFileURL(filePath).href;
|
||||
|
||||
// Check if an addon with the same filename is already loaded
|
||||
const alreadyLoaded = [...loadedAddons.keys()].some(
|
||||
loadedPath => path.basename(loadedPath) === fileName
|
||||
);
|
||||
|
||||
if (alreadyLoaded) {
|
||||
await dialog.showMessageBox(mainWindow, {
|
||||
type: 'error',
|
||||
title: 'Could not load addon',
|
||||
message: `An add-on named "${fileName}" has already been loaded before.`,
|
||||
buttons: ['OK']
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!loadedAddons.has(filePath)) {
|
||||
mainWindow.webContents.send('load-addon', fileURL);
|
||||
|
||||
const addonMenuItem = new MenuItem({
|
||||
label: fileName,
|
||||
type: 'checkbox',
|
||||
checked: true,
|
||||
click: (menuItem) => {
|
||||
if (menuItem.checked) {
|
||||
fs.access(filePath, (err) => {
|
||||
if (!err) {
|
||||
mainWindow.webContents.send('load-addon', fileURL);
|
||||
} else {
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
type: 'error',
|
||||
title: 'Could not load addon',
|
||||
message: `The add-on "${fileName}" could not be found or doesn't exist anymore.`,
|
||||
buttons: ['OK']
|
||||
}).then(() => {
|
||||
// Delay unchecking to ensure dialog closes first
|
||||
setTimeout(() => {
|
||||
menuItem.checked = false;
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
mainWindow.webContents.send('unload-addon', fileURL);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (!addonsMenu.items.some(item => item.type === 'separator')) {
|
||||
addonsMenu.append(new MenuItem({ type: 'separator' }));
|
||||
}
|
||||
|
||||
addonsMenu.append(addonMenuItem);
|
||||
loadedAddons.set(filePath, addonMenuItem);
|
||||
|
||||
// Rebuild the menu after adding the new addon item
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(newMenuItems));
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
// "About Addons" menu item (info dialog version)
|
||||
addonsMenu.append(new MenuItem({
|
||||
label: 'About Addons',
|
||||
click: async () => {
|
||||
const result = await dialog.showMessageBox(mainWindow, {
|
||||
type: 'info',
|
||||
buttons: ['OK'],
|
||||
defaultId: 0,
|
||||
title: 'About Addons',
|
||||
message: 'Addons can do almost anything from adding features to the media player to adding an entire game within the app!',
|
||||
detail: 'Addons are regular, client-side JavaScript files with the [.simpliplay] extension.'
|
||||
});
|
||||
|
||||
if (result.response === 0) {
|
||||
console.log('User clicked OK');
|
||||
// no need for dialog.closeDialog()
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
// "Store" menu item (info dialog version)
|
||||
addonsMenu.append(new MenuItem({
|
||||
label: 'Store',
|
||||
click: () => {
|
||||
shell.openExternal("https://simpliplay.netlify.app/addons/")
|
||||
}
|
||||
}));
|
||||
|
||||
// Add the Add-ons menu only once here:
|
||||
newMenuItems.push(new MenuItem({ label: 'Add-ons', submenu: addonsMenu }));
|
||||
|
||||
// Set the application menu after adding Add-ons menu
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(newMenuItems));
|
||||
}
|
||||
|
||||
|
||||
// Re-apply the full menu if you add newMenuItems outside of the if above
|
||||
//Menu.setApplicationMenu(Menu.buildFromTemplate(newMenuItems));
|
||||
|
||||
|
||||
//Menu.setApplicationMenu(menu);
|
||||
};
|
||||
|
||||
// Quit Confirmation on CommandOrControl+Q
|
||||
const setupShortcuts = () => {
|
||||
if (didRegisterShortcuts === false) {
|
||||
globalShortcut.register('CommandOrControl+Q', () => {
|
||||
if (mainWindow) {
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
type: 'question',
|
||||
buttons: ['Cancel', 'Quit'],
|
||||
defaultId: 1,
|
||||
title: 'Quit?',
|
||||
message: 'Are you sure you want to quit SimpliPlay?',
|
||||
}).then(({ response }) => {
|
||||
if (response === 1) app.quit();
|
||||
});
|
||||
}
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
|
||||
|
||||
if (!focusedWindow) return; // Do nothing if no window is focused
|
||||
|
||||
dialog.showMessageBox(focusedWindow, {
|
||||
type: 'question',
|
||||
buttons: ['Cancel', 'Quit'],
|
||||
defaultId: 1,
|
||||
title: 'Quit?',
|
||||
message: 'Are you sure you want to quit SimpliPlay?',
|
||||
}).then(({ response }) => {
|
||||
if (response === 1) app.quit();
|
||||
});
|
||||
});
|
||||
|
||||
globalShortcut.register('CommandOrControl+Shift+S', takeSnapshot);
|
||||
globalShortcut.register('CommandOrControl+Shift+S', () => {
|
||||
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
|
||||
|
||||
if (!focusedWindow) return; // Do nothing if no window is focused
|
||||
|
||||
takeSnapshot();
|
||||
});
|
||||
|
||||
globalShortcut.register('CommandOrControl+S', () => {
|
||||
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
|
||||
|
||||
if (!focusedWindow) return; // Do nothing if no window is focused
|
||||
|
||||
takeSnapshot();
|
||||
});
|
||||
|
||||
// globalShortcut.register('CommandOrControl+Shift+S', takeSnapshot);
|
||||
didRegisterShortcuts = true;
|
||||
}
|
||||
};
|
||||
|
||||
// App lifecycle management
|
||||
function unregisterShortcuts() {
|
||||
didRegisterShortcuts = false;
|
||||
globalShortcut.unregisterAll();
|
||||
console.log("Shortcuts unregistered");
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow();
|
||||
setupMenu();
|
||||
setupShortcuts();
|
||||
|
||||
|
||||
mainWindow?.on("focus", () => {
|
||||
if (!didRegisterShortcuts) setupShortcuts();
|
||||
});
|
||||
|
||||
mainWindow?.on("blur", unregisterShortcuts);
|
||||
|
||||
// Store but delay opening
|
||||
const args = process.argv.slice(2);
|
||||
const fileArg = args.find(isValidFileArg);
|
||||
|
||||
if (fileArg) {
|
||||
app.whenReady().then(() => {
|
||||
if (mainWindow) openFileSafely(fileArg);
|
||||
});
|
||||
}
|
||||
|
||||
app.on("open-file", (event, filePath) => {
|
||||
event.preventDefault();
|
||||
openFile(filePath);
|
||||
openFileSafely(filePath);
|
||||
});
|
||||
|
||||
app.on("activate", () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
||||
});
|
||||
if (["win32", "linux"].includes(process.platform)) {
|
||||
if (!app.requestSingleInstanceLock()) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on("second-instance", (event, argv) => {
|
||||
const fileArg = argv.find(isValidFileArg);
|
||||
if (fileArg) openFileSafely(fileArg);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let hasOpenedFile = false;
|
||||
|
||||
function openFileSafely(filePath) {
|
||||
if (!hasOpenedFile) {
|
||||
hasOpenedFile = true;
|
||||
|
||||
const absPath = path.resolve(filePath); // ensure absolute path
|
||||
|
||||
if (mainWindow?.webContents) {
|
||||
const winFileURL = pathToFileURL(filePath).href; // ✅ Convert and encode file path
|
||||
mainWindow.webContents.send("play-media", winFileURL);
|
||||
}
|
||||
|
||||
setTimeout(() => (hasOpenedFile = false), 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function isValidFileArg(arg) {
|
||||
if (!arg || arg.startsWith('-') || arg.includes('electron')) return false;
|
||||
|
||||
const resolvedPath = path.resolve(arg);
|
||||
if (!fs.existsSync(resolvedPath)) return false;
|
||||
|
||||
// Reject known executable/script extensions
|
||||
const badExtensions = ['.exe', '.bat', '.cmd', '.sh', '.msi', '.com', '.vbs', '.ps1', '.jar', '.scr'];
|
||||
const ext = path.extname(resolvedPath).toLowerCase();
|
||||
|
||||
return !badExtensions.includes(ext);
|
||||
}
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
app.quit();
|
||||
/* once bug fixed replace above with:
|
||||
globalShortcut.unregisterAll();
|
||||
app.quit();
|
||||
/* once bug fixed replace above with:
|
||||
if (process.platform !== 'darwin') app.quit() */
|
||||
});
|
||||
|
||||
app.on("will-quit", () => {
|
||||
globalShortcut.unregisterAll();
|
||||
});
|
||||
|
124
simpliplay/package-arm64-linux.json
Normal file
124
simpliplay/package-arm64-linux.json
Normal file
@ -0,0 +1,124 @@
|
||||
{
|
||||
"name": "SimpliPlay",
|
||||
"version": "2.1.4",
|
||||
"description": "SimpliPlay - The mission to make media playback accessible on every device, anywhere, anytime.",
|
||||
"main": "./main.js",
|
||||
"scripts": {
|
||||
"test": "echo Hello World from SimpliPlay!!!",
|
||||
"start": "electron-forge start",
|
||||
"package": "electron-builder --dir",
|
||||
"make": "electron-builder"
|
||||
},
|
||||
"author": "Anirudh Sevugan",
|
||||
"build": {
|
||||
"npmRebuild": false,
|
||||
"appId": "com.anirudhsevugan.simpliPlay",
|
||||
"productName": "SimpliPlay",
|
||||
"directories": {
|
||||
"output": "dist"
|
||||
},
|
||||
"snap": {
|
||||
"confinement": "strict",
|
||||
"grade": "stable",
|
||||
"summary": "A cross-platform, simple media player.",
|
||||
"description": "The mission to make media playback accessible on every platform, anywhere, anytime.",
|
||||
"base": "core22"
|
||||
},
|
||||
"mac": {
|
||||
"target": [
|
||||
"dmg"
|
||||
],
|
||||
"icon": "icon.icns"
|
||||
},
|
||||
"win": {
|
||||
"target": "nsis",
|
||||
"icon": "icon.ico"
|
||||
},
|
||||
"linux": {
|
||||
"target": ["snap", "AppImage"],
|
||||
"icon": "icon.png",
|
||||
"executableName": "SimpliPlay",
|
||||
"synopsis": "The mission to make media playback accessible anywhere, anytime.",
|
||||
"artifactName": "SimpliPlay-${arch}-linux.${ext}"
|
||||
},
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "mp4",
|
||||
"name": "MP4 Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "webm",
|
||||
"name": "WebM Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "m4v",
|
||||
"name": "M4V Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "m4a",
|
||||
"name": "M4A Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "ogv",
|
||||
"name": "OGV Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mp3",
|
||||
"name": "MP3 Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "aac",
|
||||
"name": "AAC Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "wav",
|
||||
"name": "WAV Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "ogg",
|
||||
"name": "OGG Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "flac",
|
||||
"name": "FLAC Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "opus",
|
||||
"name": "Opus Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mkv",
|
||||
"name": "MKV Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mov",
|
||||
"name": "QuickTime Movie",
|
||||
"role": "Viewer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"installerIcon": "icon.ico",
|
||||
"uninstallerIcon": "icon.ico",
|
||||
"uninstallDisplayName": "simpliplay-uninstaller",
|
||||
"license": "LICENSE.md",
|
||||
"allowToChangeInstallationDirectory": true
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^38.1.0",
|
||||
"electron-builder": "^26.0.12"
|
||||
}
|
||||
}
|
1709
simpliplay/package-lock.json
generated
1709
simpliplay/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,81 +1,129 @@
|
||||
{
|
||||
"name": "SimpliPlay",
|
||||
"version": "1.0.2",
|
||||
"description": "The mission to make media playback accessible on every device, anywhere, anytime.",
|
||||
"main": "main.js",
|
||||
"version": "2.1.4",
|
||||
"description": "The mission to make media playback accessible on every platform, anywhere, anytime.",
|
||||
"main": "./main.js",
|
||||
"scripts": {
|
||||
"test": "echo Hello World!!!",
|
||||
"test": "echo Hello World from SimpliPlay!!!",
|
||||
"start": "electron-forge start",
|
||||
"package": "electron-builder --dir",
|
||||
"make": "electron-builder"
|
||||
},
|
||||
"author": "Anirudh Sevugan",
|
||||
"build": {
|
||||
"npmRebuild": false,
|
||||
"appId": "com.anirudhsevugan.simpliPlay",
|
||||
"productName": "SimpliPlay",
|
||||
"directories": {
|
||||
"output": "dist"
|
||||
},
|
||||
"snap": {
|
||||
"confinement": "strict",
|
||||
"grade": "stable",
|
||||
"summary": "A cross-platform, simple media player.",
|
||||
"description": "The mission to make media playback accessible on every platform, anywhere, anytime."
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"installerIcon": "icon.ico",
|
||||
"uninstallerIcon": "icon.ico",
|
||||
"uninstallDisplayName": "simpliplay-uninstaller",
|
||||
"allowToChangeInstallationDirectory": true
|
||||
},
|
||||
"mac": {
|
||||
"target": [
|
||||
"dmg"
|
||||
],
|
||||
"icon": "icon.icns"
|
||||
"icon": "icon.icns",
|
||||
"artifactName": "SimpliPlay-${arch}-darwin.${ext}",
|
||||
"identity": "-"
|
||||
},
|
||||
"win": {
|
||||
"target": "msi",
|
||||
"icon": "icon.ico"
|
||||
"target": [
|
||||
{
|
||||
"target": "nsis",
|
||||
"arch": ["x64", "arm64"]
|
||||
}
|
||||
],
|
||||
"artifactName": "SimpliPlay-${arch}-win-setup.${ext}"
|
||||
},
|
||||
"linux": {
|
||||
"target": "AppImage",
|
||||
"icon": "icon.png"
|
||||
"target": ["snap", "AppImage"],
|
||||
"icon": "icon.png",
|
||||
"executableName": "SimpliPlay",
|
||||
"synopsis": "The mission to make media playback accessible anywhere, anytime.",
|
||||
"artifactName": "SimpliPlay-${arch}-linux.${ext}"
|
||||
},
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "mp4",
|
||||
"name": "MP4 Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "webm",
|
||||
"name": "WebM Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "ogv",
|
||||
"name": "OGV Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mp3",
|
||||
"name": "MP3 Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "aac",
|
||||
"name": "AAC Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "wav",
|
||||
"name": "WAV Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "ogg",
|
||||
"name": "OGG Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mkv",
|
||||
"name": "MKV Video",
|
||||
"role": "Viewer"
|
||||
}
|
||||
]
|
||||
|
||||
{
|
||||
"ext": "mp4",
|
||||
"name": "MP4 Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "webm",
|
||||
"name": "WebM Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "m4v",
|
||||
"name": "M4V Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "m4a",
|
||||
"name": "M4A Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "ogv",
|
||||
"name": "OGV Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mp3",
|
||||
"name": "MP3 Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "aac",
|
||||
"name": "AAC Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "wav",
|
||||
"name": "WAV Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "ogg",
|
||||
"name": "OGG Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "flac",
|
||||
"name": "FLAC Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "opus",
|
||||
"name": "Opus Audio",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mkv",
|
||||
"name": "MKV Video",
|
||||
"role": "Viewer"
|
||||
},
|
||||
{
|
||||
"ext": "mov",
|
||||
"name": "QuickTime Movie",
|
||||
"role": "Viewer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^34.0.1",
|
||||
"electron-builder": "^25.1.8"
|
||||
"electron": "^38.1.0",
|
||||
"electron-builder": "^26.0.12"
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const enterUrlBtn = document.getElementById('enterUrlBtn');
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const mediaPlayer = document.getElementById('mediaPlayer');
|
||||
const showDialogBtn = document.getElementById('showDialogBtn');
|
||||
const hideDialogBtn = document.getElementById('hideDialogBtn');
|
||||
const playPauseBtn = document.getElementById('playPauseBtn');
|
||||
const seekBar = document.getElementById('seekBar');
|
||||
const timeDisplay = document.getElementById('timeDisplay');
|
||||
@ -16,18 +14,56 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const autoplayCheckbox = document.getElementById('autoplayCheckbox');
|
||||
const loopCheckbox = document.getElementById('loopCheckbox');
|
||||
const saveSettingsBtn = document.getElementById('saveSettingsBtn');
|
||||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||
const urlDialogOverlay = document.getElementById('urlDialogOverlay');
|
||||
const settingsDialogOverlay = document.getElementById('settingsDialogOverlay');
|
||||
const urlInput = document.getElementById('urlInput');
|
||||
const submitUrlBtn = document.getElementById('submitUrlBtn');
|
||||
const cancelUrlBtn = document.getElementById('cancelUrlBtn');
|
||||
const ccBtn = document.getElementById('ccBtn'); // CC button
|
||||
const volumeBtn = document.getElementById("volumeBtn")
|
||||
const subtitlesOverlay = document.getElementById('subtitlesOverlay');
|
||||
const subtitlesInput = document.getElementById('subtitlesInput');
|
||||
const submitSubtitlesBtn = document.getElementById('submitSubtitlesBtn');
|
||||
const cancelSubtitlesBtn = document.getElementById('cancelSubtitlesBtn');
|
||||
const customControls = document.getElementById('customControls');
|
||||
let hls = null
|
||||
let player = null
|
||||
window.hls = hls;
|
||||
window.dash = player;
|
||||
|
||||
async function detectStreamType(url) {
|
||||
try {
|
||||
const response = await fetch(url, { method: 'HEAD' });
|
||||
const contentType = response.headers.get('Content-Type') || '';
|
||||
|
||||
const isHLS = url.toLowerCase().endsWith('.m3u8') ||
|
||||
contentType.includes('application/vnd.apple.mpegurl') ||
|
||||
contentType.includes('application/x-mpegURL');
|
||||
|
||||
const isDASH = url.toLowerCase().endsWith('.mpd') ||
|
||||
contentType.includes('application/dash+xml');
|
||||
|
||||
return { isHLS, isDASH, contentType };
|
||||
} catch (err) {
|
||||
console.error("Failed to detect stream type:", err);
|
||||
return { isHLS: false, isDASH: false, contentType: null };
|
||||
}
|
||||
}
|
||||
|
||||
// Update media volume when the slider is moved
|
||||
volumeBar.addEventListener("input", function () {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
});
|
||||
|
||||
// Sync slider with media volume (in case it's changed programmatically)
|
||||
mediaPlayer.addEventListener("volumechange", function () {
|
||||
volumeBar.value = mediaPlayer.volume;
|
||||
if (mediaPlayer.muted || mediaPlayer.volume === 0) {
|
||||
volumeBtn.textContent = "🔇";
|
||||
} else {
|
||||
volumeBtn.textContent = "🔊";
|
||||
}
|
||||
});
|
||||
|
||||
// Function to add subtitles dynamically (e.g., after URL input)
|
||||
function addSubtitles(url) {
|
||||
@ -40,8 +76,8 @@ function addSubtitles(url) {
|
||||
// Create a new track for subtitles
|
||||
const track = document.createElement('track');
|
||||
track.kind = 'subtitles';
|
||||
track.label = 'English';
|
||||
track.srclang = 'en';
|
||||
track.label = 'Español';
|
||||
track.srclang = 'es';
|
||||
track.src = url;
|
||||
|
||||
// Append the new track
|
||||
@ -76,7 +112,7 @@ submitSubtitlesBtn.addEventListener('click', () => {
|
||||
let loopEnabled = false;
|
||||
|
||||
// Handle submit URL button in custom dialog
|
||||
submitUrlBtn.addEventListener('click', () => {
|
||||
submitUrlBtn.addEventListener('click', async () => {
|
||||
let url = urlInput.value;
|
||||
|
||||
// Check if URL is a valid URL and doesn't contain "http" or "https"
|
||||
@ -85,41 +121,65 @@ submitUrlBtn.addEventListener('click', () => {
|
||||
url = 'http://' + url; // You can also choose 'https://' if preferred
|
||||
}
|
||||
|
||||
const { isHLS, isDASH } = await detectStreamType(url);
|
||||
|
||||
|
||||
if (url) {
|
||||
clearSubtitles();
|
||||
if (url.includes('.m3u8')) {
|
||||
if (hls !== null) {
|
||||
hls.destroy()
|
||||
hls = null
|
||||
window.hls = hls
|
||||
}
|
||||
if (player !== null) {
|
||||
player.reset()
|
||||
player = null
|
||||
window.dash = player
|
||||
}
|
||||
if (url.toLowerCase().endsWith('.m3u8') || url.toLowerCase().endsWith('.m3u') || isHLS) {
|
||||
// HLS stream
|
||||
if (Hls.isSupported()) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video playerz
|
||||
const hls = new Hls();
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
hls = new Hls();
|
||||
window.hls = hls
|
||||
mediaPlayer.pause();
|
||||
hls.loadSource(url);
|
||||
hls.attachMedia(mediaPlayer);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||||
mediaPlayer.play();
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
urlInput.value = "";
|
||||
customControls.style.display = 'flex';
|
||||
});
|
||||
window.hls = hls
|
||||
} else {
|
||||
alert("HLS isn't supported on your browser.");
|
||||
alert("Your device doesn't support HLS.");
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
}
|
||||
} else if (url.includes('.mpd')) {
|
||||
} else if (url.toLowerCase().endsWith('.mpd') || isDASH) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
const player = dashjs.MediaPlayer().create();
|
||||
player = dashjs.MediaPlayer().create();
|
||||
window.dash = player
|
||||
// MPEG-DASH stream
|
||||
player.initialize(mediaPlayer, url, true);
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
window.dash = player
|
||||
} else {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
mediaPlayer.src = url;
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
mediaPlayer.play();
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
}
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
dialogOverlay.style.display = 'none';
|
||||
@ -153,11 +213,30 @@ submitUrlBtn.addEventListener('click', () => {
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
mediaPlayer.addEventListener("volumechange", function () {
|
||||
if (mediaPlayer.muted) {
|
||||
volumeBtn.textContent = "🔇"
|
||||
} else if (mediaPlayer.volume === 0) {
|
||||
volumeBtn.textContent = "🔊"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
let previousObjectURL = null; // Store the last Object URL
|
||||
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
if (hls !== null) {
|
||||
hls.destroy()
|
||||
hls = null
|
||||
window.hls = hls
|
||||
}
|
||||
if (player !== null) {
|
||||
player.reset()
|
||||
player = null
|
||||
window.dash = player
|
||||
}
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
@ -171,7 +250,10 @@ submitUrlBtn.addEventListener('click', () => {
|
||||
// Create a new Object URL for the selected file
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
mediaPlayer.src = fileURL;
|
||||
mediaPlayer.load();
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
|
||||
// Store the new Object URL for future cleanup
|
||||
previousObjectURL = fileURL;
|
||||
@ -195,26 +277,26 @@ submitUrlBtn.addEventListener('click', () => {
|
||||
playPauseBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.paused) {
|
||||
mediaPlayer.play();
|
||||
playPauseBtn.textContent = 'Pause';
|
||||
playPauseBtn.textContent = 'Pausa';
|
||||
} else {
|
||||
mediaPlayer.pause();
|
||||
playPauseBtn.textContent = 'Play';
|
||||
playPauseBtn.textContent = 'Jugar';
|
||||
}
|
||||
});
|
||||
|
||||
// Sync button with the video player when it is paused manually
|
||||
mediaPlayer.addEventListener('pause', () => {
|
||||
playPauseBtn.textContent = 'Play';
|
||||
playPauseBtn.textContent = 'Jugar';
|
||||
});
|
||||
|
||||
// Sync button with the video player when it is played
|
||||
mediaPlayer.addEventListener('play', () => {
|
||||
playPauseBtn.textContent = 'Pause';
|
||||
playPauseBtn.textContent = 'Pausa';
|
||||
});
|
||||
|
||||
// Volume button toggling mute/unmute
|
||||
volumeBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.muted) {
|
||||
if (mediaPlayer.muted || mediaPlayer.volume == 0) {
|
||||
mediaPlayer.muted = false;
|
||||
volumeBtn.textContent = '🔊'; // Unmute icon
|
||||
} else {
|
||||
@ -223,6 +305,7 @@ volumeBtn.addEventListener('click', () => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Handle URL input on Enter key
|
||||
urlInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
@ -257,6 +340,11 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
// Handle volume
|
||||
volumeBar.addEventListener('input', () => {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
if (volumeBar.value == 0 || mediaPlayer.volume == 0) {
|
||||
volumeBtn.textContent = "🔇";
|
||||
} else {
|
||||
volumeBtn.textContent = "🔊";
|
||||
}
|
||||
});
|
||||
|
||||
// Show settings panel
|
||||
@ -265,17 +353,27 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
settingsPanel.style.display = 'block';
|
||||
});
|
||||
|
||||
// Save settings
|
||||
saveSettingsBtn.addEventListener('click', () => {
|
||||
autoplayEnabled = autoplayCheckbox.checked;
|
||||
loopEnabled = loopCheckbox.checked;
|
||||
mediaPlayer.autoplay = autoplayEnabled;
|
||||
mediaPlayer.loop = loopEnabled;
|
||||
|
||||
const controlsEnabled = document.getElementById('controlsCheckbox').checked;
|
||||
const colorsEnabled = document.getElementById('colorsCheckbox').checked;
|
||||
mediaPlayer.controls = controlsEnabled;
|
||||
if (colorsEnabled) {
|
||||
mediaPlayer.style.filter = "contrast(1.1) saturate(1.15) brightness(1.03)";
|
||||
} else {
|
||||
mediaPlayer.style.filter = "";
|
||||
}
|
||||
|
||||
settingsPanel.style.display = 'none';
|
||||
settingsDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
// End of first event listener for DOM content loaded
|
||||
|
||||
// Format time
|
||||
function formatTime(time) {
|
||||
@ -284,7 +382,9 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const showDialogBtn = document.getElementById('showDialogBtn');
|
||||
const hideDialogBtn = document.getElementById('hideDialogBtn');
|
||||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||
|
||||
// Show dialog
|
||||
showDialogBtn.addEventListener('click', () => {
|
||||
@ -305,6 +405,7 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// End of code and second event listener for DOM content loaded
|
||||
|
||||
});
|
@ -5,8 +5,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const enterUrlBtn = document.getElementById('enterUrlBtn');
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const mediaPlayer = document.getElementById('mediaPlayer');
|
||||
const showDialogBtn = document.getElementById('showDialogBtn');
|
||||
const hideDialogBtn = document.getElementById('hideDialogBtn');
|
||||
const playPauseBtn = document.getElementById('playPauseBtn');
|
||||
const seekBar = document.getElementById('seekBar');
|
||||
const timeDisplay = document.getElementById('timeDisplay');
|
||||
@ -16,49 +14,134 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const autoplayCheckbox = document.getElementById('autoplayCheckbox');
|
||||
const loopCheckbox = document.getElementById('loopCheckbox');
|
||||
const saveSettingsBtn = document.getElementById('saveSettingsBtn');
|
||||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||
const urlDialogOverlay = document.getElementById('urlDialogOverlay');
|
||||
const settingsDialogOverlay = document.getElementById('settingsDialogOverlay');
|
||||
const urlInput = document.getElementById('urlInput');
|
||||
const submitUrlBtn = document.getElementById('submitUrlBtn');
|
||||
const cancelUrlBtn = document.getElementById('cancelUrlBtn');
|
||||
const ccBtn = document.getElementById('ccBtn'); // CC button
|
||||
const volumeBtn = document.getElementById("volumeBtn")
|
||||
const subtitlesOverlay = document.getElementById('subtitlesOverlay');
|
||||
const subtitlesInput = document.getElementById('subtitlesInput');
|
||||
const submitSubtitlesBtn = document.getElementById('submitSubtitlesBtn');
|
||||
const cancelSubtitlesBtn = document.getElementById('cancelSubtitlesBtn');
|
||||
const customControls = document.getElementById('customControls');
|
||||
let hls = null
|
||||
let player = null
|
||||
window.hls = hls;
|
||||
window.dash = player;
|
||||
|
||||
// Function to add subtitles dynamically (e.g., after URL input)
|
||||
function addSubtitles(url) {
|
||||
// Remove any existing subtitle tracks
|
||||
async function detectStreamType(url) {
|
||||
try {
|
||||
const response = await fetch(url, { method: 'HEAD' });
|
||||
const contentType = response.headers.get('Content-Type') || '';
|
||||
|
||||
const isHLS = url.toLowerCase().endsWith('.m3u8') ||
|
||||
contentType.includes('application/vnd.apple.mpegurl') ||
|
||||
contentType.includes('application/x-mpegURL');
|
||||
|
||||
const isDASH = url.toLowerCase().endsWith('.mpd') ||
|
||||
contentType.includes('application/dash+xml');
|
||||
|
||||
return { isHLS, isDASH, contentType };
|
||||
} catch (err) {
|
||||
console.error("Failed to detect stream type:", err);
|
||||
return { isHLS: false, isDASH: false, contentType: null };
|
||||
}
|
||||
}
|
||||
|
||||
// Update media volume when the slider is moved
|
||||
volumeBar.addEventListener("input", function () {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
});
|
||||
|
||||
// Sync slider with media volume (in case it's changed programmatically)
|
||||
mediaPlayer.addEventListener("volumechange", function () {
|
||||
volumeBar.value = mediaPlayer.volume;
|
||||
if (mediaPlayer.muted || mediaPlayer.volume === 0) {
|
||||
volumeBtn.textContent = "🔇";
|
||||
} else {
|
||||
volumeBtn.textContent = "🔊";
|
||||
}
|
||||
});
|
||||
|
||||
async function addSubtitles(url) {
|
||||
// Remove existing tracks and revoke any previous blob URLs
|
||||
const existingTracks = mediaPlayer.getElementsByTagName('track');
|
||||
for (let track of existingTracks) {
|
||||
for (let i = existingTracks.length - 1; i >= 0; i--) {
|
||||
const track = existingTracks[i];
|
||||
if (track.src.startsWith('blob:')) URL.revokeObjectURL(track.src);
|
||||
track.remove();
|
||||
}
|
||||
|
||||
// Create a new track for subtitles
|
||||
// Fetch subtitle content
|
||||
let text = '';
|
||||
try {
|
||||
const res = await fetch(url);
|
||||
text = await res.text();
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch subtitles:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect format
|
||||
const firstLine = text.split(/\r?\n/)[0].trim();
|
||||
const format = firstLine.startsWith('WEBVTT') || url.toLowerCase().endsWith('.vtt') ? 'vtt' : 'srt';
|
||||
|
||||
// Determine track source
|
||||
let trackSrc = url;
|
||||
if (format === 'srt') {
|
||||
// Convert SRT → VTT
|
||||
text = 'WEBVTT\n\n' + text
|
||||
.replace(/\r+/g, '')
|
||||
.replace(/^\s+|\s+$/g, '')
|
||||
.split('\n')
|
||||
.map(line => line.replace(/(\d+):(\d+):(\d+),(\d+)/g, '$1:$2:$3.$4'))
|
||||
.join('\n');
|
||||
|
||||
// Create Blob URL for converted subtitles
|
||||
const blob = new Blob([text], { type: 'text/vtt' });
|
||||
trackSrc = URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
// Create and append track
|
||||
const track = document.createElement('track');
|
||||
track.kind = 'subtitles';
|
||||
track.label = 'English';
|
||||
track.srclang = 'en';
|
||||
track.src = url;
|
||||
|
||||
// Append the new track
|
||||
track.src = trackSrc;
|
||||
track.default = true;
|
||||
mediaPlayer.appendChild(track);
|
||||
|
||||
// Optionally, enable subtitles by default
|
||||
track.track.mode = 'showing'; // Enable subtitles by default
|
||||
// Force enable immediately
|
||||
setTimeout(() => {
|
||||
for (let t of mediaPlayer.textTracks) t.mode = 'disabled';
|
||||
track.track.mode = 'showing';
|
||||
}, 50);
|
||||
}
|
||||
|
||||
// Handle submit subtitle URL
|
||||
|
||||
|
||||
/*// Handle submit subtitle URL
|
||||
function clearSubtitles() {
|
||||
const tracks = mediaPlayer.getElementsByTagName('track');
|
||||
for (let i = tracks.length - 1; i >= 0; i--) {
|
||||
tracks[i].remove();
|
||||
}
|
||||
}*/
|
||||
|
||||
function clearSubtitles() {
|
||||
const tracks = mediaPlayer.getElementsByTagName('track');
|
||||
for (let i = tracks.length - 1; i >= 0; i--) {
|
||||
const track = tracks[i];
|
||||
if (track.src.startsWith('blob:')) {
|
||||
URL.revokeObjectURL(track.src); // free memory leaks from SRT to VTT converted subtitles
|
||||
}
|
||||
track.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Use this function when a new video is loaded
|
||||
|
||||
submitSubtitlesBtn.addEventListener('click', () => {
|
||||
@ -76,7 +159,7 @@ submitSubtitlesBtn.addEventListener('click', () => {
|
||||
let loopEnabled = false;
|
||||
|
||||
// Handle submit URL button in custom dialog
|
||||
submitUrlBtn.addEventListener('click', () => {
|
||||
submitUrlBtn.addEventListener('click', async () => {
|
||||
let url = urlInput.value;
|
||||
|
||||
// Check if URL is a valid URL and doesn't contain "http" or "https"
|
||||
@ -85,41 +168,65 @@ submitUrlBtn.addEventListener('click', () => {
|
||||
url = 'http://' + url; // You can also choose 'https://' if preferred
|
||||
}
|
||||
|
||||
const { isHLS, isDASH } = await detectStreamType(url);
|
||||
|
||||
|
||||
if (url) {
|
||||
clearSubtitles();
|
||||
if (url.includes('.m3u8')) {
|
||||
if (hls !== null) {
|
||||
hls.destroy()
|
||||
hls = null
|
||||
window.hls = hls
|
||||
}
|
||||
if (player !== null) {
|
||||
player.reset()
|
||||
player = null
|
||||
window.dash = player
|
||||
}
|
||||
if (url.toLowerCase().endsWith('.m3u8') || url.toLowerCase().endsWith('.m3u') || isHLS) {
|
||||
// HLS stream
|
||||
if (Hls.isSupported()) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
const hls = new Hls();
|
||||
hls = new Hls();
|
||||
window.hls = hls
|
||||
mediaPlayer.pause();
|
||||
hls.loadSource(url);
|
||||
hls.attachMedia(mediaPlayer);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||||
mediaPlayer.play();
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
urlInput.value = "";
|
||||
customControls.style.display = 'flex';
|
||||
});
|
||||
window.hls = hls
|
||||
} else {
|
||||
alert("HLS isn't supported on your browser.");
|
||||
alert("Your device doesn't support HLS.");
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
}
|
||||
} else if (url.includes('.mpd')) {
|
||||
} else if (url.toLowerCase().endsWith('.mpd') || isDASH) {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
const player = dashjs.MediaPlayer().create();
|
||||
player = dashjs.MediaPlayer().create();
|
||||
window.dash = player
|
||||
// MPEG-DASH stream
|
||||
player.initialize(mediaPlayer, url, true);
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
window.dash = player
|
||||
} else {
|
||||
mediaPlayer.style.display = 'flex'; // Hide the native video player
|
||||
mediaPlayer.pause();
|
||||
mediaPlayer.src = url;
|
||||
customControls.style.display = 'flex';
|
||||
urlInput.value = "";
|
||||
mediaPlayer.play();
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
}
|
||||
urlDialogOverlay.style.display = 'none';
|
||||
dialogOverlay.style.display = 'none';
|
||||
@ -153,11 +260,31 @@ submitUrlBtn.addEventListener('click', () => {
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
mediaPlayer.addEventListener("volumechange", function () {
|
||||
if (mediaPlayer.muted) {
|
||||
volumeBtn.textContent = "🔇"
|
||||
} else if (mediaPlayer.volume === 0) {
|
||||
volumeBtn.textContent = "🔊"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
let previousObjectURL = null; // Store the last Object URL
|
||||
window.objectURL = previousObjectURL
|
||||
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
if (hls !== null) {
|
||||
hls.destroy()
|
||||
hls = null
|
||||
window.hls = hls
|
||||
}
|
||||
if (player !== null) {
|
||||
player.reset()
|
||||
player = null
|
||||
window.dash = player
|
||||
}
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
@ -166,15 +293,25 @@ submitUrlBtn.addEventListener('click', () => {
|
||||
// Revoke the previous Object URL if it exists
|
||||
if (previousObjectURL) {
|
||||
URL.revokeObjectURL(previousObjectURL);
|
||||
window.objectURL = previousObjectURL
|
||||
}
|
||||
|
||||
// Revoke previous file picker Object URL
|
||||
if (window.previousDropURL) {
|
||||
URL.revokeObjectURL(window.previousDropURL);
|
||||
}
|
||||
|
||||
// Create a new Object URL for the selected file
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
mediaPlayer.src = fileURL;
|
||||
mediaPlayer.load();
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaPlayer.play();
|
||||
}
|
||||
|
||||
// Store the new Object URL for future cleanup
|
||||
previousObjectURL = fileURL;
|
||||
fileInput.value = "";
|
||||
|
||||
// Hide dialog after selecting a file
|
||||
dialogOverlay.style.display = 'none';
|
||||
@ -214,7 +351,7 @@ mediaPlayer.addEventListener('play', () => {
|
||||
|
||||
// Volume button toggling mute/unmute
|
||||
volumeBtn.addEventListener('click', () => {
|
||||
if (mediaPlayer.muted) {
|
||||
if (mediaPlayer.muted || mediaPlayer.volume == 0) {
|
||||
mediaPlayer.muted = false;
|
||||
volumeBtn.textContent = '🔊'; // Unmute icon
|
||||
} else {
|
||||
@ -223,6 +360,7 @@ volumeBtn.addEventListener('click', () => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Handle URL input on Enter key
|
||||
urlInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
@ -257,6 +395,11 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
// Handle volume
|
||||
volumeBar.addEventListener('input', () => {
|
||||
mediaPlayer.volume = volumeBar.value;
|
||||
if (volumeBar.value == 0 || mediaPlayer.volume == 0) {
|
||||
volumeBtn.textContent = "🔇";
|
||||
} else {
|
||||
volumeBtn.textContent = "🔊";
|
||||
}
|
||||
});
|
||||
|
||||
// Show settings panel
|
||||
@ -265,17 +408,27 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
settingsPanel.style.display = 'block';
|
||||
});
|
||||
|
||||
// Save settings
|
||||
saveSettingsBtn.addEventListener('click', () => {
|
||||
autoplayEnabled = autoplayCheckbox.checked;
|
||||
loopEnabled = loopCheckbox.checked;
|
||||
mediaPlayer.autoplay = autoplayEnabled;
|
||||
mediaPlayer.loop = loopEnabled;
|
||||
|
||||
const controlsEnabled = document.getElementById('controlsCheckbox').checked;
|
||||
const colorsEnabled = document.getElementById('colorsCheckbox').checked;
|
||||
mediaPlayer.controls = controlsEnabled;
|
||||
if (colorsEnabled) {
|
||||
mediaPlayer.style.filter = "contrast(1.1) saturate(1.15) brightness(1.03)";
|
||||
} else {
|
||||
mediaPlayer.style.filter = "";
|
||||
}
|
||||
|
||||
settingsPanel.style.display = 'none';
|
||||
settingsDialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
// End of first event listener for DOM content loaded
|
||||
|
||||
// Format time
|
||||
function formatTime(time) {
|
||||
@ -284,7 +437,9 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const showDialogBtn = document.getElementById('showDialogBtn');
|
||||
const hideDialogBtn = document.getElementById('hideDialogBtn');
|
||||
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
||||
|
||||
// Show dialog
|
||||
showDialogBtn.addEventListener('click', () => {
|
||||
@ -305,6 +460,7 @@ subtitlesInput.addEventListener('keydown', (e) => {
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// End of code and second event listener for DOM content loaded
|
||||
|
||||
});
|
||||
|
@ -1,6 +1,11 @@
|
||||
const { contextBridge, ipcRenderer } = require("electron");
|
||||
|
||||
contextBridge.exposeInMainWorld("electron", {
|
||||
send: (channel, data) => ipcRenderer.send(channel, data),
|
||||
receive: (channel, callback) => ipcRenderer.on(channel, (event, ...args) => callback(...args)),
|
||||
receive: (channel, callback) => {
|
||||
const validChannels = ["play-media", "load-addon", "unload-addon"];
|
||||
if (validChannels.includes(channel)) {
|
||||
ipcRenderer.removeAllListeners(channel); // Prevent multiple callbacks
|
||||
ipcRenderer.on(channel, (_event, ...args) => callback(...args));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -1,17 +1,200 @@
|
||||
// Listen for media file path from main process
|
||||
window.electron.receive("play-media", (filePath) => {
|
||||
loadMedia(filePath);
|
||||
});
|
||||
let mediaElement = document.getElementById("mediaPlayer");
|
||||
|
||||
// Function to load and play media file
|
||||
function loadMedia(filePath) {
|
||||
|
||||
function loadMedia(fileURL) {
|
||||
dialogOverlay.style.display = 'none';
|
||||
const mediaElement = document.getElementById("mediaPlayer");
|
||||
|
||||
mediaElement.oncanplay = null;
|
||||
|
||||
if (mediaElement) {
|
||||
mediaElement.src = `file://${filePath}`; // ✅ Convert file path to a valid URL
|
||||
if (autoplayCheckbox && autoplayCheckbox.checked) {
|
||||
mediaElement.play();
|
||||
}
|
||||
mediaElement.src = fileURL; // ✅ Safe, properly encoded URL
|
||||
mediaElement.oncanplay = () => {
|
||||
if (autoplayCheckbox && autoplayCheckbox.checked) {
|
||||
mediaElement.play().catch(error => console.warn("Playback issue:", error));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const dropArea = document.createElement('div');
|
||||
dropArea.style.position = 'fixed';
|
||||
dropArea.style.top = '0';
|
||||
dropArea.style.left = '0';
|
||||
dropArea.style.width = '100vw';
|
||||
dropArea.style.height = '100vh';
|
||||
dropArea.style.display = 'none'; // hidden by default
|
||||
dropArea.style.zIndex = '0'; // behind everything
|
||||
dropArea.style.opacity = '0'; // invisible
|
||||
document.body.appendChild(dropArea);
|
||||
|
||||
let dragCounter = 0; // track nested dragenter/dragleave events
|
||||
|
||||
|
||||
window.addEventListener('dragenter', (e) => {
|
||||
if (e.dataTransfer.types.includes('Files')) {
|
||||
dragCounter++;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('dragleave', (e) => {
|
||||
if (e.dataTransfer.types.includes('Files')) {
|
||||
dragCounter--;
|
||||
if (dragCounter <= 0) dragCounter = 0;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('dragover', (e) => {
|
||||
if (e.dataTransfer.types.includes('Files')) {
|
||||
e.preventDefault(); // allow drop
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
let previousDropURL = null; // Store last Object URL
|
||||
window.previousDropURL = previousDropURL
|
||||
|
||||
window.addEventListener('drop', e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const file = e.dataTransfer.files[0];
|
||||
if (!file) return;
|
||||
|
||||
// Destroy existing HLS/DASH instances if they exist
|
||||
if (window.hls) {
|
||||
window.hls.destroy();
|
||||
window.hls = null;
|
||||
}
|
||||
if (window.dash) {
|
||||
window.dash.reset();
|
||||
window.dash = null;
|
||||
}
|
||||
|
||||
// Clear previously loaded subtitles
|
||||
const tracks = mediaElement.getElementsByTagName('track');
|
||||
for (let i = tracks.length - 1; i >= 0; i--) {
|
||||
tracks[i].remove();
|
||||
}
|
||||
|
||||
// Revoke previous Object URL
|
||||
if (previousDropURL) {
|
||||
URL.revokeObjectURL(previousDropURL);
|
||||
window.previousDropURL = previousDropURL;
|
||||
}
|
||||
|
||||
// Revoke previous file picker Object URL
|
||||
if (window.objectURL) {
|
||||
URL.revokeObjectURL(window.objectURL);
|
||||
}
|
||||
|
||||
// Create a new Object URL
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
mediaElement.src = fileURL;
|
||||
|
||||
mediaElement.load();
|
||||
// Autoplay if checkbox is checked
|
||||
if (autoplayCheckbox.checked) {
|
||||
mediaElement.play().catch(err => console.warn(err));
|
||||
}
|
||||
|
||||
// Store for future cleanup
|
||||
previousDropURL = fileURL;
|
||||
|
||||
// Hide file dialog if applicable
|
||||
if (dialogOverlay) dialogOverlay.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Handle submit subtitle URL
|
||||
function clearSubtitles() {
|
||||
const tracks = mediaElement.getElementsByTagName('track');
|
||||
for (let i = tracks.length - 1; i >= 0; i--) {
|
||||
tracks[i].remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Validate media URL
|
||||
function isSafeURL(fileURL) {
|
||||
try {
|
||||
const url = new URL(fileURL);
|
||||
return url.protocol === "file:";
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Load addon script dynamically
|
||||
function loadAddon(fileURL) {
|
||||
// Avoid duplicate scripts
|
||||
if (document.querySelector(`script[data-addon="${fileURL}"]`)) return;
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.src = fileURL;
|
||||
script.type = 'text/javascript';
|
||||
script.async = false; // optional, depends on your needs
|
||||
script.setAttribute('data-addon', fileURL);
|
||||
|
||||
document.head.appendChild(script);
|
||||
|
||||
console.log(`addon loaded: ${fileURL}`)
|
||||
alert("Addon loaded successfully");
|
||||
}
|
||||
|
||||
// Unload addon script by removing the <script> tag
|
||||
function unloadAddon(fileURL) {
|
||||
const script = document.querySelector(`script[data-addon="${fileURL}"]`);
|
||||
if (script) {
|
||||
script.remove();
|
||||
console.log(`addon unloaded: ${fileURL}`)
|
||||
alert("Addon unloaded successfully");
|
||||
} else {
|
||||
console.warn(`No addon script found for: ${fileURL}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ✅ Listen for events from main process securely
|
||||
window.electron.receive("play-media", (fileURL) => {
|
||||
if (isSafeURL(fileURL)) {
|
||||
clearSubtitles()
|
||||
if (window.hls) {
|
||||
window.hls.destroy()
|
||||
window.hls = null
|
||||
}
|
||||
if (window.dash) {
|
||||
window.dash.reset()
|
||||
window.dash = null
|
||||
}
|
||||
loadMedia(fileURL);
|
||||
} else {
|
||||
console.warn("Blocked unsafe media URL:", fileURL);
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for load-addon message
|
||||
window.electron.receive("load-addon", (fileURL) => {
|
||||
if (isSafeURL(fileURL)) {
|
||||
loadAddon(fileURL);
|
||||
} else {
|
||||
console.warn("Blocked unsafe script URL:", fileURL);
|
||||
alert("There was an issue loading your addon: it may be unsafe");
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for unload-addon message
|
||||
window.electron.receive("unload-addon", (fileURL) => {
|
||||
unloadAddon(fileURL);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -8,7 +8,11 @@
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Inter-header", Arial, sans-serif;
|
||||
font-family: "Inter-header", Arial, sans-serif !important;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: "Inter", Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
@ -127,7 +131,8 @@ h1 {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
video, iframe {
|
||||
video {
|
||||
/* To make color pop: filter: contrast(1.1) saturate(1.2);*/
|
||||
display: flex;
|
||||
margin: 20px auto;
|
||||
background: black;
|
||||
@ -137,14 +142,17 @@ h1 {
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.gap-box {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.settings-info {
|
||||
font-size: 0.85em;
|
||||
color: #888;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#showDialogBtn {
|
||||
margin: 10px 5px;
|
||||
padding: 10px 20px;
|
||||
|
83
simpliplay/updateChecker.js
Normal file
83
simpliplay/updateChecker.js
Normal file
@ -0,0 +1,83 @@
|
||||
const https = require('https');
|
||||
const { URL } = require('url');
|
||||
const { dialog, shell } = require('electron');
|
||||
|
||||
const latestReleaseUrl = 'https://github.com/A-Star100/simpliplay-desktop/releases/latest/';
|
||||
|
||||
function fetchRedirectLocation(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
https.get(url, (res) => {
|
||||
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
||||
resolve(res.headers.location);
|
||||
} else {
|
||||
reject(new Error(`Expected redirect but got status code: ${res.statusCode}`));
|
||||
}
|
||||
}).on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
function normalizeVersion(version) {
|
||||
return version.trim().replace(/[^\d\.]/g, '');
|
||||
}
|
||||
|
||||
function compareVersions(v1, v2) {
|
||||
const a = v1.split('.').map(Number);
|
||||
const b = v2.split('.').map(Number);
|
||||
const len = Math.max(a.length, b.length);
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
const num1 = a[i] || 0;
|
||||
const num2 = b[i] || 0;
|
||||
if (num1 > num2) return 1;
|
||||
if (num1 < num2) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for update and shows native dialog if update is available.
|
||||
* @param {string} currentVersion
|
||||
*/
|
||||
async function checkForUpdate(currentVersion) {
|
||||
try {
|
||||
const redirectUrl = await fetchRedirectLocation(latestReleaseUrl);
|
||||
|
||||
const urlObj = new URL(redirectUrl);
|
||||
const parts = urlObj.pathname.split('/');
|
||||
|
||||
const releaseTag = parts[parts.length - 1];
|
||||
const versionMatch = releaseTag.match(/release-([\d\.]+)/);
|
||||
if (!versionMatch) {
|
||||
throw new Error(`Could not parse version from release tag: ${releaseTag}`);
|
||||
}
|
||||
const latestVersion = normalizeVersion(versionMatch[1]);
|
||||
|
||||
const cmp = compareVersions(latestVersion, currentVersion);
|
||||
|
||||
if (cmp > 0) {
|
||||
const result = dialog.showMessageBoxSync({
|
||||
type: 'info',
|
||||
buttons: ['Download', 'Later'],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
title: 'Update Available',
|
||||
message: `A new version (${latestVersion}) is available. Would you like to download it?`,
|
||||
});
|
||||
|
||||
if (result === 0) {
|
||||
shell.openExternal("https://simpliplay.netlify.app/#download-options");
|
||||
}
|
||||
} else {
|
||||
dialog.showMessageBoxSync({
|
||||
type: 'info',
|
||||
buttons: ['OK'],
|
||||
title: "You're up to date!",
|
||||
message: `You are using the latest version (${currentVersion}).`,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
dialog.showErrorBox('Could not check for update.', err.message);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { checkForUpdate };
|
Loading…
Reference in New Issue
Block a user