Compare commits

..

232 Commits
1.0.0 ... 1.4.0

Author SHA1 Message Date
0690e1551b ci: add new argument release to release workflow 2025-04-10 04:34:04 -07:00
d1a7460c05 chore: update icon colors 2025-04-10 03:45:00 -07:00
70e349d7e3 chore: update health animation 2025-04-10 03:39:28 -07:00
568c3fc219 chore: add health check template var healthTimer 2025-04-10 03:00:04 -07:00
f55ecae8f3 feat: add heartbeat animation to header health icon 2025-04-10 02:56:39 -07:00
e4436ad7b7 feat: add healthcheck countdown as tooltip to header icon 2025-04-10 02:25:58 -07:00
67d7019a93 refactor: restyle console logs, add new api endpoints 2025-04-10 02:25:32 -07:00
4b45c0a2a2 feat: add release category to template 2025-04-10 02:22:38 -07:00
b3aae7b837 feat: add bootstrap tooltips 2025-04-10 02:19:48 -07:00
122286bd7b build: bump to v1.4.0 2025-04-10 02:17:58 -07:00
6708bb17a3 chore: set resync icon to continue animation until page refreshes 2025-04-09 09:12:23 -07:00
5fa7cd9d85 feat: new health api check every 10 minutes with toast notification to user 2025-04-09 09:00:33 -07:00
25ac27dd64 feat: add toast notifications 2025-04-09 09:00:12 -07:00
a659e03512 build: add new env variable HEALTH_TIMER
allows you to specify how often a health check is done
2025-04-09 08:59:38 -07:00
4d081adda2 docs(readme): update env definition 2025-04-08 18:08:41 -07:00
279d48d8ee feat: add api/health, json responses with info about each message thrown 2025-04-08 15:30:33 -07:00
c017578631 feat: add healthcheck api endpoint 2025-04-08 13:12:59 -07:00
f4baade73b build: create two new system env variables on app startup 2025-04-08 11:37:58 -07:00
f68053b461 build: add package express for webserver replacement 2025-04-08 10:00:16 -07:00
ec18ceb6db feat: add ability to restart / resync m3u playlist and epg guide data 2025-04-08 09:52:30 -07:00
68c4778ed8 refactor: rename vars with tar to gzp 2025-04-08 07:47:24 -07:00
cf28156e70 feat: new restart api route returns json 2025-04-08 07:46:32 -07:00
149fe89f89 build: add bootstrap v5.x 2025-04-08 07:41:50 -07:00
c124d93285 feat: add re-sync functionality / button to header 2025-04-08 03:21:46 -07:00
06e5d42c9c chore: update jellyfin accept-encoding comment block 2025-04-08 01:52:35 -07:00
c42b60a58c chore: add comment to new jellyfin encoding fix 2025-04-08 01:50:59 -07:00
1e8bdcddd8 fix: add header-encoding env variable to fix gzip compression for jellyfin xml grab
If gzip compression is enabled for the tvapp2 webserver, this may cause Jellyfin to fail when fetching newest xml guide data.

to correct this, we create an env variable which allows us to disable gzip compression for `Accept-Encoding`
2025-04-08 01:44:17 -07:00
90c2295bb8 docs(readme): update build version for commands 2025-04-08 00:57:41 -07:00
cca7b48d3b docs(readme): update build commands 2025-04-08 00:52:24 -07:00
2d9dec2d74 build: update package files 2025-04-08 00:20:51 -07:00
30741f124e refactor: update error logs 2025-04-08 00:17:01 -07:00
f256a9db06 Merge remote-tracking branch 'origin/main' 2025-04-07 23:01:27 -07:00
baf850308f fix: source 1 and 2 broken for streams 2025-04-07 23:01:12 -07:00
renovate[bot]
d9174d2a20 chore(deps): lock file maintenance (#44)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-07 07:27:00 +00:00
a5dad1e7bb docs(readme): update env variable list 2025-04-05 08:55:16 -07:00
aa4278e7a7 style: rename env variable FILE_PLAYLIST to FILE_M3U 2025-04-05 08:54:25 -07:00
4dfff72a9c build(dockerfile): add new env vars FILE_TAR and FILE_URL 2025-04-05 08:53:11 -07:00
624b24b1be build: bump app to v.1.2.0 2025-04-05 08:47:32 -07:00
c14f035147 refactor: m3u and epg files now stored in www folder 2025-04-05 08:41:14 -07:00
2d787f458d fix: html template links pointing to old repo 2025-04-05 08:40:13 -07:00
9169e5177e build: bump to v1.1.1 2025-04-05 07:25:36 -07:00
077c63d793 Merge remote-tracking branch 'origin/main' 2025-04-05 07:23:49 -07:00
2696fe05d4 feat: add support for additional mime types and default file type 2025-04-05 07:23:31 -07:00
3d042a3739 Merge pull request #37 from TheBinaryNinja/renovate/user-agents-1.x-lockfile
fix(deps): update dependency user-agents to v1.1.497
2025-04-02 10:21:05 -07:00
renovate[bot]
ad57bc5f78 fix(deps): update dependency user-agents to v1.1.497 2025-04-02 11:45:47 +00:00
renovate[bot]
5f2bb97d65 chore(deps): lock file maintenance (#41)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-31 07:37:16 +00:00
d9cb0edebe docs: update env variables 2025-03-28 14:02:49 -07:00
56c2bb2e4c ci: update documentation dependencies installed 2025-03-28 13:59:30 -07:00
3326468637 docs(mkdocs): add page: environment variables 2025-03-28 13:57:49 -07:00
23eeccb5e4 docs: add package external-markdown 2025-03-28 13:38:07 -07:00
7cd8e4af9b docs(changelog): update 2025-03-28 13:34:53 -07:00
a14aa856ab docs(mkdocs): update 2025-03-28 12:03:53 -07:00
d80d5e37c0 docs(mkdocs): update about.me 2025-03-26 06:53:04 -07:00
60c6924870 docs: add version alias 2025-03-26 05:01:23 -07:00
c3871cd542 docs: update 2025-03-26 04:56:44 -07:00
585051e324 Deployed 77d2252 to latest with MkDocs 1.6.1 and mike 2.1.3 2025-03-26 04:43:06 -07:00
77d22521c0 ci: update documentation workflow 2025-03-26 04:12:49 -07:00
5f1f9f7fff docs(mkdocs): update batch script 2025-03-26 04:05:08 -07:00
f8a2bdd464 ci: update .editorconfig headers 2025-03-26 02:21:29 -07:00
6e0c6c6ce0 ci: update contributors 2025-03-26 02:17:49 -07:00
8fd37af0d3 docs: update documentation 2025-03-26 02:12:57 -07:00
8f71f8195e docs(contributing): add package snippet to doc 2025-03-26 01:54:44 -07:00
1c75f11e9f docs(contributing): add new file 2025-03-26 01:44:20 -07:00
711f6b59f3 build(package): update build commands 2025-03-25 22:12:05 -07:00
568158484e ci: add npm run lint to release workflow process 2025-03-25 19:50:27 -07:00
81d17dd982 build(package): add new npm run lint command 2025-03-25 19:30:49 -07:00
07b34a7650 build(lint): update linting ignore list 2025-03-25 19:30:12 -07:00
10da0f4980 docs(readme): refactor keywords with icons 2025-03-25 18:40:41 -07:00
02591c5cff docs(readme): add development release screenshot and example 2025-03-25 17:59:05 -07:00
1675b9b751 docs(readme): update instructions for building docker container 2025-03-25 17:33:08 -07:00
6bf0c45277 docs(readme): update docker build instructions for new method 2025-03-25 15:55:20 -07:00
a76543d7a7 ci: clean up release workflow 2025-03-25 14:24:48 -07:00
e6d4cb7e4f ci: update release workflow summary 2025-03-25 14:13:52 -07:00
d567ea4517 ci: update release workflow output summary 2025-03-25 14:09:36 -07:00
424a4efb7a ci: update release workflow step to output changelogs 2025-03-25 14:05:23 -07:00
03d863f5e7 ci: update workflow env variables 2025-03-25 14:01:52 -07:00
820f770619 ci: update workflows 2025-03-25 13:59:57 -07:00
b6d5505c2d ci: fix variables 2025-03-25 13:53:11 -07:00
6af347f5d2 ci: modify workflow internal env management 2025-03-25 13:51:48 -07:00
eb0f7a5a72 ci: output workflow release changelogs 2025-03-25 13:32:49 -07:00
01415e13d5 ci: update env variables for release workflow 2025-03-25 13:26:55 -07:00
9329a3a032 ci: update release workflow 2025-03-25 12:43:20 -07:00
e857bfee03 fix: correct uuidv5 call for cjs to esm 2025-03-25 11:07:28 -07:00
7e71ff5e37 docs(readme): update env variables 2025-03-25 00:45:38 -07:00
bc629d6384 docs(readme): add screenshot 2025-03-25 00:42:30 -07:00
21d1c8bacf refactor: set primary gzip keyword to /gzip 2025-03-25 00:28:01 -07:00
f086e806df feat: add multiple url subpath keywords for assets 2025-03-25 00:27:23 -07:00
fdd9093f49 feat: change gzip compression from tar package to zlib 2025-03-24 23:27:02 -07:00
7fad9689c6 build(package): remove package tar 2025-03-24 23:26:10 -07:00
2b2795b7dd chore: remove fonts.min.css 2025-03-24 23:25:37 -07:00
fab2bc636a fix: initialization steps should wait on tar.gz promise to continue 2025-03-24 02:01:03 -07:00
f0237eb488 feat: add favicon; support for binary data 2025-03-24 00:01:48 -07:00
1160f43820 feat: add documentation icon to header of web ui 2025-03-23 22:57:09 -07:00
d7b2e338d9 feat: report human readable date in filelist for file mtime 2025-03-23 22:56:42 -07:00
2d61f8516d build(package): add documentation url 2025-03-23 22:55:54 -07:00
7c1483184a refactor: set header icons font-size clamp smaller 2025-03-23 22:55:32 -07:00
5f03e374d4 build(package): add new package moment.js 2025-03-23 22:41:41 -07:00
d391676a8e refactor: decrease font-size clamp maximum 2025-03-23 22:40:46 -07:00
25ed3c38e7 chore: removal of fonts.min.css - no longer needed 2025-03-23 22:38:03 -07:00
37195341c5 build: ensure app only installs production dependencies on docker deployment 2025-03-23 21:12:10 -07:00
6f0602f49b Merge remote-tracking branch 'origin/main' 2025-03-23 21:11:12 -07:00
b163dff842 feat: add filesize to list of files hosted in app 2025-03-23 21:10:07 -07:00
renovate[bot]
439b706060 chore(deps): lock file maintenance (#40)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-24 01:45:40 +00:00
44f7f8c6c2 refactor: variable names for xml and m3u 2025-03-23 18:44:06 -07:00
075303e9b6 feat: add xml.tar.gz compression during startup 2025-03-23 18:43:01 -07:00
62da08860d refactor: rename envFileEPG to envFileXML; add env var to rename 2025-03-23 05:31:51 -07:00
a6abfcde90 feat: add ejs template system 2025-03-23 03:57:23 -07:00
9f394e84cb chore: add debug logs 2025-03-23 03:36:53 -07:00
e0062d181d feat: add new template folder www 2025-03-23 03:27:00 -07:00
bc0ed61e1a build: update packages 2025-03-23 03:22:41 -07:00
6965d2eaa4 chore: template html migrated to independent file 2025-03-23 03:22:06 -07:00
016751ddbd chore: update script stylesheets 2025-03-23 03:21:23 -07:00
06bf294f8a feat: add new template system; index.html 2025-03-23 03:20:43 -07:00
23f2726ff8 build: add eslint flat config 2025-03-23 03:14:58 -07:00
9e54446f44 build: convert root.js from CJS to ESM 2025-03-23 03:14:21 -07:00
811380215a fix: viewport resizing on table content fitting screen 2025-03-22 05:51:56 -07:00
b4675dac70 style: minor edits to text ordering 2025-03-22 05:24:21 -07:00
d4df854820 feat: add link to xml, epg in new filelist table 2025-03-22 05:23:49 -07:00
94a55d5922 ci: update workflow 2025-03-22 01:29:23 -07:00
02f5d5e7d9 ci: test workflow build 2025-03-22 01:06:16 -07:00
f8ce387f4f ci: update workflow action docker/build-push-action network 2025-03-21 23:47:04 -07:00
8e01deba82 build: bump tvapp2 to v1.1.0 2025-03-21 13:57:33 -07:00
5dbf387bf0 docs(readme): add env vars to table 2025-03-21 05:10:56 -07:00
8a13954718 docs(readme): document newly added env variables 2025-03-21 04:50:18 -07:00
a05c4d3684 build(dockerfile): add new env variables 2025-03-21 04:50:00 -07:00
a6543fdc28 chore: set env LOG_LEVEL default to 4 2025-03-21 04:49:38 -07:00
23d4d523d6 chore: change css stylesheet for header 2025-03-21 04:16:00 -07:00
b6a8bb2e66 fix: make sure localhost warning box does not show if hidden 2025-03-21 03:09:09 -07:00
dea4a21f92 feat: new dark theme for webserver page 2025-03-21 02:16:36 -07:00
074fbe67d8 chore: remove cjs require in favor of new esm import method 2025-03-21 02:16:08 -07:00
eee25769c8 fix: add default value for env variable if running locally 2025-03-21 02:14:56 -07:00
cbef38f970 feat: add new env variable STREAM_QUALITY 2025-03-21 02:14:05 -07:00
03ab50f557 feat: add new env variables: FILE_PLAYLIST and FILE_EPG 2025-03-21 02:12:10 -07:00
6b88664db0 fix: server unable to be started via localhost; server ip var invalid 2025-03-21 02:09:58 -07:00
ceafd71461 feat: add new logging method; add env LOG_LEVEL 2025-03-21 02:09:07 -07:00
614a0a2daf build: convert code from CJS to ESM 2025-03-21 01:59:26 -07:00
e6bde3e0de chore: add tvapp2.min.js javascript 2025-03-20 20:05:54 -07:00
50c724869e chore: add tvapp2.min.css stylesheet 2025-03-20 20:01:44 -07:00
b595aa09a5 build(package): add type module for node esm 2025-03-20 19:08:31 -07:00
7e68e55ae6 build(dockerfile): fix arg ARCH being defined after initial pull 2025-03-20 19:06:42 -07:00
1a423d0def Merge pull request #36 from TheBinaryNinja/renovate/user-agents-1.x-lockfile
fix(deps): update dependency user-agents to v1.1.484
2025-03-20 00:41:36 -07:00
renovate[bot]
e107475252 fix(deps): update dependency user-agents to v1.1.484 2025-03-20 06:50:02 +00:00
667b260aff Merge pull request #32 from TheBinaryNinja/renovate/playwright-monorepo
fix(deps): update dependency playwright to v1.51.1
2025-03-19 10:18:03 -07:00
4036117d6c Merge pull request #35 from TheBinaryNinja/renovate/user-agents-1.x-lockfile
fix(deps): update dependency user-agents to v1.1.483
2025-03-19 10:17:33 -07:00
renovate[bot]
83ee35b9ae fix(deps): update dependency user-agents to v1.1.483 2025-03-19 12:33:41 +00:00
9cca602585 build: add healthcheck to docker-compose.yml 2025-03-17 22:59:31 -07:00
05944d284e build: bump base to alpine:3.21; add platform parameter 2025-03-17 22:36:28 -07:00
b8d6e4f538 ci: style workflows 2025-03-17 19:30:01 -07:00
a45541f0b9 ci: update workflow commenting 2025-03-17 18:49:10 -07:00
d836665df3 ci: minor refactoring of comment blocks to workflow issues-scan 2025-03-17 17:56:06 -07:00
21cb2a90c8 ci: add name to main job in workflow issues-scan 2025-03-17 17:54:11 -07:00
renovate[bot]
259f0a1fe1 fix(deps): update dependency playwright to v1.51.1 2025-03-18 00:44:02 +00:00
731ca00390 ci: update issues-scan workflow for compatibility with renovate bot 2025-03-17 17:42:42 -07:00
c938f7a212 ci: add debugging to github workflows 2025-03-17 16:32:13 -07:00
b11f85caf5 ci: add debugging for js context 2025-03-17 16:25:50 -07:00
0e0eefba2b ci: fix workflow pr issue 2025-03-17 16:22:03 -07:00
06cbd4663c ci: list existing labels for workflow 2025-03-17 12:57:56 -07:00
a578677137 ci: update labels for workflow 2025-03-17 12:52:26 -07:00
e5cecbac54 ci: get existing labels in workflow 2025-03-17 12:48:16 -07:00
42597e0652 ci: update issues-scan workflow 2025-03-17 12:39:39 -07:00
8ccd339d05 ci: change package manager node to nodenv 2025-03-17 12:22:48 -07:00
54afd779b3 ci: add node manager to renovate config 2025-03-17 12:19:33 -07:00
f83ef42653 ci: update renovate labels for packageRules 2025-03-17 12:11:47 -07:00
dc36741c72 ci: update renovate rangeStrategy to auto 2025-03-17 12:08:03 -07:00
2ec3b6ed19 ci: update renovate rangeStrategy to pin 2025-03-17 12:07:14 -07:00
77ae969d28 docs(readme): update expired discord invite link #8 2025-03-17 11:41:26 -07:00
f8bf7afbe2 ci: disable updatePinnedDependencies on renovate 2025-03-17 03:40:19 -07:00
aa61eeec34 ci: add gitAuthor to renovate 2025-03-17 03:35:12 -07:00
7cdb4b9109 ci: enable forkProcessing in renovate 2025-03-17 03:32:09 -07:00
99c0491cb5 ci: update renovate config 2025-03-17 03:28:37 -07:00
e889bb37b6 ci: update preserveSemverRanges for renovate 2025-03-17 03:20:46 -07:00
2db3ea8c62 ci: enable renovate dependency dashboard 2025-03-17 03:12:57 -07:00
d54303d0d7 Merge pull request #30 from TheBinaryNinja/renovate/user-agents-1.x
PR 30: fix(deps): update dependency user-agents to ^1.1.480
2025-03-17 03:00:31 -07:00
renovate[bot]
f6fa7054bd fix(deps): update dependency user-agents to ^1.1.480 2025-03-17 07:11:23 +00:00
renovate[bot]
6249d3ad42 chore(deps): lock file maintenance (#29)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 07:10:06 +00:00
da241a8c9e Merge pull request #27 from TheBinaryNinja/renovate/user-agents-1.x
fix(deps): update dependency user-agents to ^1.1.477
2025-03-16 20:51:45 -07:00
525dae72e1 Merge pull request #28 from TheBinaryNinja/renovate/tj-actions-changed-files-46.x
chore(deps): update tj-actions/changed-files action to v46
2025-03-16 16:30:02 -07:00
renovate[bot]
6182a1c3d4 chore(deps): update tj-actions/changed-files action to v46 2025-03-16 06:34:40 +00:00
renovate[bot]
a00aaa77cf fix(deps): update dependency user-agents to ^1.1.477 2025-03-14 12:00:29 +00:00
57aa72b355 Merge pull request #23 from TheBinaryNinja/renovate/playwright-monorepo
fix(deps): update dependency playwright to ^1.51.0
2025-03-13 01:20:26 -07:00
5ad42e6388 Merge pull request #25 from TheBinaryNinja/renovate/tsickert-discord-webhook-7.x
chore(deps): update tsickert/discord-webhook action to v7
2025-03-13 01:17:58 -07:00
renovate[bot]
d0b2f0a4f4 fix(deps): update dependency playwright to ^1.51.0 2025-03-13 08:17:55 +00:00
af90927a84 ci: update renovate config 2025-03-13 01:16:35 -07:00
5a5c0606a7 Merge pull request #22 from TheBinaryNinja/renovate/user-agents-1.x-lockfile
fix(deps): update dependency user-agents to v1.1.477
2025-03-13 01:03:50 -07:00
renovate[bot]
946469a4db chore(deps): update tsickert/discord-webhook action to v7 2025-03-13 08:03:43 +00:00
renovate[bot]
5aa8e1ad7e fix(deps): update dependency user-agents to v1.1.477 2025-03-13 08:00:11 +00:00
b29144be8f Merge pull request #21 from TheBinaryNinja/renovate/configure
chore: Configure Renovate
2025-03-13 00:58:51 -07:00
c13bb89584 chore: stage package-lock.json 2025-03-13 00:56:30 -07:00
renovate[bot]
aaed36e18b Add renovate.json 2025-03-13 07:56:18 +00:00
57f84e4bba chore: bump node version in dockerfile 2025-03-13 00:55:30 -07:00
8983cabd48 docs(readme): modify traefik instructions 2025-03-13 00:53:05 -07:00
8d856a30bd fix: correct typo default arch amd64 in Dockerfile 2025-03-02 04:33:33 -07:00
2518424ad1 build: add label architecture 2025-02-26 16:15:50 -07:00
f587291d72 ci: add workflow steps for digest exporting and readme extraction 2025-02-26 16:15:27 -07:00
b8dbba7a7e ci: update env variables for workflows 2025-02-26 14:22:57 -07:00
7d29ab31ce build: add org.opencontainers.image.registry 2025-02-26 07:36:30 -07:00
61345f3bcd ci: add org.opencontainers.image.registry 2025-02-26 07:36:16 -07:00
7c21adb843 ci: update tagging for deployment workflows 2025-02-26 05:42:25 -07:00
dd88789f14 ci: update github deployment workflows; add annotations list 2025-02-26 03:39:51 -07:00
4d8794d3d0 ci: add index-annotation to workflow action int128/docker-manifest-create-action 2025-02-26 02:46:35 -07:00
aa0028901a ci: update github deployment workflow; add annotations 2025-02-26 02:40:07 -07:00
901a11382d ci: add README.md cache to deployment workflow, inject docker label org.opencontainers.image.description` 2025-02-26 02:08:58 -07:00
9e19d9798f ci: add docker untagged image cleanup step 2025-02-26 01:55:15 -07:00
97f01942af ci: update deployment workflow to clean up untagged docker images 2025-02-26 01:48:33 -07:00
d622de1341 ci: update deployment workflow to add single and double digit version numbers 2025-02-26 01:38:17 -07:00
6e1ed71674 ci: set global flavor value to false, utilize tag instead 2025-02-25 12:25:57 -07:00
4ee2e79446 ci: remove global property flavor => latest in favor of labels for workflow docker/metadata-action 2025-02-25 11:20:38 -07:00
c70553093d ci: add REGISTRY_REPO_ORG_AUTHOR_LC and REGISTRY_REPO_AUTHOR_LC to remove uppercase conflict 2025-02-25 07:42:41 -07:00
57b0d44c7d chore: update docker image labels to conform with opencontainers spec
https://github.com/opencontainers/image-spec/blob/main/annotations.md
2025-02-25 06:41:37 -07:00
71fad013cf ci: add new build args VERSION BUILDDATE for action docker/build-push-action 2025-02-25 05:48:59 -07:00
d2aee89c21 build: update label BUILDVERSION syntax 2025-02-25 05:23:20 -07:00
544302de6e ci: replace env.ref_name with github.ref_name 2025-02-25 05:22:55 -07:00
dfdc44b1e3 ci: update deployment workflows to output debugging parameters during process 2025-02-25 05:05:22 -07:00
05ab495a46 ci: update gitea workflow to return output of parameters 2025-02-25 04:58:38 -07:00
f5829034a2 fix: workflow deploy-docker-all: up to 10 inputs for a workflow_dispatch event 2025-02-25 04:06:35 -07:00
f186dd8030 ci: update account token secret var for gitea.com registry 2025-02-25 04:02:29 -07:00
ec885559af ci: add docker deployment workflow for gitea.com registry 2025-02-25 03:55:05 -07:00
57c4547a66 ci: add IMAGE_GITEA_WEBSITE env var for dispatch workflow 2025-02-25 03:54:43 -07:00
f8a90a3e33 ci: fix issues-new and issues-stale to detect correct prefix in labels and not re-name 2025-02-25 03:09:37 -07:00
6700d94abb ci: create release meta as to not override existing sha256 before manifest merge completed 2025-02-24 18:32:17 -07:00
577b28cd6d ci: modify meta data generation for arm64 docker container for gitea 2025-02-24 18:16:09 -07:00
f5c767426f ci: modify arm64 workflow step tag to not conflict with amd64 before merge 2025-02-24 18:07:07 -07:00
9a9b18bfbc ci: modify gitea workflow image author and app name 2025-02-24 17:56:16 -07:00
a2aaddb9b2 build: update package.json with revised docker:build:arch commands 2025-02-24 16:55:42 -07:00
eac58e39aa docs(readme): update docker tags / registry list to show new structure of tags 2025-02-24 16:53:41 -07:00
6ec3894175 ci: add registry url to front of manifest paths before merge completed 2025-02-24 16:33:02 -07:00
f8b333af70 build: dockerfile and dockerfile.aarch64 merged, no longer needed 2025-02-24 16:25:52 -07:00
d021aaaea5 ci: merge amd64 and arm64 build process into single job 2025-02-24 16:25:09 -07:00
0a892a80ad ci: update deployment workflow metadata tags 2025-02-24 15:35:43 -07:00
17ecda57fe ci: remove requirement depending on deprecated job job-docker-release-dockerhub-arm64 2025-02-24 15:17:09 -07:00
4c0af665d5 ci: refactor dockerhub deployment process to handle both architectures in one step 2025-02-24 15:12:47 -07:00
3ef13657cd build: add arg $ARCH to Dockerfile and prep to combine architectures 2025-02-24 15:12:12 -07:00
359 changed files with 22876 additions and 12018 deletions

View File

@@ -3,7 +3,9 @@
"projectOwner": "Aetherinox",
"repoType": "github",
"repoHost": "https://github.com",
"files": ["README.md"],
"files": [
"README.md"
],
"imageSize": 40,
"commit": true,
"commitConvention": "angular",

View File

@@ -1,7 +1,8 @@
# #
# @file .editorconfig
# @author Aetherinox https://github.com/Aetherinox
# https://git.binaryninja.net/Aetherinox
# @author Aetherinox
# @repo https://github.com/TheBinaryNinja/tvapp2
# https://git.binaryninja.net/Aetherinox
# @ref http://editorconfig.org
# #

View File

@@ -1,15 +1,35 @@
# #
# @type github workflow
# @desc cleans up the list of deployments in the environment history
# edit the 'environment:' to determine which deployment to keep clean
# - can be ran manually
# @author Aetherinox
# @url https://github.com/Aetherinox
# @usage cleans up the list of deployments in the environment history
# edit the 'environment:' to determine which deployment to keep clean
# - can be ran manually
#
# @secrets secrets.SELF_TOKEN_CL Github Access Token (Classic)
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKfLOWS Discord Webbhook URL; right-click on channel, click "Integrations"
# #
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/deploy-clean.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/deploy-clean.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "⚙️ Deploy Clean"
@@ -30,10 +50,10 @@ on:
# #
DEPLOYMENT_ENV:
description: '📦 Deployment Environment'
required: true
default: 'orion'
type: string
description: '📦 Deployment Environment'
required: true
default: 'orion'
type: string
# #
# Delay
@@ -42,20 +62,22 @@ on:
# #
DEPLOYMENT_DELAY:
description: '🕛 Delete Delay'
required: true
default: '1000'
type: string
description: '🕛 Delete Delay'
required: true
default: '1000'
type: string
# #
# environment variables
# #
env:
DEPLOYMENT_ENV: ${{ github.event.inputs.DEPLOYMENT_ENV || 'orion' }}
DEPLOYMENT_DELAY: ${{ github.event.inputs.DEPLOYMENT_DELAY || '1000' }}
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
DEPLOYMENT_ENV: ${{ github.event.inputs.DEPLOYMENT_ENV || 'orion' }}
DEPLOYMENT_DELAY: ${{ github.event.inputs.DEPLOYMENT_DELAY || '1000' }}
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
LABELS_JSON: |
[
{ "name": "AC Changes Made", "color": "8F1784", "description": "Requested changes have been made and are pending a re-scan" },
@@ -128,7 +150,6 @@ jobs:
runs-on: apollo-x64
timeout-minutes: 20
permissions: write-all
steps:
# #
@@ -188,7 +209,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Success)
id: task_cleanup_notify_discord_success
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -224,7 +245,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Failure)
id: task_cleanup_notify_discord_failure
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: failure()
with:
username: 'Io'

File diff suppressed because it is too large Load Diff

View File

@@ -4,10 +4,31 @@
# @url https://github.com/Aetherinox
# @usage deploys docker container to Dockerhub and send message to discord
# upload this workflow to both the `main` branch of the tvapp2 repository
# @secrets secrets.ADMINSERV_GPG_KEY_ASC gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.ADMINSERV_GPG_PASSPHRASE gpg private key passphrase
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN github personal access token (classic) with package:write permission
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES Discord webhook to report releases from github to discord
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/deploy-docker-dockerhub.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/deploy-docker-dockerhub.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "📦 Deploy Docker Dockerhub"
@@ -36,10 +57,10 @@ on:
# #
IMAGE_NAME:
description: '📦 Image Name'
required: true
default: 'tvapp2'
type: string
description: '📦 Image Name'
required: true
default: 'tvapp2'
type: string
# #
# Image Version
@@ -118,8 +139,11 @@ env:
IMAGE_VERSION: ${{ github.event.inputs.IMAGE_VERSION || '1.0.0' }}
IMAGE_DOCKERHUB_AUTHOR: ${{ github.event.inputs.IMAGE_DOCKERHUB_AUTHOR || 'thebinaryninja' }}
IMAGE_DOCKERHUB_USERNAME: ${{ github.event.inputs.IMAGE_DOCKERHUB_USERNAME || 'thebinaryninja' }}
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
# #
# Jobs
@@ -203,282 +227,21 @@ jobs:
gpg_passphrase: ${{ secrets.ADMINSERV_GPG_PASSPHRASE }}
# #
# Job Docker Release Dockerhub Arm64
# Job Docker Release Dockerhub
# #
job-docker-release-dockerhub-arm64:
job-docker-release-dockerhub:
name: >-
📦 Release Dockerhub Arm64
📦 Release Dockerhub
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create ]
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
# #
# Release Dockerhub Start Arm64
# #
- name: '🏳️ Start'
id: task_release_dh_start
run: |
echo "Starting Dockerhub arm64"
# #
# Release Dockerhub Checkout Amd64
# #
- name: '✅ Checkout'
id: task_release_gh_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Release Dockerhub Get Timestamp
# #
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "DOCKER_IMAGE=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV}
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
# #
# Release Dockerhub Install Dependencies
# #
- name: '📦 Install Dependencies'
id: task_release_dh_dependencies
run:
sudo apt-get install -qq dos2unix
# #
# Release Dockerhub Execute dos2unix
# #
- name: '🔐 Apply dos2unix'
id: task_release_dh_dos2unix
run: |
echo "⚠️⚠️⚠️ Running DOS2UNIX ⚠️⚠️⚠️"
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
echo "✅✅✅ Completed DOS2UNIX ✅✅✅"
# #
# Release Dockerhub Fix Permissions
# #
- name: '#️⃣ Manage Permissions'
id: task_release_dh_permissions
run: |
find ./ -name 'run' -exec chmod 755 {} \;
WRONG_PERM=$(find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print)
if [ -n "${WRONG_PERM}" ]; then
echo "⚠️⚠️⚠️ Permissions are invalid ⚠️⚠️⚠️"
for i in ${WRONG_PERM}; do
echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!"
done
exit 1
else
echo "✅✅✅ Executable permissions are OK ✅✅✅"
fi
# #
# Release Dockerhub QEMU Arm64
# #
- name: '⚙️ Set up QEMU'
id: task_release_dh_qemu
uses: docker/setup-qemu-action@v3
# #
# Release Dockerhub Setup BuildX Arm64
# #
- name: '⚙️ Setup Buildx'
id: task_release_dh_buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: 'image=moby/buildkit:latest'
# #
# Release Dockerhub Registry Login Arm64
# #
- name: '⚙️ Login to Dockerhub'
id: task_release_dh_registry
uses: docker/login-action@v3
with:
username: ${{ env.IMAGE_DOCKERHUB_USERNAME }}
password: ${{ secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN }}
# #
# Release Dockerhub Meta Arm64
# #
- name: '🔨 Dockerhub: Meta - Arm64'
id: task_release_dh_meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_DOCKERHUB_AUTHOR }}/${{ env.IMAGE_NAME }}
tags: |
# latest no
type=raw,value=latest,enable=false
# tag add arm64
# type=raw,enable=true,priority=1000,value=arm64
# dispatch add x1.x.x-arm64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-arm64,value=${{ env.IMAGE_VERSION }}
# dispatch add arm64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-arm64,value=development
# tag add tag-arm64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-arm64,event=tag
flavor: |
latest=false
labels: |
org.opencontainers.image.VERSION=${{ env.IMAGE_VERSION }}
org.opencontainers.image.BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.IMAGE_DOCKERHUB_AUTHOR }}
org.opencontainers.image.ref.name=${{ env.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
# #
# Release Dockerhub Build and Push Arm64
# #
- name: '📦 Build & Push (linux/arm64)'
id: task_release_dh_push
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
context: .
file: Dockerfile.aarch64
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_dh_meta.outputs.tags }}
labels: ${{ steps.task_release_dh_meta.outputs.labels }}
provenance: false
# #
# Release Dockerhub Checkpoint Arm64
# #
- name: '⚠️ Checkpoint'
id: task_release_dh_checkpoint
run: |
echo "registry ............. Dockerhub"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.ref_name ...... ${{ github.ref_name }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "inputs.DRY_RUN ....... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ........... ${{ env.IMAGE_DOCKERHUB_AUTHOR }}"
echo "tags ................. ${{ steps.task_release_dh_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_dh_meta.outputs.labels }}"
echo "docker image ......... ${{ env.DOCKER_IMAGE }}"
echo "docker sha ........... ${{ env.DOCKER_SHA }}"
echo "docker image id ...... ${{ steps.task_release_dh_push.outputs.imageid }}"
echo "docker digest ........ ${{ steps.task_release_dh_push.outputs.digest }}"
# #
# Release Dockerhub Get Weekly Commits
# #
- name: '🕛 Get Weekly Commit List'
id: task_release_set_weekly_commit_list
run: |
echo 'WEEKLY_COMMITS<<EOF' >> $GITHUB_ENV
git log --format="[\`%h\`](${{ github.server_url }}/${{ github.repository }}/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# #
# Release Dockerhub Notify Github
# #
- name: '🔔 Send Discord Webhook Message'
id: task_release_notifications_discord_send
uses: tsickert/discord-webhook@v6.0.0
if: success()
with:
username: 'Io'
avatar-url: 'https://i.imgur.com/8BVDkla.jpg'
webhook-url: ${{ secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES }}
embed-title: "⚙️ ${{ github.workflow_ref }}"
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Dockerhub) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Dockerhub. The image is available at:
- https://github.com/${{ github.repository }}/pkgs/container/${{ env.IMAGE_NAME }}
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull ${{ env.DOCKER_IMAGE }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-amd64`
- Pull: `docker pull ${{ env.DOCKER_IMAGE }}@${{ steps.task_release_dh_push.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Dockerhub` https://hub.docker.com/r/${{ env.IMAGE_DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`
- Triggered By: `${{ github.actor }}`
- Status: `${{ job.status == 'success' && '✅ Successful' || '❌ Failed' }}`
### Tags
-# This docker image will use the following tags:
```
${{ steps.task_release_dh_meta.outputs.tags }}
```
### Labels
-# This docker image embeds the following labels:
```
${{ steps.task_release_dh_meta.outputs.labels }}
```
embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }}
embed-footer-text: "Completed at ${{ env.NOW }} UTC"
embed-timestamp: "${{ env.NOW_LONG }}"
embed-author-name: "${{ github.repository_owner }}"
embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462"
# #
# Job Docker Release Dockerhub Amd64
# #
job-docker-release-dockerhub-amd64:
name: >-
📦 Release Dockerhub Amd64
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create, job-docker-release-dockerhub-arm64 ]
steps:
# #
@@ -507,12 +270,16 @@ jobs:
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "DOCKER_IMAGE=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV}
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
echo "IMAGE_VERSION_1DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-1`" >> ${GITHUB_ENV} # 1
echo "IMAGE_VERSION_2DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-2`" >> ${GITHUB_ENV} # 1.0
echo "REGISTRY_REPO_ORG_AUTHOR_LC=`echo ${{ env.IMAGE_DOCKERHUB_AUTHOR }}/${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # thebinaryninja/tvapp2
echo "REGISTRY_REPO_AUTHOR_LC=`echo ${{ env.IMAGE_DOCKERHUB_AUTHOR }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # thebinaryninja
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV # 71fad013cfce9116ec62779e4a7e627fe4c33627
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV # 02-25-2025 12:49:48
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV # 02-25-2025
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV # 02-25-2025 12:49
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV # 20250225
echo "NOW_DOCKER_TS=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_ENV # 2025-02-25T12:50:11.569Z
# #
# Release Dockerhub Install Dependencies
@@ -530,7 +297,9 @@ jobs:
- name: '🔐 Apply dos2unix'
id: task_release_dh_dos2unix
run: |
echo "⚠️⚠️⚠️ Running DOS2UNIX ⚠️⚠️⚠️"
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
echo "✅✅✅ Completed DOS2UNIX ✅✅✅"
# #
# Release Dockerhub Fix Permissions
@@ -582,50 +351,93 @@ jobs:
password: ${{ secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN }}
# #
# Release Dockerhub Meta Amd64
# Release Dockerhub Read Readme
#
# @usage org.opencontainers.image.description=${{ steps.task_release_dh_readme_cache.outputs.content }}
# #
- name: '🔨 Dockerhub: Meta - Amd64'
- name: '📄 Cache README.md'
id: task_release_dh_readme_cache
uses: actions/github-script@v7
with:
github-token: ${{ secrets.ORG_BINARYNINJA_TOKEN_CL }}
script: |
'use strict'
const { promises: fs } = require('fs')
const main = async () => {
const path = "README.md"
let content = await fs.readFile(path, 'utf8')
core.setOutput('content', content)
}
main().catch(err => core.setFailed(err.message))
# #
# Release Dockerhub Meta
#
# this version of meta does not need one for amd64 and one for arm64 because both
# platforms are combined into one release, all sharing the same tags
# #
- name: '🔨 Dockerhub: Meta'
id: task_release_dh_meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_DOCKERHUB_AUTHOR }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY_REPO_AUTHOR_LC }}/${{ env.IMAGE_NAME }}
tags: |
# latest yes
# tag latest = yes ( no dev )
type=raw,value=latest,enable=${{ !inputs.DEV_RELEASE }}
# tag add amd64
# type=raw,enable=true,priority=1000,value=amd64
# tag add pr tag ( PR or push only )
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=,event=tag
# dispatch add x1.x.x-amd64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-amd64,value=${{ env.IMAGE_VERSION }}
# tag add 1.0.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=450,prefix=,suffix=,value=${{ env.IMAGE_VERSION }}
# dispatch add amd64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-amd64,value=development
# tag add 1.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=425,prefix=,suffix=,value=${{ env.IMAGE_VERSION_2DIGIT }}
# tag add tag-arm64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-amd64,event=tag
# tag add 1 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=400,prefix=,suffix=,value=${{ env.IMAGE_VERSION_1DIGIT }}
# add development tag to default architecture (amd64)
# tag add development ( dispatch only + only dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=,value=development
# tag add development ( amd64 + only dev )
type=raw,enable=${{ inputs.DEV_RELEASE }},priority=400,prefix=,suffix=,value=development
flavor: |
latest=${{ !inputs.DEV_RELEASE }}
latest=false
labels: |
org.opencontainers.image.VERSION=${{ env.IMAGE_VERSION }}
org.opencontainers.image.BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.IMAGE_DOCKERHUB_AUTHOR }}
org.opencontainers.image.ref.name=${{ env.ref_name }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=dockerhub
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
annotations: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=dockerhub
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
# #
# Release Dockerhub Build and Push Amd64
# #
- name: '📦 Build & Push (linux/amd64)'
id: task_release_dh_push
id: task_release_dh_push_amd64
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
@@ -633,9 +445,112 @@ jobs:
file: Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_dh_meta.outputs.tags }}
labels: ${{ steps.task_release_dh_meta.outputs.labels }}
tags: |
${{ steps.task_release_dh_meta.outputs.tags }}
provenance: false
sbom: false
build-args: |-
ARCH=amd64
RELEASE=${{ inputs.DEV_RELEASE == true && 'development' || 'stable' }}
VERSION=${{ env.IMAGE_VERSION }}
BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
# #
# Release Dockerhub Export Digest Amd64
# #
- name: '📄 Export Digest (linux/amd64)'
id: task_release_dh_digest_export_amd64
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
run: |
mkdir -p /tmp/build-digest-amd64
digest="${{ steps.task_release_dh_push_amd64.outputs.digest }}"
digest="${digest#sha256:}"
touch "/tmp/build-digest-amd64/$digest"
shell: bash
# #
# Release Dockerhub Upload Digest Amd64
# #
- name: '🔼 Upload Digest (linux/amd64)'
id: task_release_dh_digest_upload_amd64
uses: actions/upload-artifact@v4
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
name: digest-amd64
path: /tmp/build-digest-amd64/*
if-no-files-found: error
retention-days: 10
# #
# Release Dockerhub Build and Push Arm64
# #
- name: '📦 Build & Push (linux/arm64)'
id: task_release_dh_push_arm64
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
context: .
file: Dockerfile
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.task_release_dh_meta.outputs.labels }}
tags: |
${{ steps.task_release_dh_meta.outputs.tags }}
provenance: false
sbom: false
build-args: |-
ARCH=arm64
RELEASE=${{ inputs.DEV_RELEASE == true && 'development' || 'stable' }}
VERSION=${{ env.IMAGE_VERSION }}
BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
# #
# Release Dockerhub Export Digest Arm64
# #
- name: '📄 Export Digest (linux/arm64)'
id: task_release_dh_digest_export_arm64
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
run: |
mkdir -p /tmp/build-digest-arm64
digest="${{ steps.task_release_dh_push_arm64.outputs.digest }}"
digest="${digest#sha256:}"
touch "/tmp/build-digest-arm64/$digest"
shell: bash
# #
# Release Dockerhub Upload Digest Arm64
# #
- name: '🔼 Upload Digest (linux/arm64)'
id: task_release_dh_digest_upload_arm64
uses: actions/upload-artifact@v4
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
name: digest-arm64
path: /tmp/build-digest-arm64/*
if-no-files-found: error
retention-days: 10
# #
# Release Dockerhub Push Manifest
# #
- name: '📦 Push Manifest'
id: task_release_dh_manifest
uses: int128/docker-manifest-create-action@v2
with:
tags: |
${{ steps.task_release_dh_meta.outputs.tags }}
sources: |
${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_dh_push_amd64.outputs.digest }}
${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_dh_push_arm64.outputs.digest }}
index-annotations: |
${{ steps.task_release_dh_meta.outputs.labels }}
# #
# Release Dockerhub Checkpoint Amd64
@@ -644,19 +559,53 @@ jobs:
- name: '⚠️ Checkpoint'
id: task_release_dh_checkpoint
run: |
echo "registry ............. Dockerhub"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.ref_name ...... ${{ github.ref_name }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "inputs.DRY_RUN ....... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ........... ${{ env.IMAGE_DOCKERHUB_AUTHOR }}"
echo "tags ................. ${{ steps.task_release_dh_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_dh_meta.outputs.labels }}"
echo "docker image ......... ${{ env.DOCKER_IMAGE }}"
echo "docker sha ........... ${{ env.DOCKER_SHA }}"
echo "docker image id ...... ${{ steps.task_release_dh_push.outputs.imageid }}"
echo "docker digest ........ ${{ steps.task_release_dh_push.outputs.digest }}"
echo ""
echo "[ GITHUB ] ---------------------------------------------------------------------------------------------"
echo "github.actor.............................. ${{ github.actor }}"
echo "github.ref ............................... ${{ github.ref }}"
echo "github.ref_name .......................... ${{ github.ref_name }}"
echo "github.event_name ........................ ${{ github.event_name }}"
echo "github.repository_owner .................. ${{ github.repository_owner }}"
echo "github.repository ........................ ${{ github.repository }}"
echo ""
echo "[ INPUTS ] ---------------------------------------------------------------------------------------------"
echo "inputs.IMAGE_NAME ........................ ${{ inputs.IMAGE_NAME }}"
echo "inputs.IMAGE_VERSION ..................... ${{ inputs.IMAGE_VERSION }}"
echo "inputs.IMAGE_DOCKERHUB_AUTHOR ............ ${{ inputs.IMAGE_DOCKERHUB_AUTHOR }}"
echo "inputs.IMAGE_DOCKERHUB_USERNAME .......... ${{ inputs.IMAGE_DOCKERHUB_USERNAME }}"
echo "inputs.DEV_RELEASE ....................... ${{ inputs.DEV_RELEASE }}"
echo "inputs.DRY_RUN ........................... ${{ inputs.DRY_RUN }}"
echo ""
echo "[ ENV ] ------------------------------------------------------------------------------------------------"
echo "env.IMAGE_NAME ........................... ${{ env.IMAGE_NAME }}"
echo "env.IMAGE_VERSION ........................ ${{ env.IMAGE_VERSION }}"
echo "env.IMAGE_VERSION_1DIGIT ................. ${{ env.IMAGE_VERSION_1DIGIT }}"
echo "env.IMAGE_VERSION_2DIGIT ................. ${{ env.IMAGE_VERSION_2DIGIT }}"
echo "env.IMAGE_DOCKERHUB_AUTHOR ............... ${{ env.IMAGE_DOCKERHUB_AUTHOR }}"
echo "env.IMAGE_DOCKERHUB_USERNAME ............. ${{ env.IMAGE_DOCKERHUB_USERNAME }}"
echo "env.NOW .................................. ${{ env.NOW }}"
echo "env.NOW_SHORT ............................ ${{ env.NOW_SHORT }}"
echo "env.NOW_LONG ............................. ${{ env.NOW_LONG }}"
echo "env.NOW_DOCKER_LABEL ..................... ${{ env.NOW_DOCKER_LABEL }}"
echo "env.NOW_DOCKER_TS ........................ ${{ env.NOW_DOCKER_TS }}"
echo "env.REGISTRY_REPO_ORG_AUTHOR_LC .......... ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}"
echo "env.REGISTRY_REPO_AUTHOR_LC .............. ${{ env.REGISTRY_REPO_AUTHOR_LC }}"
echo "env.DOCKER_SHA ........................... ${{ env.DOCKER_SHA }}"
echo ""
echo "[ DOCKER IMAGES ] --------------------------------------------------------------------------------------"
echo "registry ................................. Dockerhub"
echo "tags ..................................... ${{ steps.task_release_dh_meta.outputs.tags }}"
echo "labels ................................... ${{ steps.task_release_dh_meta.outputs.labels }}"
echo "digest ................................... ${{ steps.task_release_dh_push_amd64.outputs.digest }}"
echo ""
echo "(release) tags ........................... ${{ steps.task_release_dh_meta.outputs.tags }}"
echo "(release) labels ......................... ${{ steps.task_release_dh_meta.outputs.labels }}"
echo ""
echo "[ DOCKER DIGESTS ] -------------------------------------------------------------------------------------"
echo "docker image id (amd64) .................. ${{ steps.task_release_dh_push_amd64.outputs.imageid }}"
echo "docker digest (amd64) .................... ${{ steps.task_release_dh_push_amd64.outputs.digest }}"
echo "docker image id (arm64) .................. ${{ steps.task_release_dh_push_arm64.outputs.imageid }}"
echo "docker digest (arm64) .................... ${{ steps.task_release_dh_push_arm64.outputs.digest }}"
# #
# Release Dockerhub Get Weekly Commits
@@ -674,7 +623,7 @@ jobs:
# #
- name: '🔔 Send Discord Webhook Message'
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -684,19 +633,20 @@ jobs:
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Dockerhub) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
### 📦 Deploy (Dockerhub) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Dockerhub. The image is available at:
- https://github.com/${{ github.repository }}/pkgs/container/${{ env.IMAGE_NAME }}
- https://hub.docker.com/r/${{ env.IMAGE_DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
- Version: `${{ env.IMAGE_VERSION }}`
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull ${{ env.DOCKER_IMAGE }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-amd64`
- Pull: `docker pull ${{ env.DOCKER_IMAGE }}@${{ steps.task_release_dh_push.outputs.digest }}`
- Pull: `docker pull ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}`
- Pull (amd64): `docker pull ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_dh_push_amd64.outputs.digest }}`
- Pull (arm64): `docker pull ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_dh_push_arm64.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Dockerhub` https://hub.docker.com/r/${{ env.IMAGE_DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`

View File

@@ -4,10 +4,31 @@
# @url https://github.com/Aetherinox
# @usage deploys docker container to Gitea and send message to discord
# upload this workflow to both the `main` branch of the tvapp2 repository
# @secrets secrets.ADMINSERV_GPG_KEY_ASC gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.ADMINSERV_GPG_PASSPHRASE gpg private key passphrase
# secrets.ORG_BINARYNINJA_GITEA_TOKEN gitea personal access token (classic) with package:write permission
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES Discord webhook to report releases from gitea to discord
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/deploy-docker-gitea.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/deploy-docker-gitea.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "📦 Deploy Docker Gitea"
@@ -36,10 +57,10 @@ on:
# #
IMAGE_NAME:
description: '📦 Image Name'
required: true
default: 'tvapp2'
type: string
description: '📦 Image Name'
required: true
default: 'tvapp2'
type: string
# #
# Image Version
@@ -48,10 +69,10 @@ on:
# #
IMAGE_VERSION:
description: '🏷️ Image Version'
required: true
default: '1.0.0'
type: string
description: '🏷️ Image Version'
required: true
default: '1.0.0'
type: string
# #
# Gitea Author
@@ -61,10 +82,10 @@ on:
# #
IMAGE_GITEA_AUTHOR:
description: '🪪 Image Author'
required: true
default: 'BinaryNinja'
type: string
description: '🪪 Image Author'
required: true
default: 'BinaryNinja'
type: string
# #
# Gitea Username
@@ -78,6 +99,18 @@ on:
default: 'aetherinox'
type: string
# #
# Gitea Website
#
# this is the gitea website / url to push to
# #
IMAGE_GITEA_WEBSITE:
description: '🌎 Gitea Website'
required: true
default: 'git.binaryninja.net'
type: string
# #
# true no changes to the repo will be made
# false workflow will behave normally, and push any changes detected to the files
@@ -113,12 +146,16 @@ on:
# #
env:
IMAGE_NAME: ${{ github.event.inputs.IMAGE_NAME || 'tvapp2' }}
IMAGE_VERSION: ${{ github.event.inputs.IMAGE_VERSION || '1.0.0' }}
IMAGE_GITEA_AUTHOR: ${{ github.event.inputs.IMAGE_GITEA_AUTHOR || 'BinaryNinja' }}
IMAGE_GITEA_USERNAME: ${{ github.event.inputs.IMAGE_GITEA_USERNAME || 'BinaryNinja' }}
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
IMAGE_NAME: ${{ github.event.inputs.IMAGE_NAME || 'tvapp2' }}
IMAGE_VERSION: ${{ github.event.inputs.IMAGE_VERSION || '1.0.0' }}
IMAGE_GITEA_AUTHOR: ${{ github.event.inputs.IMAGE_GITEA_AUTHOR || 'BinaryNinja' }}
IMAGE_GITEA_USERNAME: ${{ github.event.inputs.IMAGE_GITEA_USERNAME || 'BinaryNinja' }}
IMAGE_GITEA_WEBSITE: ${{ github.event.inputs.IMAGE_GITEA_WEBSITE || 'git.binaryninja.net' }}
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
# #
# Jobs
@@ -202,282 +239,21 @@ jobs:
gpg_passphrase: ${{ secrets.ADMINSERV_GPG_PASSPHRASE }}
# #
# Job Docker Release Gitea Arm64
# Job Docker Release Gitea
# #
job-docker-release-gitea-arm64:
job-docker-release-gitea:
name: >-
📦 Release Gitea Arm64
📦 Release Gitea
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create ]
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
# #
# Release Gitea Start Arm64
# #
- name: '🏳️ Start'
id: task_release_gi_start
run: |
echo "Starting Gitea Docker arm64"
# #
# Release Gitea Checkout Arm64
# #
- name: '✅ Checkout'
id: task_release_gh_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Release Gitea Get Timestamp
# #
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "DOCKER_IMAGE=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV}
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
# #
# Release Gitea Install Dependencies
# #
- name: '📦 Install Dependencies'
id: task_release_gi_dependencies
run:
sudo apt-get install -qq dos2unix
# #
# Release Gitea Execute dos2unix
# #
- name: '🔐 Apply dos2unix'
id: task_release_gi_dos2unix
run: |
echo "⚠️⚠️⚠️ Running DOS2UNIX ⚠️⚠️⚠️"
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
echo "✅✅✅ Completed DOS2UNIX ✅✅✅"
# #
# Release Gitea Fix Permissions
# #
- name: '#️⃣ Manage Permissions'
id: task_release_gi_permissions
run: |
find ./ -name 'run' -exec chmod 755 {} \;
WRONG_PERM=$(find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print)
if [ -n "${WRONG_PERM}" ]; then
echo "⚠️⚠️⚠️ Permissions are invalid ⚠️⚠️⚠️"
for i in ${WRONG_PERM}; do
echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!"
done
exit 1
else
echo "✅✅✅ Executable permissions are OK ✅✅✅"
fi
# #
# Release Gitea QEMU Arm64
# #
- name: '⚙️ Set up QEMU'
id: task_release_gi_qemu
uses: docker/setup-qemu-action@v3
# #
# Release Gitea Setup BuildX Arm64
# #
- name: '⚙️ Setup Buildx'
id: task_release_gi_buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: 'image=moby/buildkit:latest'
# #
# Release Gitea Registry Login Arm64
# #
- name: '⚙️ Login to Gitea'
id: task_release_gi_registry
uses: docker/login-action@v3
with:
registry: git.binaryninja.net
username: ${{ env.IMAGE_GITEA_USERNAME }}
password: ${{ secrets.ORG_BINARYNINJA_GITEA_TOKEN }}
# #
# Release Gitea Meta Arm64
# #
- name: '🔨 Gitea: Meta - Arm64'
id: task_release_gi_meta
uses: docker/metadata-action@v5
with:
images: |
git.binaryninja.net/${{ env.IMAGE_GITEA_AUTHOR }}/${{ env.IMAGE_NAME }}
tags: |
# latest no
type=raw,value=latest,enable=false
# tag add arm64
# type=raw,enable=true,priority=1000,value=arm64
# dispatch add x1.x.x-arm64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-arm64,value=${{ env.IMAGE_VERSION }}
# dispatch add arm64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-arm64,value=development
# tag add tag-arm64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-arm64,event=tag
flavor: |
latest=false
labels: |
org.opencontainers.image.VERSION=${{ env.IMAGE_VERSION }}
org.opencontainers.image.BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.IMAGE_GITEA_AUTHOR }}
org.opencontainers.image.ref.name=${{ env.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
# #
# Release Gitea Build and Push Arm64
# #
- name: '📦 Build & Push (linux/arm64)'
id: task_release_gi_push
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
context: .
file: Dockerfile.aarch64
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_gi_meta.outputs.tags }}
labels: ${{ steps.task_release_gi_meta.outputs.labels }}
provenance: false
# #
# Release Gitea Checkpoint Arm64
# #
- name: '⚠️ Checkpoint'
id: task_release_gi_checkpoint
run: |
echo "registry ............. Gitea"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.ref_name ...... ${{ github.ref_name }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "inputs.DRY_RUN ....... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ........... ${{ env.IMAGE_GITEA_AUTHOR }}"
echo "tags ................. ${{ steps.task_release_gi_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_gi_meta.outputs.labels }}"
echo "docker image ......... ${{ env.DOCKER_IMAGE }}"
echo "docker sha ........... ${{ env.DOCKER_SHA }}"
echo "docker image id ...... ${{ steps.task_release_gi_push.outputs.imageid }}"
echo "docker digest ........ ${{ steps.task_release_gi_push.outputs.digest }}"
# #
# Release Gitea Get Weekly Commits
# #
- name: '🕛 Get Weekly Commit List'
id: task_release_set_weekly_commit_list
run: |
echo 'WEEKLY_COMMITS<<EOF' >> $GITHUB_ENV
git log --format="[\`%h\`](${{ github.server_url }}/${{ github.repository }}/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# #
# Release Gitea Notify Gitea
# #
- name: '🔔 Send Discord Webhook Message'
id: task_release_notifications_discord_send
uses: tsickert/discord-webhook@v6.0.0
if: success()
with:
username: 'Io'
avatar-url: 'https://i.imgur.com/8BVDkla.jpg'
webhook-url: ${{ secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES }}
embed-title: "⚙️ ${{ github.workflow_ref }}"
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Gitea) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Gitea. The image is available at:
- https://git.binaryninja.net/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull git.binaryninja.net/${{ env.DOCKER_IMAGE }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-arm64`
- Pull: `docker pull git.binaryninja.net/${{ env.DOCKER_IMAGE }}@${{ steps.task_release_gi_push.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Gitea` https://git.binaryninja.net/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`
- Triggered By: `${{ github.actor }}`
- Status: `${{ job.status == 'success' && '✅ Successful' || '❌ Failed' }}`
### Tags
-# This docker image will use the following tags:
```
${{ steps.task_release_gi_meta.outputs.tags }}
```
### Labels
-# This docker image embeds the following labels:
```
${{ steps.task_release_gi_meta.outputs.labels }}
```
embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }}
embed-footer-text: "Completed at ${{ env.NOW }} UTC"
embed-timestamp: "${{ env.NOW_LONG }}"
embed-author-name: "${{ github.repository_owner }}"
embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462"
# #
# Job Docker Release Gitea Amd64
# #
job-docker-release-gitea-amd64:
name: >-
📦 Release Gitea Amd64
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create, job-docker-release-gitea-arm64 ]
steps:
# #
@@ -506,12 +282,16 @@ jobs:
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "DOCKER_IMAGE=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV}
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
echo "IMAGE_VERSION_1DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-1`" >> ${GITHUB_ENV} # 1
echo "IMAGE_VERSION_2DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-2`" >> ${GITHUB_ENV} # 1.0
echo "REGISTRY_REPO_ORG_AUTHOR_LC=`echo ${{ env.IMAGE_GITEA_AUTHOR }}/${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # thebinaryninja/tvapp2
echo "REGISTRY_REPO_AUTHOR_LC=`echo ${{ env.IMAGE_GITEA_AUTHOR }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # thebinaryninja
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV # 71fad013cfce9116ec62779e4a7e627fe4c33627
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV # 02-25-2025 12:49:48
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV # 02-25-2025
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV # 02-25-2025 12:49
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV # 20250225
echo "NOW_DOCKER_TS=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_ENV # 2025-02-25T12:50:11.569Z
# #
# Release Gitea Install Dependencies
@@ -529,7 +309,9 @@ jobs:
- name: '🔐 Apply dos2unix'
id: task_release_gi_dos2unix
run: |
echo "⚠️⚠️⚠️ Running DOS2UNIX ⚠️⚠️⚠️"
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
echo "✅✅✅ Completed DOS2UNIX ✅✅✅"
# #
# Release Gitea Fix Permissions
@@ -577,55 +359,209 @@ jobs:
id: task_release_gi_registry
uses: docker/login-action@v3
with:
registry: git.binaryninja.net
registry: ${{ env.IMAGE_GITEA_WEBSITE }}
username: ${{ env.IMAGE_GITEA_USERNAME }}
password: ${{ secrets.ORG_BINARYNINJA_GITEA_TOKEN }}
# #
# Release Gitea Meta Amd64
# Release Gitea Read Readme
#
# @usage org.opencontainers.image.description=${{ steps.task_release_gi_readme_cache.outputs.content }}
# #
- name: '🔨 Gitea: Meta - Amd64'
id: task_release_gi_meta
- name: '📄 Cache README.md'
id: task_release_gi_readme_cache
uses: actions/github-script@v7
with:
github-token: ${{ secrets.ORG_BINARYNINJA_TOKEN_CL }}
script: |
'use strict'
const { promises: fs } = require('fs')
const main = async () => {
const path = "README.md"
let content = await fs.readFile(path, 'utf8')
core.setOutput('content', content)
}
main().catch(err => core.setFailed(err.message))
# #
# Release Gitea Meta amd64
#
# this version of meta needs one entry for amd64 and one for arm64 because each
# image needs to be uploaded manually, and then merged into a single platform.
# #
- name: '🔨 Gitea: Meta amd64'
id: task_release_gi_meta_amd64
uses: docker/metadata-action@v5
with:
images: |
git.binaryninja.net/${{ env.IMAGE_GITEA_AUTHOR }}/${{ env.IMAGE_NAME }}
${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_AUTHOR_LC }}/${{ env.IMAGE_NAME }}
tags: |
# latest yes
# tag latest = yes ( no dev )
type=raw,value=latest,enable=${{ !inputs.DEV_RELEASE }}
# tag add amd64
# type=raw,enable=true,priority=1000,value=amd64
# dispatch add x1.x.x-amd64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-amd64,value=${{ env.IMAGE_VERSION }}
# dispatch add amd64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-amd64,value=development
# tag add tag-amd64
# tag add tag-amd64 ( PR or push only )
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-amd64,event=tag
# add development tag to default architecture (amd64)
# tag add 1.0.0-amd64 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=500,prefix=,suffix=-amd64,value=${{ env.IMAGE_VERSION }}
# tag add 1.0.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=450,prefix=,suffix=,value=${{ env.IMAGE_VERSION }}
# tag add 1.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=425,prefix=,suffix=,value=${{ env.IMAGE_VERSION_2DIGIT }}
# tag add 1 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=400,prefix=,suffix=,value=${{ env.IMAGE_VERSION_1DIGIT }}
# dispatch add development-amd64 ( dispatch only + only dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=development-,suffix=,value=amd64
# tag add development ( amd64 + only dev )
type=raw,enable=${{ inputs.DEV_RELEASE }},priority=400,prefix=,suffix=,value=development
flavor: |
latest=${{ !inputs.DEV_RELEASE }}
latest=false
labels: |
org.opencontainers.image.VERSION=${{ env.IMAGE_VERSION }}
org.opencontainers.image.BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.IMAGE_GITEA_AUTHOR }}
org.opencontainers.image.ref.name=${{ env.ref_name }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=gitea
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
annotations: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=gitea
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
# #
# Release Gitea Meta arm64
#
# this version of meta needs one entry for amd64 and one for arm64 because each
# image needs to be uploaded manually, and then merged into a single platform.
# #
- name: '🔨 Gitea: Meta arm64'
id: task_release_gi_meta_arm64
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_AUTHOR_LC }}/${{ env.IMAGE_NAME }}
tags: |
# tag latest = no
type=raw,value=latest,enable=false
# tag add tag-arm64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-arm64,event=tag
# tag add 1.0.0-arm64 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=500,prefix=,suffix=-arm64,value=${{ env.IMAGE_VERSION }}
# dispatch add development-arm64 ( dispatch only + only dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-arm64,value=development
flavor: |
latest=false
labels: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=gitea
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
annotations: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=gitea
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
# #
# Release Gitea Meta Release
#
# this version of meta needs one entry for amd64 and one for arm64 because each
# image needs to be uploaded manually, and then merged into a single platform.
#
# this meta action is for the final image; which has both platforms merged and
# will be the final release.
# #
- name: '🔨 Gitea: Meta Release'
id: task_release_gi_meta_release
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_AUTHOR_LC }}/${{ env.IMAGE_NAME }}
tags: |
# tag latest = yes ( no dev )
type=raw,value=latest,enable=${{ !inputs.DEV_RELEASE }}
# tag add pr tag ( PR or push only )
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=,event=tag
# tag add 1.0.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=450,prefix=,suffix=,value=${{ env.IMAGE_VERSION }}
# tag add 1.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=425,prefix=,suffix=,value=${{ env.IMAGE_VERSION_2DIGIT }}
# tag add 1 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=400,prefix=,suffix=,value=${{ env.IMAGE_VERSION_1DIGIT }}
# tag add development ( dispatch only + only dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=,value=development
# tag add development ( amd64 + only dev )
type=raw,enable=${{ inputs.DEV_RELEASE }},priority=400,prefix=,suffix=,value=development
flavor: |
latest=false
labels: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=gitea
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
annotations: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=gitea
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
# #
# Release Gitea Build and Push Amd64
# #
- name: '📦 Build & Push (linux/amd64)'
id: task_release_gi_push
id: task_release_gi_push_amd64
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
@@ -633,30 +569,173 @@ jobs:
file: Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_gi_meta.outputs.tags }}
labels: ${{ steps.task_release_gi_meta.outputs.labels }}
labels: ${{ steps.task_release_gi_meta_amd64.outputs.labels }}
tags: |
${{ steps.task_release_gi_meta_amd64.outputs.tags }}
provenance: false
sbom: false
build-args: |-
ARCH=amd64
RELEASE=${{ inputs.DEV_RELEASE == true && 'development' || 'stable' }}
VERSION=${{ env.IMAGE_VERSION }}
BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
# #
# Release Gitea Checkpoint Amd64
# Release Gitea Export Digest Amd64
# #
- name: '📄 Export Digest (linux/amd64)'
id: task_release_gi_digest_export_amd64
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
run: |
mkdir -p /tmp/build-digest-amd64
digest="${{ steps.task_release_gi_push_amd64.outputs.digest }}"
digest="${digest#sha256:}"
touch "/tmp/build-digest-amd64/$digest"
shell: bash
# #
# Release Gitea Upload Digest Amd64
# #
- name: '🔼 Upload Digest (linux/amd64)'
id: task_release_gi_digest_upload_amd64
uses: actions/upload-artifact@v4
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
name: digest-amd64
path: /tmp/build-digest-amd64/*
if-no-files-found: error
retention-days: 10
# #
# Release Gitea Build and Push Arm64
# #
- name: '📦 Build & Push (linux/arm64)'
id: task_release_gi_push_arm64
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
context: .
file: Dockerfile
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.task_release_gi_meta_arm64.outputs.labels }}
tags: |
${{ steps.task_release_gi_meta_arm64.outputs.tags }}
provenance: false
sbom: false
build-args: |-
ARCH=arm64
RELEASE=${{ inputs.DEV_RELEASE == true && 'development' || 'stable' }}
VERSION=${{ env.IMAGE_VERSION }}
BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
# #
# Release Gitea Export Digest Arm64
# #
- name: '📄 Export Digest (linux/arm64)'
id: task_release_gi_digest_export_arm64
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
run: |
mkdir -p /tmp/build-digest-arm64
digest="${{ steps.task_release_gi_push_arm64.outputs.digest }}"
digest="${digest#sha256:}"
touch "/tmp/build-digest-arm64/$digest"
shell: bash
# #
# Release Gitea Upload Digest Arm64
# #
- name: '🔼 Upload Digest (linux/arm64)'
id: task_release_gi_digest_upload_arm64
uses: actions/upload-artifact@v4
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
name: digest-arm64
path: /tmp/build-digest-arm64/*
if-no-files-found: error
retention-days: 10
# #
# Release Gitea Push Manifest
# #
- name: '📦 Push Manifest'
id: task_release_gi_manifest
uses: int128/docker-manifest-create-action@v2
with:
tags: |
${{ steps.task_release_gi_meta_release.outputs.tags }}
sources: |
${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gi_push_amd64.outputs.digest }}
${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gi_push_arm64.outputs.digest }}
index-annotations: |
${{ steps.task_release_gi_meta_release.outputs.labels }}
# #
# Release Gitea Checkpoint
# #
- name: '⚠️ Checkpoint'
id: task_release_gi_checkpoint
run: |
echo "registry ............. Gitea"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.ref_name ...... ${{ github.ref_name }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "inputs.DRY_RUN ....... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ........... ${{ env.IMAGE_GITEA_AUTHOR }}"
echo "tags ................. ${{ steps.task_release_gi_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_gi_meta.outputs.labels }}"
echo "docker image ......... ${{ env.DOCKER_IMAGE }}"
echo "docker sha ........... ${{ env.DOCKER_SHA }}"
echo "docker image id ...... ${{ steps.task_release_gi_push.outputs.imageid }}"
echo "docker digest ........ ${{ steps.task_release_gi_push.outputs.digest }}"
echo ""
echo "[ GITHUB ] ---------------------------------------------------------------------------------------------"
echo "github.actor.............................. ${{ github.actor }}"
echo "github.ref ............................... ${{ github.ref }}"
echo "github.ref_name .......................... ${{ github.ref_name }}"
echo "github.event_name ........................ ${{ github.event_name }}"
echo "github.repository_owner .................. ${{ github.repository_owner }}"
echo "github.repository ........................ ${{ github.repository }}"
echo ""
echo "[ INPUTS ] ---------------------------------------------------------------------------------------------"
echo "inputs.IMAGE_NAME ........................ ${{ inputs.IMAGE_NAME }}"
echo "inputs.IMAGE_VERSION ..................... ${{ inputs.IMAGE_VERSION }}"
echo "inputs.IMAGE_GITEA_USERNAME .............. ${{ inputs.IMAGE_GITEA_AUTHOR }}"
echo "inputs.IMAGE_GITEA_USERNAME .............. ${{ inputs.IMAGE_GITEA_USERNAME }}"
echo "inputs.IMAGE_GITEA_WEBSITE ............... ${{ inputs.IMAGE_GITEA_WEBSITE }}"
echo "inputs.DEV_RELEASE ....................... ${{ inputs.DEV_RELEASE }}"
echo "inputs.DRY_RUN ........................... ${{ inputs.DRY_RUN }}"
echo ""
echo "[ ENV ] ------------------------------------------------------------------------------------------------"
echo "env.IMAGE_NAME ........................... ${{ env.IMAGE_NAME }}"
echo "env.IMAGE_VERSION ........................ ${{ env.IMAGE_VERSION }}"
echo "env.IMAGE_VERSION_1DIGIT ................. ${{ env.IMAGE_VERSION_1DIGIT }}"
echo "env.IMAGE_VERSION_2DIGIT ................. ${{ env.IMAGE_VERSION_2DIGIT }}"
echo "env.IMAGE_GITEA_AUTHOR ................... ${{ env.IMAGE_GITEA_AUTHOR }}"
echo "env.IMAGE_GITEA_USERNAME ................. ${{ env.IMAGE_GITEA_USERNAME }}"
echo "env.IMAGE_GITEA_WEBSITE .................. ${{ env.IMAGE_GITEA_WEBSITE }}"
echo "env.NOW .................................. ${{ env.NOW }}"
echo "env.NOW_SHORT ............................ ${{ env.NOW_SHORT }}"
echo "env.NOW_LONG ............................. ${{ env.NOW_LONG }}"
echo "env.NOW_DOCKER_LABEL ..................... ${{ env.NOW_DOCKER_LABEL }}"
echo "env.NOW_DOCKER_TS ........................ ${{ env.NOW_DOCKER_TS }}"
echo "env.REGISTRY_REPO_ORG_AUTHOR_LC .......... ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}"
echo "env.REGISTRY_REPO_AUTHOR_LC .............. ${{ env.REGISTRY_REPO_AUTHOR_LC }}"
echo "env.DOCKER_SHA ........................... ${{ env.DOCKER_SHA }}"
echo ""
echo "[ DOCKER IMAGES ] --------------------------------------------------------------------------------------"
echo "registry ................................. Gitea"
echo "(amd64) tags ............................. ${{ steps.task_release_gi_meta_amd64.outputs.tags }}"
echo "(amd64) labels ........................... ${{ steps.task_release_gi_meta_amd64.outputs.labels }}"
echo "(amd64) digest ........................... ${{ steps.task_release_gi_push_amd64.outputs.digest }}"
echo ""
echo "(arm64) tags ............................. ${{ steps.task_release_gi_meta_arm64.outputs.tags }}"
echo "(arm64) labels ........................... ${{ steps.task_release_gi_meta_arm64.outputs.labels }}"
echo "(arm64) digest ........................... ${{ steps.task_release_gi_push_arm64.outputs.digest }}"
echo ""
echo "(release) tags ........................... ${{ steps.task_release_gi_meta_release.outputs.tags }}"
echo "(release) labels ......................... ${{ steps.task_release_gi_meta_release.outputs.labels }}"
echo ""
echo "[ DOCKER DIGESTS ] -------------------------------------------------------------------------------------"
echo "docker image id (amd64) .................. ${{ steps.task_release_gi_push_amd64.outputs.imageid }}"
echo "docker digest (amd64) .................... ${{ steps.task_release_gi_push_amd64.outputs.digest }}"
echo "docker image id (arm64) .................. ${{ steps.task_release_gi_push_arm64.outputs.imageid }}"
echo "docker digest (arm64) .................... ${{ steps.task_release_gi_push_arm64.outputs.digest }}"
# #
# Release Gitea Get Weekly Commits
@@ -674,7 +753,7 @@ jobs:
# #
- name: '🔔 Send Discord Webhook Message'
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -684,19 +763,20 @@ jobs:
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Gitea) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
### 📦 Deploy (Gitea) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Gitea. The image is available at:
- https://git.binaryninja.net/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- https://${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull git.binaryninja.net/${{ env.DOCKER_IMAGE }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-amd64`
- Pull: `docker pull git.binaryninja.net/${{ env.DOCKER_IMAGE }}@${{ steps.task_release_gi_push.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Gitea` https://git.binaryninja.net/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull ${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}`
- Pull (amd64): `docker pull ${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gi_push_amd64.outputs.digest }}`
- Pull (arm64): `docker pull ${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gi_push_arm64.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Gitea` https://${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`
@@ -707,14 +787,14 @@ jobs:
-# This docker image will use the following tags:
```
${{ steps.task_release_gi_meta.outputs.tags }}
${{ steps.task_release_gi_meta_amd64.outputs.tags }}
```
### Labels
-# This docker image embeds the following labels:
```
${{ steps.task_release_gi_meta.outputs.labels }}
${{ steps.task_release_gi_meta_amd64.outputs.labels }}
```
embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }}
embed-footer-text: "Completed at ${{ env.NOW }} UTC"

View File

@@ -0,0 +1,783 @@
# #
# @type github workflow
# @author Aetherinox
# @url https://github.com/Aetherinox
# @usage deploys docker container to Gitea.com and send message to discord
# upload this workflow to both the `main` branch of the tvapp2 repository
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/deploy-docker-giteacom.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/deploy-docker-giteacom.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "📦 Deploy Docker Gitea.com"
run-name: "📦 Deploy Docker Gitea.com"
# #
# Triggers
# #
on:
# #
# Trigger Workflow Dispatch
#
# If any values are not provided, will use fallback env variable
# #
workflow_dispatch:
inputs:
# #
# Image Name
#
# used in github image path
# gitea.com/${{ env.IMAGE_GITEA_AUTHOR }}/${{ env.IMAGE_NAME }}
# #
IMAGE_NAME:
description: '📦 Image Name'
required: true
default: 'tvapp2'
type: string
# #
# Image Version
#
# used to create new release tag, and add version to docker image name
# #
IMAGE_VERSION:
description: '🏷️ Image Version'
required: true
default: '1.0.0'
type: string
# #
# Gitea Author
#
# used in github image path
# gitea.com/${{ env.IMAGE_GITEA_AUTHOR }}/${{ env.IMAGE_NAME }}
# #
IMAGE_GITEA_AUTHOR:
description: '🪪 Image Author'
required: true
default: 'BinaryNinja'
type: string
# #
# Gitea Username
#
# this is the user to sign into gitea as.
# #
IMAGE_GITEA_USERNAME:
description: '🪪 Gitea Username'
required: true
default: 'aetherinox'
type: string
# #
# Gitea Website
#
# this is the gitea website / url to push to
# #
IMAGE_GITEA_WEBSITE:
description: '🌎 Gitea Website'
required: true
default: 'gitea.com'
type: string
# #
# true no changes to the repo will be made
# false workflow will behave normally, and push any changes detected to the files
# #
DRY_RUN:
description: '🐛 Dry Run (Debug)'
required: true
default: false
type: boolean
# #
# true released version will be marked as a development build and will have the v1.x.x-development tag instead of -latest
# false release version will be marked with -latest docker tag
# #
DEV_RELEASE:
description: '🧪 Development Release'
required: true
default: false
type: boolean
# #
# Trigger Push
# #
push:
tags:
- '*'
# #
# Environment Vars
# #
env:
IMAGE_NAME: ${{ github.event.inputs.IMAGE_NAME || 'tvapp2' }}
IMAGE_VERSION: ${{ github.event.inputs.IMAGE_VERSION || '1.0.0' }}
IMAGE_GITEA_AUTHOR: ${{ github.event.inputs.IMAGE_GITEA_AUTHOR || 'BinaryNinja' }}
IMAGE_GITEA_USERNAME: ${{ github.event.inputs.IMAGE_GITEA_USERNAME || 'BinaryNinja' }}
IMAGE_GITEA_WEBSITE: ${{ github.event.inputs.IMAGE_GITEA_WEBSITE || 'gitea.com' }}
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
# #
# Jobs
#
# The way pushed docker containers on Gitea work, the most recent image built goes at the top.
# We will use the order below which builds the :latest image last so that it appears at the very
# top of the packages page.
# #
jobs:
# #
# Job Create Tag
# #
job-docker-release-tags-create:
name: >-
📦 Release Create Tag
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 4
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
# #
# Release Tags Start
# #
- name: '🏳️ Start'
id: task_release_tags_start
run: |
echo "Generating Docker Image on ${{ env.IMAGE_GITEA_WEBSITE }}"
echo "Using original Gitea workflow without manifest"
# #
# Release Tags Checkout
# #
- name: '✅ Checkout'
id: task_release_tags_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Release Tags Fix Permissions
# #
- name: '#️⃣ Manage Permissions'
id: task_release_tags_permissions
run: |
find ./ -name 'run' -exec chmod 755 {} \;
WRONG_PERM=$(find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print)
if [ -n "${WRONG_PERM}" ]; then
echo "⚠️⚠️⚠️ Permissions are invalid ⚠️⚠️⚠️"
for i in ${WRONG_PERM}; do
echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!"
done
exit 1
else
echo "✅✅✅ Executable permissions are OK ✅✅✅"
fi
# #
# Release Tags Create Tag
#
# only called in dispatch mode
# #
- uses: rickstaa/action-create-tag@v1
id: task_release_tags_create
if: ( github.event_name != 'workflow_dispatch' && inputs.DRY_RUN == false )
with:
tag: "${{ env.IMAGE_VERSION }}"
tag_exists_error: false
message: '${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}'
gpg_private_key: ${{ secrets.ADMINSERV_GPG_KEY_ASC }}
gpg_passphrase: ${{ secrets.ADMINSERV_GPG_PASSPHRASE }}
# #
# Job Docker Release Gitea Arm64
# #
job-docker-release-gitea-arm64:
name: >-
📦 Release Gitea Arm64
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
needs: [ job-docker-release-tags-create ]
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
# #
# Release Gitea Start Arm64
# #
- name: '🏳️ Start'
id: task_release_gi_start
run: |
echo "Generating Docker Image on ${{ env.IMAGE_GITEA_WEBSITE }} arm64"
echo "Using original Gitea workflow without manifest"
# #
# Release Gitea Checkout Arm64
# #
- name: '✅ Checkout'
id: task_release_gh_checkout
uses: actions/checkout@v4
# #
# Release Gitea Get Timestamp
# #
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "IMAGE_VERSION_1DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-1`" >> ${GITHUB_ENV} # 1
echo "IMAGE_VERSION_2DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-2`" >> ${GITHUB_ENV} # 1.0
echo "REGISTRY_REPO_ORG_AUTHOR_LC=`echo ${{ env.IMAGE_GITEA_AUTHOR }}/${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # binaryninja/tvapp2
echo "REGISTRY_REPO_AUTHOR_LC=`echo ${{ env.IMAGE_GITEA_AUTHOR }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # binaryninja
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV # 71fad013cfce9116ec62779e4a7e627fe4c33627
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV # 02-25-2025 12:49:48
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV # 02-25-2025
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV # 02-25-2025 12:49
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV # 20250225
echo "NOW_DOCKER_TS=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_ENV # 2025-02-25T12:50:11.569Z
# #
# Release Gitea Install Dependencies
# #
- name: '📦 Install Dependencies'
id: task_release_gi_dependencies
run:
sudo apt-get install -qq dos2unix
# #
# Release Gitea Execute dos2unix
# #
- name: '🔐 Apply dos2unix'
id: task_release_gi_dos2unix
run: |
echo "⚠️⚠️⚠️ Running DOS2UNIX ⚠️⚠️⚠️"
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
echo "✅✅✅ Completed DOS2UNIX ✅✅✅"
# #
# Release Gitea Fix Permissions
# #
- name: '#️⃣ Manage Permissions'
id: task_release_gi_permissions
run: |
find ./ -name 'run' -exec chmod 755 {} \;
WRONG_PERM=$(find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print)
if [ -n "${WRONG_PERM}" ]; then
echo "⚠️⚠️⚠️ Permissions are invalid ⚠️⚠️⚠️"
for i in ${WRONG_PERM}; do
echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!"
done
exit 1
else
echo "✅✅✅ Executable permissions are OK ✅✅✅"
fi
# #
# Release Gitea QEMU Arm64
# #
- name: '⚙️ Set up QEMU'
id: task_release_gi_qemu
uses: docker/setup-qemu-action@v3
# #
# Release Gitea Setup BuildX Arm64
# #
- name: '⚙️ Setup Buildx'
id: task_release_gi_buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: 'image=moby/buildkit:latest'
# #
# Release Gitea Registry Login Arm64
# #
- name: '⚙️ Login to Gitea'
id: task_release_gi_registry
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_GITEA_WEBSITE }}
username: ${{ env.IMAGE_GITEA_USERNAME }}
password: ${{ secrets.ORG_BINARYNINJA_GITEACOM_TOKEN }}
# #
# Release Gitea Meta Arm64
# #
- name: '🔨 Gitea: Meta - Arm64'
id: task_release_gi_meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_AUTHOR_LC }}/${{ env.IMAGE_NAME }}
tags: |
# latest no
type=raw,value=latest,enable=false
# tag add arm64
# type=raw,enable=true,priority=1000,value=arm64
# dispatch add x1.x.x-arm64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-arm64,value=${{ env.IMAGE_VERSION }}
# dispatch add arm64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-arm64,value=development
# tag add tag-arm64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-arm64,event=tag
flavor: |
latest=false
labels: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
# #
# Release Gitea Build and Push Arm64
# #
- name: '📦 Build & Push (linux/arm64)'
id: task_release_gi_push
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
context: .
file: Dockerfile.aarch64
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_gi_meta.outputs.tags }}
labels: ${{ steps.task_release_gi_meta.outputs.labels }}
provenance: false
# #
# Release Gitea Checkpoint Arm64
# #
- name: '⚠️ Checkpoint'
id: task_release_gi_checkpoint
run: |
echo "registry ................................. Gitea"
echo "github.actor.............................. ${{ github.actor }}"
echo "github.ref ............................... ${{ github.ref }}"
echo "github.ref_name .......................... ${{ github.ref_name }}"
echo "github.event_name ........................ ${{ github.event_name }}"
echo "github.repository_owner .................. ${{ github.repository_owner }}"
echo "github.repository ........................ ${{ github.repository }}"
echo "inputs.DRY_RUN ........................... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ............................... ${{ env.REGISTRY_REPO_AUTHOR_LC }}"
echo "tags ..................................... ${{ steps.task_release_gi_meta.outputs.tags }}"
echo "labels ................................... ${{ steps.task_release_gi_meta.outputs.labels }}"
echo "docker image ............................. ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}"
echo "docker sha ............................... ${{ env.DOCKER_SHA }}"
echo "docker image id .......................... ${{ steps.task_release_gi_push.outputs.imageid }}"
echo "docker digest ............................ ${{ steps.task_release_gi_push.outputs.digest }}"
# #
# Release Gitea Get Weekly Commits
# #
- name: '🕛 Get Weekly Commit List'
id: task_release_set_weekly_commit_list
run: |
echo 'WEEKLY_COMMITS<<EOF' >> $GITHUB_ENV
git log --format="[\`%h\`](${{ github.server_url }}/${{ github.repository }}/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# #
# Release Gitea Notify Gitea
# #
- name: '🔔 Send Discord Webhook Message'
id: task_release_notifications_discord_send
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
avatar-url: 'https://i.imgur.com/8BVDkla.jpg'
webhook-url: ${{ secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES }}
embed-title: "⚙️ ${{ github.workflow_ref }}"
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Gitea) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Gitea. The image is available at:
- https://${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull ${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-arm64`
- Pull: `docker pull ${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gi_push.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Gitea` https://${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`
- Triggered By: `${{ github.actor }}`
- Status: `${{ job.status == 'success' && '✅ Successful' || '❌ Failed' }}`
### Tags
-# This docker image will use the following tags:
```
${{ steps.task_release_gi_meta.outputs.tags }}
```
### Labels
-# This docker image embeds the following labels:
```
${{ steps.task_release_gi_meta.outputs.labels }}
```
embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }}
embed-footer-text: "Completed at ${{ env.NOW }} UTC"
embed-timestamp: "${{ env.NOW_LONG }}"
embed-author-name: "${{ github.repository_owner }}"
embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462"
# #
# Job Docker Release Gitea Amd64
# #
job-docker-release-gitea-amd64:
name: >-
📦 Release Gitea Amd64
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create, job-docker-release-gitea-arm64 ]
steps:
# #
# Release Gitea Start Amd64
# #
- name: '🏳️ Start'
id: task_release_gi_start
run: |
echo "Generating Docker Image on ${{ env.IMAGE_GITEA_WEBSITE }} amd64"
echo "Using original Gitea workflow without manifest"
# #
# Release Gitea Checkout
# #
- name: '✅ Checkout'
id: task_release_gh_checkout
uses: actions/checkout@v4
# #
# Release Gitea Get Timestamp
# #
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "IMAGE_VERSION_1DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-1`" >> ${GITHUB_ENV} # 1
echo "IMAGE_VERSION_2DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-2`" >> ${GITHUB_ENV} # 1.0
echo "REGISTRY_REPO_ORG_AUTHOR_LC=`echo ${{ env.IMAGE_GITEA_AUTHOR }}/${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # binaryninja/tvapp2
echo "REGISTRY_REPO_AUTHOR_LC=`echo ${{ env.IMAGE_GITEA_AUTHOR }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # binaryninja
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV # 71fad013cfce9116ec62779e4a7e627fe4c33627
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV # 02-25-2025 12:49:48
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV # 02-25-2025
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV # 02-25-2025 12:49
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV # 20250225
echo "NOW_DOCKER_TS=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_ENV # 2025-02-25T12:50:11.569Z
# #
# Release Gitea Install Dependencies
# #
- name: '📦 Install Dependencies'
id: task_release_gi_dependencies
run:
sudo apt-get install -qq dos2unix
# #
# Release Gitea Execute dos2unix
# #
- name: '🔐 Apply dos2unix'
id: task_release_gi_dos2unix
run: |
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
# #
# Release Gitea Fix Permissions
# #
- name: '#️⃣ Manage Permissions'
id: task_release_gi_permissions
run: |
find ./ -name 'run' -exec chmod 755 {} \;
WRONG_PERM=$(find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print)
if [ -n "${WRONG_PERM}" ]; then
echo "⚠️⚠️⚠️ Permissions are invalid ⚠️⚠️⚠️"
for i in ${WRONG_PERM}; do
echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!"
done
exit 1
else
echo "✅✅✅ Executable permissions are OK ✅✅✅"
fi
# #
# Release Gitea QEMU Amd64
# #
- name: '⚙️ Set up QEMU'
id: task_release_gi_qemu
uses: docker/setup-qemu-action@v3
# #
# Release Gitea Setup BuildX Amd64
# #
- name: '⚙️ Setup Buildx'
id: task_release_gi_buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: 'image=moby/buildkit:latest'
# #
# Release Gitea Registry Login Amd64
# #
- name: '⚙️ Login to Gitea'
id: task_release_gi_registry
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_GITEA_WEBSITE }}
username: ${{ env.IMAGE_GITEA_USERNAME }}
password: ${{ secrets.ORG_BINARYNINJA_GITEACOM_TOKEN }}
# #
# Release Gitea Meta Amd64
# #
- name: '🔨 Gitea: Meta - Amd64'
id: task_release_gi_meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_AUTHOR_LC }}/${{ env.IMAGE_NAME }}
tags: |
# latest yes
type=raw,value=latest,enable=${{ !inputs.DEV_RELEASE }}
# tag add amd64
# type=raw,enable=true,priority=1000,value=amd64
# dispatch add x1.x.x-amd64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-amd64,value=${{ env.IMAGE_VERSION }}
# dispatch add amd64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-amd64,value=development
# tag add tag-amd64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-amd64,event=tag
# add development tag to default architecture (amd64)
type=raw,enable=${{ inputs.DEV_RELEASE }},priority=400,prefix=,suffix=,value=development
flavor: |
latest=false
labels: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
annotations: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
# #
# Release Gitea Build and Push Amd64
# #
- name: '📦 Build & Push (linux/amd64)'
id: task_release_gi_push
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_gi_meta.outputs.tags }}
labels: ${{ steps.task_release_gi_meta.outputs.labels }}
provenance: false
# #
# Release Gitea Checkpoint Amd64
# #
- name: '⚠️ Checkpoint'
id: task_release_gi_checkpoint
run: |
echo "registry ................................. Gitea"
echo "github.actor.............................. ${{ github.actor }}"
echo "github.ref ............................... ${{ github.ref }}"
echo "github.ref_name .......................... ${{ github.ref_name }}"
echo "github.event_name ........................ ${{ github.event_name }}"
echo "github.repository_owner .................. ${{ github.repository_owner }}"
echo "github.repository ........................ ${{ github.repository }}"
echo "inputs.DRY_RUN ........................... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ............................... ${{ env.REGISTRY_REPO_AUTHOR_LC }}"
echo "tags ..................................... ${{ steps.task_release_gi_meta.outputs.tags }}"
echo "labels ................................... ${{ steps.task_release_gi_meta.outputs.labels }}"
echo "docker image ............................. ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}"
echo "docker sha ............................... ${{ env.DOCKER_SHA }}"
echo "docker image id .......................... ${{ steps.task_release_gi_push.outputs.imageid }}"
echo "docker digest ............................ ${{ steps.task_release_gi_push.outputs.digest }}"
# #
# Release Gitea Get Weekly Commits
# #
- name: '🕛 Get Weekly Commit List'
id: task_release_set_weekly_commit_list
run: |
echo 'WEEKLY_COMMITS<<EOF' >> $GITHUB_ENV
git log --format="[\`%h\`](${{ github.server_url }}/${{ github.repository }}/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# #
# Release Gitea Notify Gitea
# #
- name: '🔔 Send Discord Webhook Message'
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
avatar-url: 'https://i.imgur.com/8BVDkla.jpg'
webhook-url: ${{ secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES }}
embed-title: "⚙️ ${{ github.workflow_ref }}"
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Gitea) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Gitea. The image is available at:
- https://${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull ${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-amd64`
- Pull: `docker pull ${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gi_push.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Gitea` https://${{ env.IMAGE_GITEA_WEBSITE }}/${{ env.IMAGE_GITEA_USERNAME }}/${{ env.IMAGE_NAME }}/packages
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`
- Triggered By: `${{ github.actor }}`
- Status: `${{ job.status == 'success' && '✅ Successful' || '❌ Failed' }}`
### Tags
-# This docker image will use the following tags:
```
${{ steps.task_release_gi_meta.outputs.tags }}
```
### Labels
-# This docker image embeds the following labels:
```
${{ steps.task_release_gi_meta.outputs.labels }}
```
embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }}
embed-footer-text: "Completed at ${{ env.NOW }} UTC"
embed-timestamp: "${{ env.NOW_LONG }}"
embed-author-name: "${{ github.repository_owner }}"
embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462"

View File

@@ -4,10 +4,31 @@
# @url https://github.com/Aetherinox
# @usage deploys docker container to github and send message to discord
# upload this workflow to both the `main` branch of the tvapp2 repository
# @secrets secrets.ADMINSERV_GPG_KEY_ASC gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.ADMINSERV_GPG_PASSPHRASE gpg private key passphrase
# secrets.ORG_BINARYNINJA_TOKEN_CL github personal access token (classic) with package:write permission
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES Discord webhook to report releases from github to discord
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/deploy-docker-github.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/deploy-docker-github.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "📦 Deploy Docker Github"
@@ -36,10 +57,10 @@ on:
# #
IMAGE_NAME:
description: '📦 Image Name'
required: true
default: 'tvapp2'
type: string
description: '📦 Image Name'
required: true
default: 'tvapp2'
type: string
# #
# Image Version
@@ -48,10 +69,10 @@ on:
# #
IMAGE_VERSION:
description: '🏷️ Image Version'
required: true
default: '1.0.0'
type: string
description: '🏷️ Image Version'
required: true
default: '1.0.0'
type: string
# #
# Image Author
@@ -61,10 +82,10 @@ on:
# #
IMAGE_GHCR_AUTHOR:
description: '🪪 Image Author'
required: true
default: 'TheBinaryNinja'
type: string
description: '🪪 Image Author'
required: true
default: 'TheBinaryNinja'
type: string
# #
# Image ghcr username
@@ -113,12 +134,15 @@ on:
# #
env:
IMAGE_NAME: ${{ github.event.inputs.IMAGE_NAME || 'tvapp2' }}
IMAGE_VERSION: ${{ github.event.inputs.IMAGE_VERSION || '1.0.0' }}
IMAGE_GHCR_AUTHOR: ${{ github.event.inputs.IMAGE_GHCR_AUTHOR || 'BinaryNinja' }}
IMAGE_GHCR_USERNAME: ${{ github.event.inputs.IMAGE_GHCR_USERNAME || 'BinaryNinja' }}
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
IMAGE_NAME: ${{ github.event.inputs.IMAGE_NAME || 'tvapp2' }}
IMAGE_VERSION: ${{ github.event.inputs.IMAGE_VERSION || '1.0.0' }}
IMAGE_GHCR_AUTHOR: ${{ github.event.inputs.IMAGE_GHCR_AUTHOR || 'BinaryNinja' }}
IMAGE_GHCR_USERNAME: ${{ github.event.inputs.IMAGE_GHCR_USERNAME || 'BinaryNinja' }}
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
# #
# Jobs
@@ -202,280 +226,21 @@ jobs:
gpg_passphrase: ${{ secrets.ADMINSERV_GPG_PASSPHRASE }}
# #
# Job Docker Release Github Arm64
# Job Docker Release Github
# #
job-docker-release-github-arm64:
job-docker-release-github:
name: >-
📦 Release Github Arm64
📦 Release Github
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create ]
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
# #
# Release Github Start Arm64
# #
- name: '🏳️ Start'
id: task_release_gh_start
run: |
echo "Starting Github Docker arm64"
# #
# Release Github Checkout Arm64
# #
- name: '✅ Checkout'
id: task_release_gh_checkout
uses: actions/checkout@v4
# #
# Release Github Get Timestamp
# #
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "DOCKER_IMAGE=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV}
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
# #
# Release Github Install Dependencies
# #
- name: '📦 Install Dependencies'
id: task_release_gh_dependencies
run:
sudo apt-get install -qq dos2unix
# #
# Release Github Execute dos2unix
# #
- name: '🔐 Apply dos2unix'
id: task_release_gh_dos2unix
run: |
echo "⚠️⚠️⚠️ Running DOS2UNIX ⚠️⚠️⚠️"
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
echo "✅✅✅ Completed DOS2UNIX ✅✅✅"
# #
# Release Github Fix Permissions
# #
- name: '#️⃣ Manage Permissions'
id: task_release_gh_permissions
run: |
find ./ -name 'run' -exec chmod 755 {} \;
WRONG_PERM=$(find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print)
if [ -n "${WRONG_PERM}" ]; then
echo "⚠️⚠️⚠️ Permissions are invalid ⚠️⚠️⚠️"
for i in ${WRONG_PERM}; do
echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!"
done
exit 1
else
echo "✅✅✅ Executable permissions are OK ✅✅✅"
fi
# #
# Release Github QEMU Arm64
# #
- name: '⚙️ Set up QEMU'
id: task_release_gh_qemu
uses: docker/setup-qemu-action@v3
# #
# Release Github Setup BuildX Arm64
# #
- name: '⚙️ Setup Buildx'
id: task_release_gh_buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: 'image=moby/buildkit:latest'
# #
# Release Github Registry Login Arm64
# #
- name: '⚙️ Login to Github'
id: task_release_gh_registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ env.IMAGE_GHCR_USERNAME }}
password: ${{ secrets.ORG_BINARYNINJA_TOKEN_CL }}
# #
# Release Github Meta Arm64
# #
- name: '🔨 Github: Meta - Arm64'
id: task_release_gh_meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.IMAGE_GHCR_AUTHOR }}/${{ env.IMAGE_NAME }}
tags: |
# latest no
type=raw,value=latest,enable=false
# tag add arm64
# type=raw,enable=true,priority=1000,value=arm64
# dispatch add x1.x.x-arm64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-arm64,value=${{ env.IMAGE_VERSION }}
# dispatch add arm64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-arm64,value=development
# tag add tag-arm64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-arm64,event=tag
flavor: |
latest=false
labels: |
org.opencontainers.image.VERSION=${{ env.IMAGE_VERSION }}
org.opencontainers.image.BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.IMAGE_GHCR_AUTHOR }}
org.opencontainers.image.ref.name=${{ env.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
# #
# Release Github Build and Push Arm64
# #
- name: '📦 Build & Push (linux/arm64)'
id: task_release_gh_push
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
context: .
file: Dockerfile.aarch64
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_gh_meta.outputs.tags }}
labels: ${{ steps.task_release_gh_meta.outputs.labels }}
provenance: false
# #
# Release Github Checkpoint Arm64
# #
- name: '⚠️ Checkpoint'
id: task_release_gh_checkpoint
run: |
echo "registry ............. Github"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.ref_name ...... ${{ github.ref_name }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "inputs.DRY_RUN ....... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ........... ${{ env.IMAGE_GHCR_AUTHOR }}"
echo "tags ................. ${{ steps.task_release_gh_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_gh_meta.outputs.labels }}"
echo "docker image ......... ${{ env.DOCKER_IMAGE }}"
echo "docker sha ........... ${{ env.DOCKER_SHA }}"
echo "docker image id ...... ${{ steps.task_release_gh_push.outputs.imageid }}"
echo "docker digest ........ ${{ steps.task_release_gh_push.outputs.digest }}"
# #
# Release Github Get Weekly Commits
# #
- name: '🕛 Get Weekly Commit List'
id: task_release_set_weekly_commit_list
run: |
echo 'WEEKLY_COMMITS<<EOF' >> $GITHUB_ENV
git log --format="[\`%h\`](${{ github.server_url }}/${{ github.repository }}/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# #
# Release Github Notify Github
# #
- name: '🔔 Send Discord Webhook Message'
id: task_release_notifications_discord_send
uses: tsickert/discord-webhook@v6.0.0
if: success()
with:
username: 'Io'
avatar-url: 'https://i.imgur.com/8BVDkla.jpg'
webhook-url: ${{ secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES }}
embed-title: "⚙️ ${{ github.workflow_ref }}"
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Github) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Github GHCR. The image is available at:
- https://github.com/${{ github.repository }}/pkgs/container/${{ env.IMAGE_NAME }}
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull ghcr.io/${{ env.DOCKER_IMAGE }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-arm64`
- Pull: `docker pull ghcr.io/${{ env.DOCKER_IMAGE }}@${{ steps.task_release_gh_push.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Github` https://github.com/${{ github.repository }}
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`
- Triggered By: `${{ github.actor }}`
- Status: `${{ job.status == 'success' && '✅ Successful' || '❌ Failed' }}`
### Tags
-# This docker image will use the following tags:
```
${{ steps.task_release_gh_meta.outputs.tags }}
```
### Labels
-# This docker image embeds the following labels:
```
${{ steps.task_release_gh_meta.outputs.labels }}
```
embed-color: ${{ job.status == 'success' && '5763719' || '15418782' }}
embed-footer-text: "Completed at ${{ env.NOW }} UTC"
embed-timestamp: "${{ env.NOW_LONG }}"
embed-author-name: "${{ github.repository_owner }}"
embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462"
# #
# Job Docker Release Github Amd64
# #
job-docker-release-github-amd64:
name: >-
📦 Release Github Amd64
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create, job-docker-release-github-arm64 ]
steps:
# #
@@ -502,12 +267,16 @@ jobs:
- name: '🕛 Get Timestamp'
id: task_release_set_timestamp
run: |
echo "DOCKER_IMAGE=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV}
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
echo "IMAGE_VERSION_1DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-1`" >> ${GITHUB_ENV} # 1
echo "IMAGE_VERSION_2DIGIT=`echo ${{ env.IMAGE_VERSION }} | cut -d '.' -f1-2`" >> ${GITHUB_ENV} # 1.0
echo "REGISTRY_REPO_ORG_AUTHOR_LC=`echo ${{ env.IMAGE_GHCR_AUTHOR }}/${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # thebinaryninja/tvapp2
echo "REGISTRY_REPO_AUTHOR_LC=`echo ${{ env.IMAGE_GHCR_AUTHOR }} | tr '[:upper:]' '[:lower:]'`" >> ${GITHUB_ENV} # thebinaryninja
echo "DOCKER_SHA=${GITHUB_SHA}" >> $GITHUB_ENV # 71fad013cfce9116ec62779e4a7e627fe4c33627
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV # 02-25-2025 12:49:48
echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV # 02-25-2025
echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV # 02-25-2025 12:49
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV # 20250225
echo "NOW_DOCKER_TS=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_ENV # 2025-02-25T12:50:11.569Z
# #
# Release Github Install Dependencies
@@ -525,7 +294,9 @@ jobs:
- name: '🔐 Apply dos2unix'
id: task_release_gh_dos2unix
run: |
echo "⚠️⚠️⚠️ Running DOS2UNIX ⚠️⚠️⚠️"
find ./ \( -path "./.git" -o -path "./docs" -o -path "./.github" -o -path "*.png" -o -path "*.jpg" \) -prune -o -name '*' -print | xargs dos2unix --
echo "✅✅✅ Completed DOS2UNIX ✅✅✅"
# #
# Release Github Fix Permissions
@@ -578,81 +349,273 @@ jobs:
password: ${{ secrets.ORG_BINARYNINJA_TOKEN_CL }}
# #
# Release Github Meta Amd64
# Release Github Read Readme
#
# @usage org.opencontainers.image.description=${{ steps.task_release_gh_readme_cache.outputs.content }}
# #
- name: '🔨 Github: Meta - Amd64'
- name: '📄 Cache README.md'
id: task_release_gh_readme_cache
uses: actions/github-script@v7
with:
github-token: ${{ secrets.ORG_BINARYNINJA_TOKEN_CL }}
script: |
'use strict'
const { promises: fs } = require('fs')
const main = async () => {
const path = "README.md"
let content = await fs.readFile(path, 'utf8')
core.setOutput('content', content)
}
main().catch(err => core.setFailed(err.message))
# #
# Release Github Meta
#
# this version of meta does not need one for amd64 and one for arm64 because both
# platforms are combined into one release, all sharing the same tags
# #
- name: '🔨 Github: Meta'
id: task_release_gh_meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.IMAGE_GHCR_AUTHOR }}/${{ env.IMAGE_NAME }}
ghcr.io/${{ env.REGISTRY_REPO_AUTHOR_LC }}/${{ env.IMAGE_NAME }}
tags: |
# latest yes
# tag latest = yes ( no dev )
type=raw,value=latest,enable=${{ !inputs.DEV_RELEASE }}
# tag add amd64
# type=raw,enable=true,priority=1000,value=amd64
# tag add pr tag ( PR or push only )
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=,event=tag
# dispatch add x1.x.x-amd64
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=300,prefix=,suffix=-amd64,value=${{ env.IMAGE_VERSION }}
# tag add 1.0.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=450,prefix=,suffix=,value=${{ env.IMAGE_VERSION }}
# dispatch add amd64-development
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=-amd64,value=development
# tag add 1.0 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=425,prefix=,suffix=,value=${{ env.IMAGE_VERSION_2DIGIT }}
# tag add tag-amd64
type=ref,enable=${{ github.event_name == 'pull_request' || github.event_name == 'push' }},priority=600,prefix=,suffix=-amd64,event=tag
# tag add 1 ( dispatch only + no dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == false }},priority=400,prefix=,suffix=,value=${{ env.IMAGE_VERSION_1DIGIT }}
# add development tag to default architecture (amd64)
# tag add development ( dispatch only + only dev )
type=raw,enable=${{ github.event_name == 'workflow_dispatch' && inputs.DEV_RELEASE == true }},priority=300,prefix=,suffix=,value=development
# tag add development ( amd64 + only dev )
type=raw,enable=${{ inputs.DEV_RELEASE }},priority=400,prefix=,suffix=,value=development
flavor: |
latest=${{ !inputs.DEV_RELEASE }}
latest=false
labels: |
org.opencontainers.image.VERSION=${{ env.IMAGE_VERSION }}
org.opencontainers.image.BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.IMAGE_GHCR_AUTHOR }}
org.opencontainers.image.ref.name=${{ env.ref_name }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=github
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
annotations: |
org.opencontainers.image.created=${{ env.NOW_DOCKER_TS }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=${{ env.REGISTRY_REPO_AUTHOR_LC }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.development=${{ inputs.DEV_RELEASE == true && 'true' || 'false' }}
org.opencontainers.image.registry=github
org.tvapp2.image.build-version="Version:- ${{ env.IMAGE_VERSION }} Date:- ${{ env.NOW_DOCKER_LABEL }}"
# #
# Release Github Build and Push Amd64
# #
- name: '📦 Build & Push (linux/amd64)'
id: task_release_gh_push
id: task_release_gh_push_amd64
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
allow: |
network.host
network: host
context: .
file: Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.task_release_gh_meta.outputs.tags }}
labels: ${{ steps.task_release_gh_meta.outputs.labels }}
tags: |
${{ steps.task_release_gh_meta.outputs.tags }}
annotations: |
${{ steps.task_release_gh_meta.outputs.annotations }}
provenance: false
sbom: false
build-args: |-
ARCH=amd64
RELEASE=${{ inputs.DEV_RELEASE == true && 'development' || 'stable' }}
VERSION=${{ env.IMAGE_VERSION }}
BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
# #
# Release Github Checkpoint Amd64
# Release Github Export Digest Amd64
# #
- name: '📄 Export Digest (linux/amd64)'
id: task_release_gh_digest_export_amd64
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
run: |
mkdir -p /tmp/build-digest-amd64
digest="${{ steps.task_release_gh_push_amd64.outputs.digest }}"
digest="${digest#sha256:}"
touch "/tmp/build-digest-amd64/$digest"
shell: bash
# #
# Release Github Upload Digest Amd64
# #
- name: '🔼 Upload Digest (linux/amd64)'
id: task_release_gh_digest_upload_amd64
uses: actions/upload-artifact@v4
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
name: digest-amd64
path: /tmp/build-digest-amd64/*
if-no-files-found: error
retention-days: 10
# #
# Release Github Build and Push Arm64
# #
- name: '📦 Build & Push (linux/arm64)'
id: task_release_gh_push_arm64
uses: docker/build-push-action@v6
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
allow: |
network.host
network: host
context: .
file: Dockerfile
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.task_release_gh_meta.outputs.labels }}
tags: |
${{ steps.task_release_gh_meta.outputs.tags }}
annotations: |
${{ steps.task_release_gh_meta.outputs.annotations }}
provenance: false
sbom: false
build-args: |-
ARCH=arm64
RELEASE=${{ inputs.DEV_RELEASE == true && 'development' || 'stable' }}
VERSION=${{ env.IMAGE_VERSION }}
BUILDDATE=${{ env.NOW_DOCKER_LABEL }}
# #
# Release Github Export Digest Arm64
# #
- name: '📄 Export Digest (linux/arm64)'
id: task_release_gh_digest_export_arm64
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
run: |
mkdir -p /tmp/build-digest-arm64
digest="${{ steps.task_release_gh_push_arm64.outputs.digest }}"
digest="${digest#sha256:}"
touch "/tmp/build-digest-arm64/$digest"
shell: bash
# #
# Release Github Upload Digest Arm64
# #
- name: '🔼 Upload Digest (linux/arm64)'
id: task_release_gh_digest_upload_arm64
uses: actions/upload-artifact@v4
if: ( github.event_name == 'workflow_dispatch' && inputs.DRY_RUN == false ) || ( github.event_name == 'push' )
with:
name: digest-arm64
path: /tmp/build-digest-arm64/*
if-no-files-found: error
retention-days: 10
# #
# Release Github Push Manifest
# #
- name: '📦 Push Manifest'
id: task_release_gh_manifest
uses: int128/docker-manifest-create-action@v2
with:
push: ${{ !inputs.DRY_RUN }}
tags: |
${{ steps.task_release_gh_meta.outputs.tags }}
sources: |
ghcr.io/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gh_push_amd64.outputs.digest }}
ghcr.io/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gh_push_arm64.outputs.digest }}
index-annotations: |
${{ steps.task_release_gh_meta.outputs.labels }}
# #
# Release Github Checkpoint
# #
- name: '⚠️ Checkpoint'
id: task_release_gh_checkpoint
run: |
echo "registry ............. Github"
echo "github.actor.......... ${{ github.actor }}"
echo "github.ref ........... ${{ github.ref }}"
echo "github.ref_name ...... ${{ github.ref_name }}"
echo "github.event_name .... ${{ github.event_name }}"
echo "inputs.DRY_RUN ....... ${{ inputs.DRY_RUN }}"
echo "env.AUTHOR ........... ${{ env.IMAGE_GHCR_AUTHOR }}"
echo "tags ................. ${{ steps.task_release_gh_meta.outputs.tags }}"
echo "labels ............... ${{ steps.task_release_gh_meta.outputs.labels }}"
echo "docker image ......... ${{ env.DOCKER_IMAGE }}"
echo "docker sha ........... ${{ env.DOCKER_SHA }}"
echo "docker image id ...... ${{ steps.task_release_gh_push.outputs.imageid }}"
echo "docker digest ........ ${{ steps.task_release_gh_push.outputs.digest }}"
echo ""
echo "[ GITHUB ] ---------------------------------------------------------------------------------------------"
echo "github.actor.............................. ${{ github.actor }}"
echo "github.ref ............................... ${{ github.ref }}"
echo "github.ref_name .......................... ${{ github.ref_name }}"
echo "github.event_name ........................ ${{ github.event_name }}"
echo "github.repository_owner .................. ${{ github.repository_owner }}"
echo "github.repository ........................ ${{ github.repository }}"
echo ""
echo "[ INPUTS ] ---------------------------------------------------------------------------------------------"
echo "inputs.IMAGE_NAME ........................ ${{ inputs.IMAGE_NAME }}"
echo "inputs.IMAGE_VERSION ..................... ${{ inputs.IMAGE_VERSION }}"
echo "inputs.IMAGE_GHCR_AUTHOR ................. ${{ inputs.IMAGE_GHCR_AUTHOR }}"
echo "inputs.IMAGE_GHCR_USERNAME ............... ${{ inputs.IMAGE_GHCR_USERNAME }}"
echo "inputs.DEV_RELEASE ....................... ${{ inputs.DEV_RELEASE }}"
echo "inputs.DRY_RUN ........................... ${{ inputs.DRY_RUN }}"
echo ""
echo "[ ENV ] ------------------------------------------------------------------------------------------------"
echo "env.IMAGE_NAME ........................... ${{ env.IMAGE_NAME }}"
echo "env.IMAGE_VERSION ........................ ${{ env.IMAGE_VERSION }}"
echo "env.IMAGE_VERSION_1DIGIT ................. ${{ env.IMAGE_VERSION_1DIGIT }}"
echo "env.IMAGE_VERSION_2DIGIT ................. ${{ env.IMAGE_VERSION_2DIGIT }}"
echo "env.IMAGE_GHCR_AUTHOR .................... ${{ env.IMAGE_GHCR_AUTHOR }}"
echo "env.IMAGE_GHCR_USERNAME .................. ${{ env.IMAGE_GHCR_USERNAME }}"
echo "env.NOW .................................. ${{ env.NOW }}"
echo "env.NOW_SHORT ............................ ${{ env.NOW_SHORT }}"
echo "env.NOW_LONG ............................. ${{ env.NOW_LONG }}"
echo "env.NOW_DOCKER_LABEL ..................... ${{ env.NOW_DOCKER_LABEL }}"
echo "env.NOW_DOCKER_TS ........................ ${{ env.NOW_DOCKER_TS }}"
echo "env.DOCKER_IMAGE ......................... ${{ env.DOCKER_IMAGE }}"
echo "env.REGISTRY_REPO_ORG_AUTHOR_LC .......... ${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}"
echo "env.REGISTRY_REPO_AUTHOR_LC .............. ${{ env.REGISTRY_REPO_AUTHOR_LC }}"
echo "env.DOCKER_SHA ........................... ${{ env.DOCKER_SHA }}"
echo ""
echo "[ DOCKER IMAGES ] --------------------------------------------------------------------------------------"
echo "registry ................................. Github GHCR"
echo "tags ..................................... ${{ steps.task_release_gh_meta.outputs.tags }}"
echo "labels ................................... ${{ steps.task_release_gh_meta.outputs.labels }}"
echo "digest ................................... ${{ steps.task_release_gh_push_amd64.outputs.digest }}"
echo ""
echo "(release) tags ........................... ${{ steps.task_release_gh_meta.outputs.tags }}"
echo "(release) labels ......................... ${{ steps.task_release_gh_meta.outputs.labels }}"
echo ""
echo "[ DOCKER DIGESTS ] -------------------------------------------------------------------------------------"
echo "docker image id (amd64) .................. ${{ steps.task_release_gh_push_amd64.outputs.imageid }}"
echo "docker digest (amd64) .................... ${{ steps.task_release_gh_push_amd64.outputs.digest }}"
echo "docker image id (arm64) .................. ${{ steps.task_release_gh_push_arm64.outputs.imageid }}"
echo "docker digest (arm64) .................... ${{ steps.task_release_gh_push_arm64.outputs.digest }}"
# #
# Release Github Get Weekly Commits
@@ -670,7 +633,7 @@ jobs:
# #
- name: '🔔 Send Discord Webhook Message'
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -680,19 +643,20 @@ jobs:
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-thumbnail-url: 'https://i.imgur.com/zDIzE8T.jpg'
embed-description: |
## 📦 Docker Deploy (Github) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
### 📦 Deploy (Github) ${{ job.status == 'success' && '✅' || '❌' }} `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
${{ inputs.DEV_RELEASE == true && '### ⚠️⚠️ Development / Pre-release ⚠️⚠️' || '' }}
A new version of the docker container `${{ env.IMAGE_NAME }}` has been released from Github to Github GHCR. The image is available at:
- https://github.com/${{ github.repository }}/pkgs/container/${{ env.IMAGE_NAME }}
- Version: `${{ env.IMAGE_VERSION }}`
- Release Type: `${{ inputs.DEV_RELEASE == true && '⚠️⚠️ Development / Pre-release ⚠️⚠️' || 'Stable' }}`
- Pull: `docker pull ghcr.io/${{ env.DOCKER_IMAGE }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}-amd64`
- Pull: `docker pull ghcr.io/${{ env.DOCKER_IMAGE }}@${{ steps.task_release_gh_push.outputs.digest }}`
- Pull: `docker pull ghcr.io/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}:${{ inputs.DEV_RELEASE == true && 'development' || env.IMAGE_VERSION }}`
- Pull (amd64): `docker pull ghcr.io/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gh_push_amd64.outputs.digest }}`
- Pull (arm64): `docker pull ghcr.io/${{ env.REGISTRY_REPO_ORG_AUTHOR_LC }}@${{ steps.task_release_gh_push_arm64.outputs.digest }}`
- Dry Run: `${{ inputs.DRY_RUN }}`
- Source: `Github` https://github.com/${{ github.repository }}
- Docker Image: `${{ env.IMAGE_NAME }}-${{ env.IMAGE_VERSION }}${{ inputs.DEV_RELEASE == true && '-development' || '' }}`
- Version: `${{ env.IMAGE_VERSION }}`
- Branch: `${{ github.ref_name }}`
- Workflow: `${{ github.workflow }} (#${{github.run_number}})`
- Runner: `${{ runner.name }}`
@@ -718,3 +682,55 @@ jobs:
embed-author-name: "${{ github.repository_owner }}"
embed-author-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-author-icon-url: "https://avatars.githubusercontent.com/u/200161462"
# #
# Job Docker Release Cleanup
# #
job-docker-release-cleanup:
name: >-
🧹 Release Cleanup
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 5
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs: [ job-docker-release-tags-create, job-docker-release-github ]
steps:
# #
# Release Cleanup
# #
- name: '🏳️ Start'
id: task_cleanup_gh_start
run: |
echo "Cleaning up untagged docker images"
# #
# Release Cleanup Checkout
# #
- name: '✅ Checkout'
id: task_cleanup_gh_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Release Cleanup Clean Untagged Images
# #
- name: '🧹 Clean Untagged Images'
id: task_cleanup_clean
uses: quartx-analytics/ghcr-cleaner@v1
with:
owner-type: org
token: ${{ secrets.ORG_BINARYNINJA_TOKEN_CL }}
repository-owner: ${{ github.repository_owner }}
repository-name: ${{ github.repository }}
delete-untagged: true
# keep-at-most: 0

View File

@@ -1,16 +1,38 @@
# #
# @type github workflow
# @desc builds mkdocs from the main branch /docs/ folder and puts the compiled version
# in the `gh-pages` branch. Is hosted using Github Pages.
#
# @update pip install --upgrade mkdocs
# pip install --upgrade --force-reinstall mkdocs-material
#
# @author Aetherinox
# @url https://github.com/Aetherinox
# @usage builds mkdocs from the main branch /docs/ folder and puts the compiled version
# in the `gh-pages` branch. Is hosted using Github Pages.
#
# @secrets secrets.SELF_TOKEN_CL Github Access Token (Classic)
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKfLOWS Discord Webbhook URL; right-click on channel, click "Integrations"
# @update use the following commands to update mkdocs and the mkdocs-material theme:
# pip install --upgrade mkdocs
# pip install --upgrade --force-reinstall mkdocs-material
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/documentation.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/documentation.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "📒 Docs Build"
@@ -21,13 +43,55 @@ run-name: "📒 Docs Build"
# #
on:
# #
# Trigger Release
#
# update documentation every time a release is made
# #
release:
types:
- published
# #
# Trigger Push
#
# update documentation every time a file in docs/ folder is modified
# #
push:
paths:
- docs/**
# #
# Trigger Workflow Dispatch
#
# If any values are not provided, will use fallback env variable
# #
workflow_dispatch:
inputs:
# #
# Image Name
#
# used in github image path
# ghcr.io/${{ env.IMAGE_GHCR_AUTHOR }}/${{ env.IMAGE_NAME }}
# #
WORKING_DIR:
description: '📁 Docs Folder'
required: true
default: './docs/site'
type: string
# #
# Trigger Cron
#
# update documentation every X hours
# #
schedule:
- cron: "0 */12 * * *"
@@ -36,9 +100,12 @@ on:
# #
env:
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
WORKING_DIR: ${{ github.event.inputs.WORKING_DIR || './docs/site' }}
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
# #
# jobs
@@ -82,7 +149,8 @@ jobs:
# Documentation Setup Python
# #
- name: "🐍 Setup Python"
- name: >-
🐍 Setup Python
id: task_docs_python_setup
uses: actions/setup-python@v5
with:
@@ -104,6 +172,7 @@ jobs:
pip install mkdocs
pip install mkdocs-material
pip install mike
pip install mkdocs-embed-external-markdown
pip install mkdocs-git-committers-plugin-2
pip install mkdocs-encryptcontent-plugin
pip install mkdocs-redirects mkdocs-glightbox pymdown-extensions mkdocs-git-revision-date-localized-plugin mkdocs-git-authors-plugin mkdocs-link-embeds-plugin
@@ -117,12 +186,13 @@ jobs:
# Documentation Deploy
# #
- name: "💽 Deploy"
- name: >-
💽 Deploy
id: task_docs_deploy
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.ADMINSERV_TOKEN_CL }}
publish_dir: ./docs/site
publish_dir: "${{ env.WORKING_DIR }}"
# #
@@ -144,7 +214,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Success)
id: task_docs_notify_discord_success
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -178,7 +248,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Failure)
id: task_docs_notify_discord_failure
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: failure()
with:
username: 'Io'

View File

@@ -1,15 +1,40 @@
# #
# @type github workflow
# @desc searches a new issues title and body for certain keywords and assigns a label
# sets the assignee for the issue to the repository owner
# @author Aetherinox
# @url https://github.com/Aetherinox
# @usage searches a new issues title and body for certain keywords and assigns a label
# sets the assignee for the issue to the repository owner
#
# requires the following labels to be created in your repo:
# - bug
# - feature
# - urgent
# - roadmap
# @notes requires the following labels to be created in your repo:
# - bug
# - feature
# - urgent
# - roadmap
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/issues-new.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/issues-new.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "🎫 Issue New"
@@ -30,28 +55,31 @@ on:
# #
env:
PREFIX_BUG: "Bug"
PREFIX_DEPENDENCY: "Dependency"
PREFIX_DOCS: "Docs"
PREFIX_FEATURE: "Feature"
PREFIX_GIT: "Git Action"
PREFIX_PR: "PR"
PREFIX_ROADMAP: "Roadmap"
PREFIX_INTERNAL: "Internal"
PREFIX_URGENT: "Urgent"
PREFIX_BUG: "🐛 Bug"
PREFIX_DEPENDENCY: "Dependency"
PREFIX_DOCS: "Docs"
PREFIX_FEATURE: "💡 Feature"
PREFIX_GIT: "Git Action"
PREFIX_PR: "PR"
PREFIX_ROADMAP: "🗺️ Roadmap"
PREFIX_INTERNAL: "Internal"
PREFIX_URGENT: "Urgent"
LABEL_BUG: "Type ◦ Bug"
LABEL_DEPENDENCY: "Type ◦ Dependency"
LABEL_DOCS: "Type ◦ Docs"
LABEL_FEATURE: "Type ◦ Feature"
LABEL_GIT: "Type ◦ Git Action"
LABEL_PR: "Type ◦ Pull Request"
LABEL_ROADMAP: "Type ◦ Roadmap"
LABEL_INTERNAL: "Type ◦ Git Action"
LABEL_URGENT: "⚠ Urgent"
LABEL_BUG: "Type ◦ Bug"
LABEL_DEPENDENCY: "Type ◦ Dependency"
LABEL_DOCS: "Type ◦ Docs"
LABEL_FEATURE: "Type ◦ Feature"
LABEL_GIT: "Type ◦ Git Action"
LABEL_PR: "Type ◦ Pull Request"
LABEL_ROADMAP: "Type ◦ Roadmap"
LABEL_INTERNAL: "Type ◦ Internal"
LABEL_URGENT: "⚠ Urgent"
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
LABELS_JSON: |
[
@@ -131,8 +159,7 @@ jobs:
job-labels-create:
name: >-
🎫 Labels Verify Existing
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
@@ -204,8 +231,7 @@ jobs:
🏷️ Labels Assign
needs:
- job-labels-create
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
permissions:
contents: 'read'
@@ -291,7 +317,7 @@ jobs:
https://regex101.com/r/Z99Gnq/2
*/
const findWordList = /^\b(?:I?\s*have\s*(?:a|an)\s*(?:issue|problem|bug))|(?:will\s*not\s*work)|(?:it\s*is\s*(?:broken|broke|stuck))|(?:found\s*(?:an?|the)\s*(?:bug|issue))|(?:can\s*I\s*fix\s*the\s*(?:bug|issue))|(?:(?:does not|doesn'?t|don'?t|won'?t|can'?t|can\s?not|will\s*not)\s*(?:work|load|function))|(?:it\s*(?:will\s?not|won'?t|can\s?not|can'?t))\s*(?:get|find)\s*the\s*(?:website|site|webpage|page)|(?:the\s*(?:window|frame)\s*is\s*(?:blank|white|empty|missing))\b$/igm;
const findWordList = /^\b(?:I?\s*have\s*(?:a|an)\s*(?:issue|problem|bug))|(?:problem\swith)|(?:will\s*not\s*work)|(?:it\s*is\s*(?:broken|broke|stuck))|(?:found\s*(?:an?|the)\s*(?:bug|issue))|(?:can\s*I\s*fix\s*the\s*(?:bug|issue))|(?:(?:does not|doesn'?t|don'?t|won'?t|can'?t|can\s?not|will\s*not)\s*(?:work|load|function))|(?:it\s*(?:will\s?not|won'?t|can\s?not|can'?t))\s*(?:get|find)\s*the\s*(?:website|site|webpage|page)|(?:the\s*(?:window|frame)\s*is\s*(?:blank|white|empty|missing))\b$/igm;
const bFoundMatchTitle = Boolean( findWordList.test( iss_title ) );
const bFoundMatchBody = Boolean( findWordList.test( iss_body ) );
@@ -306,7 +332,7 @@ jobs:
const bug_bFoundPRTitle = Boolean( bug_findPRTitle.test( iss_title ) );
console.log( "Title Lowercase ............... " + iss_title_lc )
console.log( "Startswith " + bug_tag.toLowerCase( ) + "................ " + iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) )
console.log( "Startswith " + bug_tag.toLowerCase( ) + "................ " + iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) )
console.log( "Title Includes Keyword ........ " + bTriggerWordInTitle )
console.log( "Title Includes Regex .......... " + bFoundMatchTitle )
console.log( "Body Includes Regex ........... " + bFoundMatchBody )
@@ -317,45 +343,45 @@ jobs:
- Check if title contains word in words
*/
if ( iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
if ( iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
{
console.log( "⚠️ " + bug_tag + " ---------------------------------------" )
console.log( "Already starts with " + bug_tag + " ......... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + feat_tag + " ..... " + iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + urgn_tag + " ...... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + road_tag + " ..... " + iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
console.log( "⚠️ " + bug_tag + " ---------------------------------------" )
console.log( "Already starts with " + bug_tag + " ......... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) )
console.log( "Already starts with " + feat_tag + " ..... " + iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) )
console.log( "Already starts with " + urgn_tag + " ...... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) )
console.log( "Already starts with " + road_tag + " ..... " + iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
add_labels.push( `${ bug_lbl }` );
add_labels.push( `${ bug_lbl }` );
console.log( `Adding Tag ....................... ${ bug_lbl }` )
console.log( "\n" )
console.log( `Adding Tag ....................... ${ bug_lbl }` )
console.log( "\n" )
if ( iss_author === `${{ env.BOT_NAME_DEPENDABOT }}` )
core.info( `Skipping: Detected ${ iss_author }` )
if ( iss_author === `${{ env.BOT_NAME_DEPENDABOT }}` )
core.info( `Skipping: Detected ${ iss_author }` )
// Rename title to contain Bug:
// Make sure issue / pr title doesnt already contain a beginning title tag
// Rename title to contain Bug:
// Make sure issue / pr title doesnt already contain a beginning title tag
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !bug_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
{
console.log( "Renaming Title" )
console.log( `Old Title: .................. ${ iss_title }` )
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !bug_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
{
console.log( "Renaming Title" )
console.log( `Old Title: .................. ${ iss_title }` )
const title = context.payload.issue.title
let title_new = title.replace( /^\s?bug\s*(.*?)\b/gi, '' );
title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' );
title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' );
iss_title = `${ bug_tag } ${ title_new }`;
}
const title = context.payload.issue.title
let title_new = title.replace( /^\s?bug\s*(.*?)\b/gi, '' );
title_new = title.replace( /^\s?fail\s*(.*?)\b/gi, '' );
title_new = title.replace( /^\s?issue\s*(.*?)\b/gi, '' );
iss_title = `${ bug_tag } ${ title_new }`;
}
console.log( `New Title: ...................... ${ iss_title }` )
console.log( `New Title: ...................... ${ iss_title }` )
await github.rest.issues.update(
{
owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number,
title: `${ iss_title }`, labels: add_labels
} );
await github.rest.issues.update(
{
owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number,
title: `${ iss_title }`, labels: add_labels
} );
}
core.setOutput( 'issue_title', iss_title )
@@ -435,7 +461,7 @@ jobs:
const feat_bFoundPRTitle = Boolean( feat_findPRTitle.test( iss_title ) );
console.log( "Title Lowercase ............... " + iss_title_lc )
console.log( "Startswith " + feat_tag.toLowerCase( ) + "............ " + iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) )
console.log( "Startswith " + feat_tag.toLowerCase( ) + "............ " + iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) )
console.log( "Title Includes Keyword ........ " + bTriggerWordInTitle )
console.log( "Title Includes Regex .......... " + bFoundMatchTitle )
console.log( "Body Includes Regex ........... " + bFoundMatchBody )
@@ -447,14 +473,14 @@ jobs:
*/
// change TAG per category
if ( iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
if ( iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
{
console.log( "⚠️ " + feat_tag + " ---------------------------------------" )
console.log( "Already starts with " + bug_tag + " ......... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + feat_tag + " ..... " + iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + urgn_tag + " ...... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + road_tag + " ..... " + iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + bug_tag + " ......... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) )
console.log( "Already starts with " + feat_tag + " ..... " + iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) )
console.log( "Already starts with " + urgn_tag + " ...... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) )
console.log( "Already starts with " + road_tag + " ..... " + iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
// change LBL per category
add_labels.push( `${ feat_lbl }` );
@@ -468,7 +494,7 @@ jobs:
// Rename title to contain Feature:
// Make sure issue / pr title doesnt already contain a beginning title tag
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !feat_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !feat_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
{
console.log( "Renaming Title" )
console.log( `Old Title: .................. ${ iss_title }` )
@@ -566,7 +592,7 @@ jobs:
const urgn_bFoundPRTitle = Boolean( urgn_findPRTitle.test( iss_title ) );
console.log( "Title Lowercase ............... " + iss_title_lc )
console.log( "Startswith " + urgn_tag.toLowerCase( ) + "............. " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) )
console.log( "Startswith " + urgn_tag.toLowerCase( ) + "............. " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) )
console.log( "Title Includes Keyword ........ " + bTriggerWordInTitle )
console.log( "Title Includes Regex .......... " + bFoundMatchTitle )
console.log( "Body Includes Regex ........... " + bFoundMatchBody )
@@ -578,14 +604,14 @@ jobs:
*/
// change TAG per category
if ( iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
if ( iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
{
console.log( "⚠️ " + urgn_tag + " ---------------------------------------" )
console.log( "Already starts with " + bug_tag + " ......... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + feat_tag + " ..... " + iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + urgn_tag + " ...... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + road_tag + " ..... " + iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + bug_tag + " ......... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) )
console.log( "Already starts with " + feat_tag + " ..... " + iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) )
console.log( "Already starts with " + urgn_tag + " ...... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) )
console.log( "Already starts with " + road_tag + " ..... " + iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
// change LBL per category
add_labels.push( `${ urgn_lbl }` );
@@ -599,7 +625,7 @@ jobs:
// Rename title to contain Urgent:
// Make sure issue / pr title doesnt already contain a beginning title tag
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !urgn_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !urgn_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
{
console.log( "Renaming Title" )
console.log( `Old Title: .................. ${ iss_title }` )
@@ -699,7 +725,7 @@ jobs:
const road_bFoundPRTitle = Boolean( road_findPRTitle.test( iss_title ) );
console.log( "Title Lowercase ............... " + iss_title_lc )
console.log( "Startswith " + road_tag.toLowerCase( ) + "............ " + iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
console.log( "Startswith " + road_tag.toLowerCase( ) + "............ " + iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
console.log( "Title Includes Keyword ........ " + bTriggerWordInTitle )
console.log( "Title Includes Regex .......... " + bFoundMatchTitle )
console.log( "Body Includes Regex ........... " + bFoundMatchBody )
@@ -711,14 +737,14 @@ jobs:
*/
// change TAG per category
if ( iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
if ( iss_title_lc.startsWith( road_tag.toLowerCase( ) ) || bTriggerWordInTitle || bFoundMatchTitle || bFoundMatchBody )
{
console.log( "⚠️ " + road_tag + " ---------------------------------------" )
console.log( "Already starts with " + bug_tag + " ...... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + feat_tag + " .. " + iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + urgn_tag + " ... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + road_tag + " .. " + iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
console.log( "Already starts with " + bug_tag + " ...... " + iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) )
console.log( "Already starts with " + feat_tag + " .. " + iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) )
console.log( "Already starts with " + urgn_tag + " ... " + iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) )
console.log( "Already starts with " + road_tag + " .. " + iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
// change LBL per category
add_labels.push( `${ road_lbl }` );
@@ -732,7 +758,7 @@ jobs:
// Rename title to contain Roadmap:
// Make sure issue / pr title doesnt already contain a beginning title tag
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !road_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ), 3 ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ), 3 ) )
if ( iss_author !== `${{ env.BOT_NAME_DEPENDABOT }}` && !road_bFoundPRTitle && !iss_title_lc.startsWith( bug_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( feat_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( urgn_tag.toLowerCase( ) ) && !iss_title_lc.startsWith( road_tag.toLowerCase( ) ) )
{
console.log( "Renaming Title" )
console.log( `Old Title: .................. ${ iss_title }` )
@@ -767,8 +793,7 @@ jobs:
🏷️ Labels Phrase Search
needs:
- job-labels-create
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
permissions:
contents: 'read'
@@ -854,8 +879,7 @@ jobs:
job-assign-assignees:
name: >-
✍️ Issue Assignees
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
needs: [ job-assign-labels ]
# disable

View File

@@ -1,12 +1,39 @@
# #
# @type github workflow
# @desc pull request autoscan
# @author Aetherinox
# @url https://github.com/Aetherinox
# @desc pull request auto-scan
# scans all of the files related to a particular pull request
# if the code in the files being submitted contains code that is forbidden,
# a report is generated and posted as a comment in the PR.
# sends notifications to discord using webhooks
# @author Aetherinox
# @url https://github.com/Aetherinox
#
# @notes skips title changes if the author of the PR is renovate[bat]
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/issues-scan.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/issues-scan.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "🎫 Issues Scan"
@@ -38,8 +65,11 @@ env:
LABEL_TYPE_DEPENDENCY: Type ◦ Dependency
LABEL_TYPE_GITACTION: Type ◦ Git Action
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
LABELS_JSON: |
[
@@ -110,13 +140,14 @@ env:
jobs:
# #
# Job [ Autoscan ]
# Job Autoscan
# #
pr-autoscan:
job-pr-autoscan:
name: 🎫 Issues Autoscan
# runs-on: ubuntu-latest
runs-on: apollo-x64
timeout-minutes: 10
timeout-minutes: 7
permissions:
contents: read
actions: read
@@ -195,15 +226,20 @@ jobs:
}
else
{
// Otherwise return issue number from commit
return (
const data = (
await github.rest.repos.listPullRequestsAssociatedWithCommit(
{
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[ 0 ].number;
).data[0];
if (data) {
return data.number;
} else {
return '32';
}
}
result-encoding: string
@@ -228,6 +264,7 @@ jobs:
if: |
( github.event_name == 'pull_request_target' ) || ( github.event_name == 'pull_request' ) || ( github.event_name == 'issue_comment' && contains( github.event.comment.html_url, '/pull/' ) && contains( github.event.comment.body, '/rescan' ) )
with:
token: ${{ secrets.ADMINSERV_TOKEN_CL || github.token }}
fetch-depth: 0
ref: "refs/pull/${{ steps.task_autocheck_issue_num_set.outputs.result }}/merge"
@@ -252,7 +289,7 @@ jobs:
- name: >-
📄 Get changed files
id: task_autocheck_changed_files_get
uses: tj-actions/changed-files@v45
uses: tj-actions/changed-files@v46
with:
separator: ","
@@ -298,16 +335,131 @@ jobs:
with:
github-token: ${{ secrets.ADMINSERV_TOKEN_CL }}
script: |
console.log('Running Autoscan')
console.log(JSON.stringify(context, null, 4));
console.log(JSON.stringify(github, null, 4));
let ct = context;
/* #
# Example PR used for local act testing
# Uncomment to use in local env
#
# can be tested using act:
# - https://github.com/nektos/act
# command:
# git pull https://github.com/username/repo
# act -W .github/workflows/issues-scan.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/issues-scan.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# */
/*
ct = {
"issue": {
"number": 32
},
"repo": {
"owner": "TheBinaryNinja",
"repo": "TVApp2"
},
"payload": {
"action": "synchronize",
"after": "f087c5bea8800f41018ef328463531ea247547ef",
"before": "a8bdd791b80b2fbb78169234690ccb61b9d014f1",
"number": 32,
"organization": {
"avatar_url": "https://avatars.githubusercontent.com/u/200161462?v=4",
"events_url": "https://api.github.com/orgs/TheBinaryNinja/events",
"hooks_url": "https://api.github.com/orgs/TheBinaryNinja/hooks",
"issues_url": "https://api.github.com/orgs/TheBinaryNinja/issues",
"login": "TheBinaryNinja",
"members_url": "https://api.github.com/orgs/TheBinaryNinja/members{/member}",
"public_members_url": "https://api.github.com/orgs/TheBinaryNinja/public_members{/member}",
"repos_url": "https://api.github.com/orgs/TheBinaryNinja/repos",
"url": "https://api.github.com/orgs/TheBinaryNinja"
},
"pull_request": {
"created_at": "2025-03-17T23:32:22Z",
"updated_at": "2025-03-17T23:32:22Z",
"url": "https://api.github.com/repos/TheBinaryNinja/tvapp2",
"title": "Test PR Workflow",
"head": {
"ref": "main"
},
"base": {
"ref": "main"
},
"user": {
"login": "Aetherinox"
},
"labels": [
{
"color": "146b4a",
"default": false,
"description": "Ready to be reviewed",
"id": 7821944832,
"name": "AC Passed",
"node_id": "LA_kwDONW-GkM8AAAAB0jloAA",
"url": "https://api.github.com/repos/TheBinaryNinja/tvapp2/labels/AC%20%E2%80%BA%20Passed"
},
{
"color": "8F1784",
"default": false,
"description": "Normal pull request",
"id": 7821944963,
"name": "Type ◦ Pull Request",
"node_id": "LA_kwDONW-GkM8AAAAB0jlogw",
"url": "https://api.github.com/repos/TheBinaryNinja/tvapp2/labels/Type%20%E2%97%A6%20Pull%20Request"
}
]
},
},
"eventName": "pull_request_target",
"sha": "c938f7a21247f69b29cf352d0c6890a63f260d47",
"ref": "refs/heads/main",
"workflow": "🎫 Issues Scan",
"action": "task_autocheck_run",
"actor": "renovate[bot]",
"job": "job-pr-autoscan",
"runNumber": 45,
"runId": 13911964505,
"apiUrl": "https://api.github.com",
"serverUrl": "https://github.com",
"graphqlUrl": "https://api.github.com/graphql"
}
*/
/* #
# if local env ct isn't used, set ct to context for production
# */
if (!ct) {
ct = context;
}
const fs = require( 'fs' );
const escape_html = ( unsafe ) => unsafe.replace( /&/g, '&amp;' ).replace( /</g, '&lt;' ).replace( />/g, '&gt;' ).replace( /"/g, '&quot;' ).replace( /'/g, '&#039;' );
const labels = [];
/* #
# Get existing labels and add to list
# */
const labelsExisting = await github.rest.issues.listLabelsOnIssue({
issue_number: ct.issue.number,
owner: ct.repo.owner,
repo: ct.repo.repo
})
labelsExisting.data.forEach(({ name }) => {
labels.push(name);
});
const files_List = `${{ steps.task_autocheck_changed_files_get.outputs.all_changed_files }}` || ''
const files_Array = files_List.split(',')
const branch_ref = `${ context.payload.pull_request.head.ref }`
const branch_ref = `${ ct.payload.pull_request.head.ref }`
let message = [ "\n<br />\n" ]
message.push ( "## Automatic Self-Check - #" + context.issue.number + "\n" );
message.push ( "## Automatic Self-Check - #" + ct.issue.number + "\n" );
message.push ( `The details of our automated scan for your pull request are listed below. If our scan detected errors, they must be corrected before this pull request will be advanced to the review stage:\n` );
message.push ( "\n<br />\n\n---\n\n<br />\n\n" );
message.push ( "### About\nThis pull request includes the following information:" );
@@ -315,7 +467,7 @@ jobs:
let bHasError = false;
let bHasWarning = false;
let date = new Date( `${ context.payload.pull_request.created_at }` );
let date = new Date( `${ ct.payload.pull_request.created_at }` );
date.toISOString( )
const actor = '${{ github.actor }}';
@@ -341,20 +493,20 @@ jobs:
let date_created = dateTimeformat( date ) + " UTC";
/*
context.payload.pull_request.base.repo.owner.login
*/
/* #
# ct.payload.pull_request.base.repo.owner.login
# */
let md_table =
`
| Category | Value |
| --- | --- |
| Title | [ ` + context.payload.pull_request.title + ` ](https://github.com/` + context.repo.owner + `/` + context.repo.repo + `/pull/` + context.payload.pull_request.number + `) |
| Title | [ ` + ct.payload.pull_request.title + ` ](https://github.com/` + ct.repo.owner + `/` + ct.repo.repo + `/pull/` + ct.payload.pull_request.number + `) |
| Created | [ ` + date_created + ` ](https://worldtimebuddy.com) |
| ID | ` + context.payload.pull_request.html_url + ` |
| Author | [ ` + context.payload.pull_request.user.login + ` ](https://github.com/` + context.repo.owner + `/) |
| Repo | [ ` + context.repo.repo + ` ](https://github.com/` + context.repo.owner + `/` + context.repo.repo + `) |
| Branch | [ ` + context.payload.pull_request.head.ref + `](https://github.com/` + context.repo.owner + `/` + context.repo.repo + `/tree/` + context.payload.pull_request.head.ref + `) ⇁ [ ` + context.payload.pull_request.base.ref + `](https://github.com/` + context.repo.owner + `/` + context.repo.repo + `/tree/` + context.payload.pull_request.base.ref + `) |
| ID | ` + ct.payload.pull_request.html_url + ` |
| Author | [ ` + ct.payload.pull_request.user.login + ` ](https://github.com/` + ct.repo.owner + `/) |
| Repo | [ ` + ct.repo.repo + ` ](https://github.com/` + ct.repo.owner + `/` + ct.repo.repo + `) |
| Branch | [ ` + ct.payload.pull_request.head.ref + `](https://github.com/` + ct.repo.owner + `/` + ct.repo.repo + `/tree/` + ct.payload.pull_request.head.ref + `) ⇁ [ ` + ct.payload.pull_request.base.ref + `](https://github.com/` + ct.repo.owner + `/` + ct.repo.repo + `/tree/` + ct.payload.pull_request.base.ref + `) |
| Added Files | ${{ steps.task_autocheck_changed_files_get.outputs.added_files_count }} |
| Modified Files | ${{ steps.task_autocheck_changed_files_get.outputs.all_modified_files_count }} |
| Renamed Files | ${{ steps.task_autocheck_changed_files_get.outputs.renamed_files_count }} |
@@ -389,12 +541,14 @@ jobs:
const type_dependency =
[
"dependabot/npm_and_yarn"
"dependabot/npm_and_yarn",
"renovate/github_actions"
];
const type_gitaction =
[
"dependabot/github_actions"
"dependabot/github_actions",
"renovate/github_actions"
];
const files_skipList =
@@ -715,7 +869,7 @@ jobs:
if ( bHasError == true )
{
labels.push( "${{ env.LABEL_CHECK_STATUS_FAILED }}" );
core.setFailed( "Pull Request Failed Autocheck: " + context.issue.number + ": " + context.payload.pull_request.title + "." );
core.setFailed( "Pull Request Failed Autocheck: " + ct.issue.number + ": " + ct.payload.pull_request.title + "." );
}
/*
@@ -729,21 +883,21 @@ jobs:
change pr title
*/
const pr_title = `${ context.payload.pull_request.title }`;
const pr_title_append = `PR ${ context.issue.number }:`;
const pr_title = `${ ct.payload.pull_request.title }`;
const pr_title_append = `PR ${ ct.issue.number }:`;
if ( !pr_title.startsWith( pr_title_append ) )
if ( !pr_title.startsWith( pr_title_append ) && actor != "${{ env.BOT_NAME_RENOVATE }}" )
{
await github.rest.pulls.update(
{
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
title: `${ pr_title_append } ${ context.payload.pull_request.title }`
owner: ct.repo.owner,
repo: ct.repo.repo,
pull_number: ct.issue.number,
title: `${ pr_title_append } ${ ct.payload.pull_request.title }`
} );
}
if ( !context.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_CHANGES_REQ }}" ).length > 0 )
if ( !ct.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_CHANGES_REQ }}" ).length > 0 )
labels.push( "${{ env.LABEL_CHECK_REVIEW_READY }}" );
}
@@ -754,24 +908,24 @@ jobs:
const bGitaction = type_gitaction.some( s => s.includes( branch_ref ) || branch_ref.includes( s ) );
const bDependency = type_dependency.some( s => s.includes( branch_ref ) || branch_ref.includes( s ) );
if ( actor == "${{ env.BOT_NAME_DEPENDABOT }}" && bDependency )
if ( actor == "${{ env.BOT_NAME_DEPENDABOT }}" && bDependency || actor == "${{ env.BOT_NAME_RENOVATE }}" && bDependency )
labels.push( "${{ env.LABEL_TYPE_DEPENDENCY }}" );
else if ( actor == "${{ env.BOT_NAME_DEPENDABOT }}" && bGitaction )
else if ( actor == "${{ env.BOT_NAME_DEPENDABOT }}" && bGitaction || actor == "${{ env.BOT_NAME_RENOVATE }}" && bGitaction )
labels.push( "${{ env.LABEL_TYPE_GITACTION }}" );
if ( context.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_CHANGES_REQ }}" ).length > 0 )
if ( ct.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_CHANGES_REQ }}" ).length > 0 )
labels.push( "${{ env.LABEL_CHECK_CHANGES_REQ }}" );
if (context.payload.pull_request.labels.filter(label => label.name === "${{ env.LABEL_CHECK_REBASE_REQ }}" ).length > 0 )
if (ct.payload.pull_request.labels.filter(label => label.name === "${{ env.LABEL_CHECK_REBASE_REQ }}" ).length > 0 )
labels.push( "${{ env.LABEL_CHECK_REBASE_REQ }}" );
if ( context.payload.pull_request.labels.filter(label => label.name === "${{ env.LABEL_CHECK_SECURITY_ERR }}" ).length > 0 )
if ( ct.payload.pull_request.labels.filter(label => label.name === "${{ env.LABEL_CHECK_SECURITY_ERR }}" ).length > 0 )
labels.push( "${{ env.LABEL_CHECK_SECURITY_ERR }}" );
if (context.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_STATUS_CHGMADE }}" ).length > 0 )
if (ct.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_STATUS_CHGMADE }}" ).length > 0 )
labels.push( "${{ env.LABEL_CHECK_STATUS_CHGMADE }}" );
if ( context.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_SCAN_SKIPPED }}" ).length > 0 )
if ( ct.payload.pull_request.labels.filter( label => label.name === "${{ env.LABEL_CHECK_SCAN_SKIPPED }}" ).length > 0 )
labels.push( "${{ env.LABEL_CHECK_SCAN_SKIPPED }}" );
labels.push( "${{ env.LABEL_TYPE_PR }}" );
@@ -782,9 +936,9 @@ jobs:
await github.rest.issues.setLabels(
{
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ct.issue.number,
owner: ct.repo.owner,
repo: ct.repo.repo,
labels,
} );
@@ -794,9 +948,9 @@ jobs:
await github.rest.issues.createComment(
{
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ct.issue.number,
owner: ct.repo.owner,
repo: ct.repo.repo,
body: message.join('\n'),
} );
@@ -819,7 +973,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Success)
id: task_autocheck_notify_discord_success
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -870,7 +1024,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Failure)
id: task_autocheck_notify_discord_failure
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: failure()
with:
username: 'Io'

View File

@@ -1,27 +1,51 @@
# #
# @type github workflow
# @desc creates repository labels if they are not yet installed
# issues marked as stale after 30 days, given tag Status 𐄂 Stale
# inactive issues closed after 180 days, given tag Status 𐄂 Locked
# inactive pr closed after 365 days, given tag Status 𐄂 Locked
# issues marked stale after 30 days, given tag Status 𐄂 Stale
# issues marked closed 7 days after being marked stale, given tag Status 𐄂 Autoclosed
# @author Aetherinox
# @url https://github.com/Aetherinox
# @usage creates repository labels if they are not yet installed
# issues marked as stale after 30 days, given tag Status 𐄂 Stale
# inactive issues closed after 180 days, given tag Status 𐄂 Locked
# inactive pr closed after 365 days, given tag Status 𐄂 Locked
# issues marked stale after 30 days, given tag Status 𐄂 Stale
# issues marked closed 7 days after being marked stale, given tag Status 𐄂 Autoclosed
#
# This Github action must be activated manually. This workflow script will do the
# following:
# @notes This Github action must be activated manually. This workflow script will do the following:
#
# - Scan issues / pull requests and make sure they have properly assigned labels:
# - `Bug`
# - `Feature`
# - `Urgent`
# - `Roadmap`
# - Scan issues / pull requests and make sure they have properly assigned labels:
# - `Bug`
# - `Feature`
# - `Urgent`
# - `Roadmap`
#
# - Workflow script will then scan each pr or issue and mark them as `Stale`
# if they haven't had any replies in 30 days.
# - Workflow script will then scan each pr or issue and mark them as `Stale`
# if they haven't had any replies in 30 days.
#
# - Workflow will `autoclose` pr or issues which haven't had action in `365 days`.
# - Workflow will `autoclose` pr or issues which haven't had action in `365 days`.
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/issues-stale.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/issues-stale.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "🎫 Issues Stale"
@@ -41,28 +65,32 @@ on:
# #
env:
PREFIX_BUG: "Bug"
PREFIX_DEPENDENCY: "Dependency"
PREFIX_DOCS: "Docs"
PREFIX_FEATURE: "Feature"
PREFIX_GIT: "Git Action"
PREFIX_PR: "PR"
PREFIX_ROADMAP: "Roadmap"
PREFIX_INTERNAL: "Internal"
PREFIX_URGENT: "Urgent"
PREFIX_BUG: "🐛 Bug"
PREFIX_DEPENDENCY: "Dependency"
PREFIX_DOCS: "Docs"
PREFIX_FEATURE: "💡 Feature"
PREFIX_GIT: "Git Action"
PREFIX_PR: "PR"
PREFIX_ROADMAP: "🗺️ Roadmap"
PREFIX_INTERNAL: "Internal"
PREFIX_URGENT: "Urgent"
LABEL_BUG: "Type ◦ Bug"
LABEL_DEPENDENCY: "Type ◦ Dependency"
LABEL_DOCS: "Type ◦ Docs"
LABEL_FEATURE: "Type ◦ Feature"
LABEL_GIT: "Type ◦ Git Action"
LABEL_PR: "Type ◦ Pull Request"
LABEL_ROADMAP: "Type ◦ Roadmap"
LABEL_INTERNAL: "Type ◦ Internal"
LABEL_URGENT: "⚠ Urgent"
LABEL_BUG: "Type ◦ Bug"
LABEL_DEPENDENCY: "Type ◦ Dependency"
LABEL_DOCS: "Type ◦ Docs"
LABEL_FEATURE: "Type ◦ Feature"
LABEL_GIT: "Type ◦ Git Action"
LABEL_PR: "Type ◦ Pull Request"
LABEL_ROADMAP: "Type ◦ Roadmap"
LABEL_INTERNAL: "Type ◦ Internal"
LABEL_URGENT: "⚠ Urgent"
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
LABELS_JSON: |
[
{ "name": "AC Changes Made", "color": "8F1784", "description": "Requested changes have been made and are pending a re-scan" },
@@ -141,8 +169,7 @@ jobs:
job-labels-create:
name: >-
🎫 Labels Verify Existing
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
@@ -218,8 +245,7 @@ jobs:
job-issues-nolabel:
name: >-
🎫 Labels Assign Missing
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
needs: job-labels-create
steps:
@@ -587,8 +613,7 @@ jobs:
job-issues-stale:
name: >-
💤 Check Stale
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
needs:
- job-labels-create
@@ -631,8 +656,7 @@ jobs:
job-issues-lock:
name: >-
🔒 Check Inactive
# runs-on: ubuntu-latest
runs-on: apollo-x64
runs-on: ubuntu-latest
timeout-minutes: 4
needs:
- job-labels-create

View File

@@ -4,10 +4,33 @@
# @author Aetherinox
# @url https://github.com/Aetherinox
#
# This Github action must be activated manually. This workflow script will do the
# following:
# @notes This Github action must be activated manually. This workflow script will do the following:
# - Remove all existing labels in repository
#
# - Remove all existing labels in repository
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/labels-clean.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/labels-clean.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "🎫 Labels Remove"
@@ -25,8 +48,12 @@ on:
# #
env:
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
LABELS_JSON: |
[
{ "name": "bug", "color": "8F1784", "description": "Default github label" },
@@ -230,7 +257,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Success)
id: task_label_notify_discord_success
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -266,7 +293,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Failure)
id: task_label_notify_discord_failure
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: failure()
with:
username: 'Io'

View File

@@ -1,22 +1,46 @@
# #
# @type github workflow
# @desc manually activated workflow to create issue labels
# @author Aetherinox
# @url https://github.com/Aetherinox
# @usage manually activated workflow to create issue labels
#
# This Github action must be activated manually. This workflow script will do the
# following:
# @notes This Github action must be activated manually. This workflow script will do the following:
#
# - Scan issues / pull requests and make sure they have properly assigned labels:
# - `Bug`
# - `Feature`
# - `Urgent`
# - `Roadmap`
# - Scan issues / pull requests and make sure they have properly assigned labels:
# - `Bug`
# - `Feature`
# - `Urgent`
# - `Roadmap`
#
# - Workflow script will then scan each pr or issue and mark them as `Stale`
# if they haven't had any replies in 30 days.
# - Workflow script will then scan each pr or issue and mark them as `Stale`
# if they haven't had any replies in 30 days.
#
# - Workflow will `autoclose` pr or issues which haven't had action in `365 days`.
# - Workflow will `autoclose` pr or issues which haven't had action in `365 days`.
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/labels-create.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/labels-create.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "🎫 Labels Create"
@@ -34,8 +58,12 @@ on:
# #
env:
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
LABELS_JSON: |
[
{ "name": "AC Changes Made", "color": "8F1784", "description": "Requested changes have been made and are pending a re-scan" },
@@ -217,7 +245,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Success)
id: task_label_notify_discord_success
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: success()
with:
username: 'Io'
@@ -253,7 +281,7 @@ jobs:
- name: >-
🔔 Send Discord Webhook Message (Failure)
id: task_label_notify_discord_failure
uses: tsickert/discord-webhook@v6.0.0
uses: tsickert/discord-webhook@v7.0.0
if: failure()
with:
username: 'Io'

View File

@@ -1,12 +1,37 @@
# #
# @type github workflow
# @desc publishes a new release on Github
# @author Aetherinox
# @url https://github.com/Aetherinox
# @usage publishes a new release on Github
#
# @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
# secrets.SELF_TOKEN_CL self github personal access token (classic)
# secrets.NPM_TOKEN self npmjs access token
# secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
# secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
# secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
# secrets.ORG_BINARYNINJA_TOKEN org github personal access token (fine-grained)
# secrets.ORG_BINARYNINJA_TOKEN_CL org github personal access token (classic)
# secrets.ORG_BINARYNINJA_DOCKERHUB_TOKEN org dockerhub secret
# secrets.ORG_BINARYNINJA_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
# secrets.BINARYSERV_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
# secrets.BINARYSERV_GPG_PASSPHRASE bot gpg private key passphrase
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_RELEASES discord webhook to report release notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_WORKFLOWS discord webhook to report workflow notifications from github to discord
# secrets.DISCORD_WEBHOOK_CHAN_GITHUB_TVAPP2_UPDATES discord webhook to report activity notifications from github to discord
#
# @local these workflows can be tested locally through the use of `act`
# https://github.com/nektos/act
# Extract act to folder
# Add system env var with path to act.exe
# Run the commands:
# git pull https://github.com/username/repo
# act -W .github/workflows/labels-create.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
# act -W .github/workflows/labels-create.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
# #
name: "📦 Release Github"
run-name: "📦 Release Github"
name: '📦 Release Github'
run-name: '📦 Release Github'
# #
# Triggers
@@ -22,10 +47,10 @@ on:
# #
PROJECT_NAME:
description: "📦 Name of App"
required: true
default: 'tvapp2'
type: string
description: '📦 Name of App'
required: true
default: 'tvapp2'
type: string
# #
# ENABLE: the changelog generated in releases tab will only display single commits.
@@ -33,10 +58,10 @@ on:
# #
CHANGELOG_MODE_COMMIT:
description: "📑 Use Commits Instead of PRs"
required: true
default: true
type: boolean
description: '📑 Use Commits Instead of PRs'
required: true
default: true
type: boolean
# #
# ENABLE: Will show all types of commits, including uncategorized
@@ -46,10 +71,10 @@ on:
# #
SHOW_UNCATEGORIZED:
description: "🗂️ Show Uncategorized Commits"
required: true
default: false
type: boolean
description: '🗂️ Show Uncategorized Commits'
required: true
default: false
type: boolean
# #
# ENABLE: released version will be marked as pre-release
@@ -57,10 +82,10 @@ on:
# #
PRERELEASE:
description: "🧪 Build RC (Pre-release)"
required: true
default: false
type: boolean
description: '🧪 Build RC (Pre-release)'
required: true
default: false
type: boolean
# #
# Release Candidate version number
@@ -69,23 +94,26 @@ on:
# #
VERSION_RC:
description: "🧪 RC (Pre-release) Ver (tvapp2-rc.v1)"
required: false
type: string
default: "1"
description: '🧪 RC (Pre-release) Ver (tvapp2-rc.v1)'
required: false
type: string
default: '1'
# #
# environment variables
# #
env:
PROJECT_NAME: ${{ github.event.inputs.PROJECT_NAME || 'tvapp2' }}
CHANGELOG_MODE_COMMIT: true
SHOW_UNCATEGORIZED: false
PRERELEASE: false
VERSION_RC: '1'
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
PROJECT_NAME: ${{ github.event.inputs.PROJECT_NAME || 'tvapp2' }}
CHANGELOG_MODE_COMMIT: true
SHOW_UNCATEGORIZED: false
PRERELEASE: false
VERSION_RC: '1'
ASSIGN_USER: Aetherinox
BOT_NAME_1: EuropaServ
BOT_NAME_2: BinaryServ
BOT_NAME_DEPENDABOT: dependabot[bot]
BOT_NAME_RENOVATE: renovate[bot]
# #
# Jobs
@@ -112,7 +140,7 @@ jobs:
# Initialize Start
# #
- name: "✅ Start"
- name: '✅ Start'
id: task_initialize_start
run: |
echo "Starting build"
@@ -134,24 +162,28 @@ jobs:
# Initialize Checkout
# #
- name: "☑️ Checkout"
- name: '☑️ Checkout'
id: task_initialize_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Initialize Get version from package.json VERSION value
# Initialize Set Package.json Version
# #
- name: "👁️‍🗨️ Package Version Set"
- name: '👁️‍🗨️ Package Version Set'
id: task_initialize_package_getversion
working-directory: ./tvapp2
run: |
VER=$(cat package.json | jq -r '.version')
echo "PACKAGE_VERSION=$VER" >> $GITHUB_OUTPUT
- name: "👁️‍🗨️ Package Version Get"
# #
# Initialize Get Package.json Version
# #
- name: '👁️‍🗨️ Package Version Get'
id: task_initialize_package_version_get
run: |
echo "VERSION: ${{ steps.task_initialize_package_getversion.outputs.PACKAGE_VERSION }}"
@@ -179,11 +211,11 @@ jobs:
# Release Checkout
# #
- name: "☑️ Checkout"
- name: '☑️ Checkout'
id: task_release_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0
# #
# Release Set Env Variables
@@ -202,7 +234,7 @@ jobs:
# Release Print Version Debug
# #
- name: "🪪 Test Next Job Version"
- name: '🪪 Test Next Job Version'
id: task_release_debug_print_ver
run: |
echo "VERSION: ${{ env.PACKAGE_VERSION }}"
@@ -211,11 +243,12 @@ jobs:
# Release Install package via NPM
# #
- name: "🪪 NPM Install"
- name: '🪪 NPM Install & Lint'
id: task_release_npm_install
working-directory: ./tvapp2
run: |
npm ci
npm run lint
env:
NODE_AUTH_TOKEN: ${{ secrets.SELF_TOKEN_CL }}
@@ -223,39 +256,39 @@ jobs:
# Release Execute npm generate so that a uuid and guid can be created
# #
- name: "🪪 Generate IDs"
- name: '🪪 Generate IDs'
id: task_release_npm_env_generate
working-directory: ./tvapp2
run: |
npm run root:generate
# #
# .ENV Get
# Release .ENV Get
# Get guid and uuid from env variable generated by npm
# #
- name: "🪪 .ENV Get"
- name: '🪪 .ENV Get'
id: task_release_dotenv_get
uses: falti/dotenv-action@v1
with:
path: "./tvapp2/.env"
# #
# .ENV Print (Debug)
# Release .ENV Print (Debug)
# Show guid and uuid from env variable generated by npm
# #
- name: "🪪 .ENV Read"
- name: '🪪 .ENV Read'
id: task_dotenv_debug_print
run: |
echo "GUID: ${{ steps.task_release_dotenv_get.outputs.GUID }}"
echo "UUID: ${{ steps.task_release_dotenv_get.outputs.UUID }}"
# #
# Build Project & Create Zip
# Release Build Stable
# #
- name: "🔨 Build Stable ( ${{ env.PROJECT_NAME }}-${{ env.PACKAGE_VERSION }}.zip )"
- name: '🔨 Build Stable ( ${{ env.PROJECT_NAME }}-${{ env.PACKAGE_VERSION }}.zip )'
id: task_release_build_st
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
run: |
@@ -267,7 +300,11 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
- name: "🔨 Build RC ( ${{ env.PROJECT_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip )"
# #
# Release Build Release Candidate
# #
- name: '🔨 Build RC ( ${{ env.PROJECT_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip )'
id: task_release_build_rc
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
run: |
@@ -280,14 +317,14 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
# #
# [ Tag ]: Pre Create
# Release Tag Pre Create
#
# in order to use the changelog github action, you must pre-create the tag otherwise
# the changelog action will have no idea what tag you are going to be creating and
# the list of commits will not be for the correct release.
# #
- name: "🔖 Tag Pre Create ${{ env.PACKAGE_VERSION }}"
- name: '🔖 Tag Pre Create ${{ env.PACKAGE_VERSION }}'
id: task_release_tag_create
uses: rickstaa/action-create-tag@v1
with:
@@ -298,22 +335,22 @@ jobs:
gpg_passphrase: ${{ secrets.ADMINSERV_GPG_PASSPHRASE }}
# #
# [ Tag ]: Confirm
# Release Tag Confirm
#
# check if tag already exists
# #
- name: "🔖 Tag Confirm ${{ env.PACKAGE_VERSION }}"
- name: '🔖 Tag Confirm ${{ env.PACKAGE_VERSION }}'
id: task_release_tag_get
run: |
echo "Tag already present: ${{ env.TAG_EXISTS }}"
echo "Tag already present: ${{ steps.task_release_tag_create.outputs.tag_exists }}"
# #
# Checksum Generate
# Release Checksum Stable
# #
- name: "🆔 Checksum Stable"
- name: '🆔 Checksum Stable'
id: task_release_checksum_st_set
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
run: |
@@ -327,7 +364,11 @@ jobs:
sha256_compose="$(shasum --algorithm 256 ${filename_compose_zip} | awk '{ print $1 }')"
echo "FILE_COMPOSE_ZIP=${filename_compose_zip}" >> $GITHUB_ENV
- name: "🆔 Checksum RC"
# #
# Release Checksum Release Candidate
# #
- name: '🆔 Checksum RC'
id: task_release_checksum_rc_set
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
run: |
@@ -342,19 +383,19 @@ jobs:
echo "FILE_COMPOSE_ZIP=${filename_compose_zip}" >> $GITHUB_ENV
# #
# Checksum Print
# Release Checksum Print
# #
- name: "🆔 Checksum Print"
- name: '🆔 Checksum Print'
id: task_release_checksum_st_get
run: |
echo ${{ env.SHA256SUM }}
echo "${{ env.SHA256SUM }}"
# #
# Contributor Images
# Release Contributor Images
# #
- name: "🥸 Contributors Generate"
- name: '🥸 Contributors Generate'
id: task_release_contribs_generate
uses: jaywcjlove/github-action-contributors@main
with:
@@ -363,10 +404,10 @@ jobs:
avatarSize: 42
# #
# Checksum Add to ZIP file
# Release Checksum Add (Stable)
# #
- name: "📦 Zip Add Checksum Stable"
- name: '📦 Zip Add Checksum Stable'
id: task_release_zip_st
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
run: |
@@ -374,7 +415,11 @@ jobs:
zip -jr ${{ env.PROJECT_NAME }}-${{ env.PACKAGE_VERSION }}.zip SHA256SUMS.txt
ls
- name: "📦 Zip Add Checksum RC"
# #
# Release Checksum Add (Release Candidate)
# #
- name: '📦 Zip Add Checksum RC'
id: task_release_zip_rc
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
run: |
@@ -383,24 +428,30 @@ jobs:
ls
# #
# Changelog Generate
#
# generates a changelog from the github api. requires a PREVIOUS_TAG in order to figure
# out the changes made between the two versions.
#
# outputs:
# ${{ steps.changelog.outputs.changelog }}
# Release Generate Tags
# #
- name: "📝 Changelog Pre Setup (Categorized Commits)"
- name: '📝 Changelog Pre Setup (Categorized Commits)'
id: task_release_changelog_categorized_sha_set
run: |
echo "TAG_LAST=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "COMMIT_LAST=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: "📝 Changelog Build (Categorized)"
# #
# Release Changelog Build (Categorized)
#
# generates a changelog from the github api. requires a TAG_LAST in order to figure
# out the changes made between the two versions.
#
# outputs:
# ${{ steps.task_release_changelog_categorized.outputs.changelog }}
# #
- name: '📝 Changelog Build (Categorized)'
id: task_release_changelog_categorized
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, false ) }}
if: |
startsWith( inputs.SHOW_UNCATEGORIZED, false ) ||
startsWith( env.SHOW_UNCATEGORIZED, false )
uses: mikepenz/release-changelog-builder-action@v5
with:
token: ${{ secrets.ADMINSERV_TOKEN }}
@@ -408,7 +459,7 @@ jobs:
#toTag: "${{ github.ref }}"
configuration: ".github/changelog-configuration.json"
ignorePreReleases: false
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT }}
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT || env.CHANGELOG_MODE_COMMIT }}
fetchReleaseInformation: true
fetchViaCommits: true
configurationJson: |
@@ -419,14 +470,24 @@ jobs:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }}
# #
# Release Changelog Build (Uncategorized)
#
# generates a changelog from the github api. requires a TAG_LAST in order to figure
# out the changes made between the two versions.
#
# outputs:
# ${{ steps.task_release_changelog_categorized.outputs.changelog }}
#
# shows only categorized commits using the commit standards
# type(scope): description
# type: description
# #
- name: "📝 Changelog Build (Uncategorized)"
- name: '📝 Changelog Build (Uncategorized)'
id: task_release_changelog_uncategorized
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, true ) }}
if: |
startsWith( inputs.SHOW_UNCATEGORIZED, true ) ||
startsWith( env.SHOW_UNCATEGORIZED, true )
uses: mikepenz/release-changelog-builder-action@v5
with:
token: ${{ secrets.ADMINSERV_TOKEN }}
@@ -434,7 +495,7 @@ jobs:
#toTag: "${{ github.ref }}"
configuration: ".github/changelog-configuration.json"
ignorePreReleases: false
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT }}
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT || env.CHANGELOG_MODE_COMMIT }}
fetchReleaseInformation: true
fetchViaCommits: true
configurationJson: |
@@ -445,32 +506,66 @@ jobs:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }}
# #
# Changelog Fetch
# Release Changelog Convert step into ENV
#
# This is a requirement in order for the action mikepenz/release-changelog-builder-action@v5 to work properly.
# If you use special characters like quotes and tildes in your push comments, bash will have no way of knowing
# if it's part of the changelog, or code itself.
#
# By converting the step into an env var, we quote the text, and it fixes the issue.
#
# For every step that you need to print the changelog text, first define the env var
# env:
# CHANGELOG_CATEGORIZED: ${{ steps.task_release_changelog_categorized.outputs.changelog }}
#
# Then you can call the changelog in the body / run command with
# echo "$CHANGELOG_CATEGORIZED"
# #
- name: "📝 Changelog Print (Categorized)"
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, false ) }}
- name: '🙊 Changelog Step to Env Categorized'
id: task_release_changelog_escape_categorized
if: |
startsWith( inputs.SHOW_UNCATEGORIZED, false ) ||
startsWith( env.SHOW_UNCATEGORIZED, false )
env:
CHANGELOG_CATEGORIZED: ${{ steps.task_release_changelog_categorized.outputs.changelog }}
run: |
echo "${{ steps.task_release_changelog_categorized.outputs.changelog }}"
echo "$CHANGELOG_CATEGORIZED"
- name: "📝 Changelog Print (Uncategorized)"
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, true ) }}
- name: '🙊 Changelog Step to Env Uncategorized'
id: task_release_changelog_escape_uncategorized
if: |
startsWith( inputs.SHOW_UNCATEGORIZED, true ) ||
startsWith( env.SHOW_UNCATEGORIZED, true )
env:
CHANGELOG_UNCATEGORIZED: ${{ steps.task_release_changelog_categorized.outputs.changelog }}
run: |
echo "${{ steps.task_release_changelog_uncategorized.outputs.changelog }}"
echo "$CHANGELOG_UNCATEGORIZED"
# #
# [ Release ]: Post Release
# Release List Tree
# #
- name: '⚙️ Debug Tree Listing'
id: task_release_debug_tree
run: |
tree
# #
# Release Post Release (Stable)
#
# outputs:
# [RELEASE ID]:
# ${{ steps.task_release_bundle_rc.outputs.id
# ${{ steps.task_release_bundle_st.outputs.id
# [RELEASE ID]:
# ${{ steps.task_release_bundle_rc.outputs.id
# ${{ steps.task_release_bundle_st.outputs.id
# #
- name: "🏳️ Post Stable"
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
uses: softprops/action-gh-release@v2
- name: '🏳️ Post Stable'
id: task_release_bundle_st
if: |
startsWith( inputs.PRERELEASE, false ) ||
startsWith( env.PRERELEASE, false )
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
with:
@@ -489,10 +584,21 @@ jobs:
${{ steps.task_release_changelog_categorized.outputs.changelog }}
${{ steps.task_release_changelog_uncategorized.outputs.changelog }}
# #
# Release Post Release (Release Candidate)
#
# outputs:
# [RELEASE ID]:
# ${{ steps.task_release_bundle_rc.outputs.id
# ${{ steps.task_release_bundle_st.outputs.id
# #
- name: "🏳️ Post Release Candidate"
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
uses: softprops/action-gh-release@v2
id: task_release_bundle_rc
if: |
startsWith( inputs.PRERELEASE, true ) ||
startsWith( env.PRERELEASE, true )
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }}
with:
@@ -515,17 +621,27 @@ jobs:
${{ steps.task_release_changelog_uncategorized.outputs.changelog }}
# #
# Print Status
# Release Print Status
#
# For every step that you need to print the changelog text, first define the env var
# env:
# CHANGELOG_CATEGORIZED: ${{ steps.task_release_changelog_categorized.outputs.changelog }}
#
# Then you can call the changelog in the body / run command with
# echo "$CHANGELOG_CATEGORIZED"
# #
- name: "🎛️ Status Print"
id: task_release_status_print
env:
CHANGELOG_CATEGORIZED: ${{ steps.task_release_changelog_categorized.outputs.changelog }}
CHANGELOG_UNCATEGORIZED: ${{ steps.task_release_changelog_categorized.outputs.changelog }}
run: |
echo "Printing Variables"
echo
echo "---- CHANGELOG ---------------------------------------------------------------"
echo "${{ steps.task_release_changelog_categorized.outputs.changelog }}"
echo "${{ steps.task_changelog_uncategorized.outputs.changelog }}"
echo "$CHANGELOG_CATEGORIZED"
echo "$CHANGELOG_UNCATEGORIZED"
echo "---- CHANGELOG ---------------------------------------------------------------"
echo ""
echo ""
@@ -539,7 +655,7 @@ jobs:
echo "---- CHANGELOG ---------------------------------------------------------------"
# #
# Upload artifacts > release files
# Release Upload Artifacts Release Files
# #
- name: >-
@@ -568,7 +684,7 @@ jobs:
steps:
# #
# Job Complete Download Artifacts
# Complete Download Artifacts
# #
- name: "📁 Download Saved Artifacts"
@@ -576,7 +692,7 @@ jobs:
uses: actions/download-artifact@v4
# #
# Job Complete Get publish timestamp
# Complete Get publish timestamp
# #
- name: >-
@@ -589,7 +705,7 @@ jobs:
echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
# #
# Job > Complete > Set ENVs
# Complete Set ENVs
# #
- name: "🕛 Get Env Vars"
@@ -602,7 +718,7 @@ jobs:
echo "SHA_STABLE=${release_stable_sha256}" >> $GITHUB_ENV
# #
# Job Complete Summary of publish
# Complete Summary of publish
# #
- name: "🆗 Completed: ${{ env.NOW }}"

0
.nojekyll Normal file
View File

58
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,58 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
<br />
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
<br />
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
<br />
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
<br />
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
<br />
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at `thebinaryninja [at] proton [dot] me`. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
<br />
## Attribution
This Code of Conduct is adapted from the [📄 Contributor Covenant][homepage], version 2.1, available at [https://contributor-covenant.org/version/2/1/][version]
[homepage]: http://contributor-covenant.org
[version]: https://www.contributor-covenant.org/version/2/1/

643
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,643 @@
<div align="center">
<h6>Contribution Guidelines for BinaryNinja Applications</h6>
<h1>♾️ Contributing ♾️</h1>
<br />
<!-- prettier-ignore-start -->
[![Version][github-version-img]][github-version-uri]
[![Downloads][github-downloads-img]][github-downloads-uri]
[![Size][github-size-img]][github-size-img]
[![Last Commit][github-commit-img]][github-commit-img]
[![Contributors][contribs-all-img]](#contributors-)
<!-- prettier-ignore-end -->
</div>
<br />
---
<br />
## About
Below are a list of ways that you can help contribute to this project, as well as policies and guides that explain how to get started.
Please review everything on this page before you submit your contribution.
<br />
---
<br />
- [About](#about)
- [Issues, Bugs, Ideas](#issues-bugs-ideas)
- [Contributing](#contributing)
- [Before Submitting Pull Requests](#before-submitting-pull-requests)
- [Conventional Commit Specification](#conventional-commit-specification)
- [Types](#types)
- [Example 1:](#example-1)
- [Example 2:](#example-2)
- [Committing](#committing)
- [Languages](#languages)
- [Python](#python)
- [Indentation](#indentation)
- [Line Length](#line-length)
- [Blank Lines](#blank-lines)
- [Imports](#imports)
- [Commenting](#commenting)
- [Casing](#casing)
- [NodeJS](#nodejs)
- [Prettier](#prettier)
- [ESLint](#eslint)
- [v9 \& Newer (Config)](#v9--newer-config)
- [v8 \& Older (Config)](#v8--older-config)
- [Packages](#packages)
- [Indentation](#indentation-1)
- [Style](#style)
- [Line Length](#line-length-1)
- [Commenting](#commenting-1)
- [Casing](#casing-1)
<br />
---
<br />
## Issues, Bugs, Ideas
Stuff happens, and sometimes as best as we try, there may be issues within this project that we are unaware of. That is the great thing about open-source; anyone can use the program and contribute to making it better.
<br />
If you have found a bug, have an issue, or maybe even a cool idea; you can let us know by [submitting it](https://github.com/thebinaryninja/tvapp2/issues). However, before you submit your new issue, bug report, or feature request; head over to the [Issues Section](https://github.com/thebinaryninja/tvapp2/issues) and ensure nobody else has already submitted it.
<br />
Once you are sure that your issue has not already being dealt with; you may submit a new issue at [here](https://github.com/thebinaryninja/tvapp2/issues/new/choose). You'll be asked to specify exactly what your new submission targets, such as:
- Bug report
- Feature Suggestion
<br />
When writing a new submission; ensure you fill out any of the questions asked of you. If you do not provide enough information, we cannot help. Be as detailed as possible, and provide any logs or screenshots you may have to help us better understand what you mean. Failure to fill out the submission properly may result in it being closed without a response.
<br />
If you are submitting a bug report:
- Explain the issue
- Describe how you expect for a feature to work, and what you're seeing instead of what you expected.
- List possible options for a resolution or insight
- Provide screenshots, logs, or anything else that can visually help track down the issue.
<br />
<div align="center">
[![Submit Issue][btn-github-submit-img]][btn-github-submit-uri]
</div>
<br />
<div align="center">
**[`^ back to top ^`](#about)**
</div>
<br />
---
<br />
## Contributing
If you are looking to contribute to this project by actually submit your own code; please review this section completely. There is important information and policies provided below that you must follow for your pull request to get accepted.
The source is here for everyone to collectively share and collaborate on. If you think you have a possible solution to a problem; don't be afraid to get your hands dirty.
All contributions are made via pull requests. To create a pull request, you need a GitHub account. If you are unclear on this process, see [GitHub's documentation on forking and pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork). Pull requests should be targeted at the master branch.
<br />
### Before Submitting Pull Requests
- Follow the repository's code formatting conventions (see below);
- Include tests that prove that the change works as intended and does not add regressions;
- Document the changes in the code and/or the project's documentation;
- Your PR must pass the CI pipeline;
- When submitting your Pull Request, use one of the following branches:
- For bug fixes: `main` branch
- For features & functionality: `development` branch
- Include a proper git commit message following the [Conventional Commit Specification](https://conventionalcommits.org/en/v1.0.0/#specification).
<br />
If you have completed the above tasks, the pull request is ready to be reviewed and your pull request's label will be changed to "Ready for Review". At this point, a human will need to step in and manually verify your submission.
Reviewers will approve the pull request once they are satisfied with the patch it will be merged.
<br />
### Conventional Commit Specification
When committing your changes, we require you to follow the [Conventional Commit Specification](https://conventionalcommits.org/en/v1.0.0/#specification). The **Conventional Commits** is a specification for the format and content of a commit message. The concept behind Conventional Commits is to provide a rich commit history that can be read and understood by both humans and automated tools. Conventional Commits have the following format:
<br />
```
<type>[(optional <scope>)]: <description>
[optional <body>]
[optional <footer(s)>]
```
<br />
#### Types
Our repositories make use of the following commit tags:
<br />
| Type | Description |
| --- | --- |
| `feat` | <sup><sub>Introduce new feature</sub></sup> |
| `fix` | <sup><sub>Bug fix</sub></sup> |
| `chore` | <sup><sub>Includes technical or preventative maintenance task that is necessary for managing the app or repo, such as updating grunt tasks, but is not tied to any specific feature. Usually done for maintenance purposes.<br/>E.g: Edit .gitignore, .prettierrc, .prettierignore, .gitignore, eslint.config.js file</sub></sup> |
| `revert` | <sup><sub>Revert a previous commit</sub></sup> |
| `style` | <sup><sub>Update / reformat style of source code. Does not change the way app is implemented. Changes that do not affect the meaning of the code<br />E.g: white-space, formatting, missing semi-colons, change tabs to spaces, etc)</sub></sup> |
| `docs` | <sup><sub>Change website or markdown documents. Does not mean changes to the documentation generator script itself, only the documents created from the generator. <br/>E.g: documentation, readme.md or markdown |
| `build` | <sup><sub>Changes to the build / compilation / packaging process or auxiliary tools such as doc generation<br />E.g: create new build tasks, update release script, etc.</sub></sup> |
| `refactor` | <sup><sub>Change to production code that leads to no behavior difference,<br/>E.g: split files, rename variables, rename package, improve code style, etc.</sub></sup> |
| `test` | <sup><sub>Add or refactor tests, no production code change. Changes the suite of automated tests for the app.</sub></sup> |
| `ci` | <sup><sub>Changes related to Continuous Integration (usually `yml` and other configuration files).</sub></sup> |
| `perf` | <sup><sub>Performance improvement of algorithms or execution time of the app. Does not change an existing feature.</sub></sup> |
<br />
##### Example 1:
```
feat(core): bug affecting menu [#22]
^───^────^ ^────────────────^ ^───^
| | | |
| | | └───⫸ (ISSUE): Reference issue ID
│ │ │
│ │ └──────────────────────⫸ (DESC): Summary in present tense. Use lower case not title case!
│ │
│ └──────────────────────────────⫸ (SCOPE): The package(s) that this change affects
└──────────────────────────────────⫸ (TYPE): See list above
```
<br />
##### Example 2:
```
<type>(<scope>): <short summary> [issue]
| | | |
| | | └─⫸ Reference issue id (optional)
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
│ elements|forms|http|language-service|localize|platform-browser|
│ platform-browser-dynamic|platform-server|router|service-worker|
│ upgrade|zone.js|packaging|changelog|docs-infra|migrations|ngcc|ve|
│ devtools....
└─⫸ Commit Type: build|ci|doc|docs|feat|fix|perf|refactor|test
website|chore|style|type|revert|deprecate
```
<br />
### Committing
If you are pushing a commit which addresses a submitted issue, reference your issue at the end of the commit message. You may also optionally add the major issue to the end of your commit body.
References should be on their own line, following the word `Ref` or `Refs`
```
Title: fix(core): fix error message displayed to users. [#22]
Description: The description of your commit
Ref: #22, #34, #37
```
<br />
<br />
### Languages
The formatting of code greatly depends on the language being used for this repository. We provide various different languages below as this guide is utilized across multiple repositories.
- [Python](#python)
- [Javascript / Typescript / NodeJS](#nodejs)
<br />
<br />
#### Python
The following guidelines apply to any projects written with Python:
<br />
##### Indentation
Use `4 spaces` per indentation level.
<br />
> [!TIP]
> ✅ Correct
> ```python
> def Encrypt( key : int, bytestr : bytes ):
> res = b''
> i_blk, left_bytes = divmod( len(bytestr), 3 )
> ```
<br />
> [!CAUTION]
> ❌ Wrong
> ```python
> def encrypt( key : int, byteStr : bytes ):
> Res = b''
> iBlk, leftBytes = divmod( len(byteStr), 3 )
> ```
<br />
##### Line Length
Keep the maximum character count to `100 characters per line`. If you are revising old code which doesn't follow this guideline; please rewrite it to conform.
<br />
##### Blank Lines
Surround top-level functions and class definitions with a blank in-between.
Method definitions inside a class are surrounded by a single blank line.
Extra blank lines may be used (sparingly) to separate groups of functions related to one another. Blank lines may be omitted between a bunch of related one-liners (e.g: set of dummy implementations).
<br />
##### Imports
Imports should usually be on separate lines:
<br />
> [!TIP]
> ✅ Correct
> ```python
> import os
> import sys
> ```
<br />
> [!CAUTION]
> ❌ Wrong
> ```python
> import sys, os
> ```
<br />
The following is acceptable:
<br />
> [!TIP]
> ✅ Correct
> ```python
> from mypkg import siblingA, siblingB, siblingC
> ```
<br />
##### Commenting
Comment your code. It helps novice readers to better understand the process. It doesn't have to be painfully obvious explanations, but it helps to give an idea of what something does.
Please append `#` to the beginning of each line.
```python
# #
# byteString : b'1#Aetherx|232#1#233262#0#0#0#'
# #
def Encrypt( key : int, byteString : bytes ):
res = bytearray( )
```
<br />
<br />
##### Casing
- Stick to `camelCase`; unless:
- naming functions, capitalize the first letter
- Capitalize enums
- If you see code not conforming with this, please revise it in your pull request.
<br />
> [!TIP]
> ✅ Correct
> ```python
> def Encrypt( key : int, byteStr : bytes ):
> res = b''
> iBlock, leftBytes = divmod( len(byteStr), 3 )
> ```
<br />
> [!CAUTION]
> ❌ Wrong
> ```python
> def encrypt( key : int, bytestr : bytes ):
> res = b''
> i_blk, left_bytes = divmod( len(bytestr), 3 )
> ```
<br />
<br />
<div align="center">
**[`^ back to top ^`](#about)**
</div>
<br />
---
<br />
#### NodeJS
The following allows you to configure ESLint and Prettier.
<br />
<br />
##### Prettier
We have opted to make use of [ESLint](#eslint) over Prettier. We provide a detailed ESLint flag config file with very specific linting rules. Please review that section for more information.
<br />
<br />
##### ESLint
Within the root folder of the repo, there are several configuration files which you should be using within the project. These files dictate how prettier and eslint will behave and what is acceptable / not acceptable.
<br />
Pick the config file below depending on which version of ESLint you are using. The v8 and older `.eslint` may not be there if we have migrated over to an Eslint v9 flat config file:
<br />
###### v9 & Newer (Config)
Our NodeJS applications require that you utilize ESLint v9 or newer which makes use of a flat config structure. You may find a copy of our flat config at the link below:
- [📄 eslint.config.mjs](https://github.com/thebinaryninja/tvapp2/blob/main/tvapp2/eslint.config.mjs)
<br />
###### v8 & Older (Config)
- We no longer utilize any version of ESLint older than version 9.
<br />
<br />
> [!NOTE]
> When submitting your pull request, these linting and style rules will be verified with all of your files. If you did not follow these rules; the linter tests on your pull request will fail; and you'll be expected to correct these issues before your submission will be transferred over for human review.
<br />
<br />
##### Packages
We use the following packages for linting and prettier.
<br />
| Package | Repo File | Description |
| --- | --- | --- |
| [@stylistic/eslint-plugin-js](https://npmjs.com/package/@stylistic/eslint-plugin-js) | [package.json](./package.json) | JavaScript stylistic rules for ESLint, migrated from eslint core. |
| [@stylistic/eslint-plugin-ts](https://npmjs.com/package/@stylistic/eslint-plugin-ts) | [package.json](./package.json) | TypeScript stylistic rules for ESLint, migrated from typescript-eslint. |
| [@stylistic/eslint-plugin-plus](https://npmjs.com/package/@stylistic/eslint-plugin-plus) | [package.json](./package.json) | Supplementary rules introduced by ESLint Stylistic. |
| [eslint-plugin-prettier](https://npmjs.com/package/eslint-plugin-prettier) | [package.json](./package.json) | Runs Prettier as an ESLint rule and reports differences as individual ESLint issues. |
<br />
You can add the following to your `package.json` file:
https://github.com/TheBinaryNinja/tvapp2/blob/1c75f11e9f0506ad3dd05133fdafc3aeb87686ca/tvapp2/package.json#L81-L92
<br />
<br />
##### Indentation
Use `4 spaces` per indentation level.
<br />
<br />
##### Style
For files that are not controlled by [Prettier](#prettier) or [ESLint](#eslint); use `Allman Style`. Braces should be on their own lines, and any code inside the braces should be indented 4 spaces.
<br />
```javascript
return {
status: "failure",
user:
{
id: "1aaa35aa-fb3a-62ae-ffec-a14g7fc401ac",
label: "Test String",
}
};
while (x == y)
{
foo();
bar();
}
```
<br />
<br />
##### Line Length
Keep the maximum character count to `100 characters per line`. The configs on this page have prettier automatically set up to detect more than 100 characters per line.
<br />
##### Commenting
Comment your code. It helps novice readers to better understand the process. You may use block style commenting, or single lines:
```javascript
/*
tests to decide if the end-user is running on Darwin or another platform.
*/
test(`Return true if platform is Darwin`, () => {
process.platform = 'darwin';
expect(bIsDarwin()).toBe(true);
});
test(`Return false if platform is not Darwin`, () => {
process.platform = 'linux';
expect(bIsDarwin()).toBe(false);
});
```
<br />
##### Casing
Stick to `camelCase` as much as possible.
```javascript
let myVar = 'one';
let secondVar = 'two';
```
<br />
If you are defining a new environment variable; it must be in ALL CAPS in the `Dockerfile`:
```dockerfile
ENV DIR_BUILD=/usr/src/app
ENV DIR_RUN=/usr/bin/app
ENV URL_REPO="https://git.binaryninja.net/binaryninja/"
ENV WEB_IP="0.0.0.0"
ENV WEB_PORT=4124
ENV STREAM_QUALITY="hd"
ENV FILE_PLAYLIST="playlist.m3u8"
ENV FILE_EPG="xmltv.xml"
ENV LOG_LEVEL=4
ENV TZ="Etc/UTC"
```
<br />
Then you may call your new environment variable within the Javascript code; and ensure you define a default value to correct any user misconfigurations:
```javascript
const envUrlRepo = process.env.URL_REPO || 'https://git.binaryninja.net/binaryninja';
const envStreamQuality = process.env.STREAM_QUALITY || 'hd';
const envFileM3U = process.env.FILE_PLAYLIST || 'playlist.m3u8';
const envFileXML = process.env.FILE_EPG || 'xmltv.xml';
const envFileTAR = process.env.FILE_TAR || 'xmltv.xml.gz';
```
<br />
<br />
<div align="center">
**[`^ back to top ^`](#about)**
</div>
<br />
<br />
<br />
<br />
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- BADGE > GENERAL -->
[general-npmjs-uri]: https://npmjs.com
[general-nodejs-uri]: https://nodejs.org
[general-npmtrends-uri]: http://npmtrends.com/tvapp2
<!-- BADGE > VERSION > GITHUB -->
[github-version-img]: https://img.shields.io/github/v/tag/thebinaryninja/tvapp2?logo=GitHub&label=Version&color=ba5225
[github-version-uri]: https://github.com/thebinaryninja/tvapp2/releases
<!-- BADGE > LICENSE > MIT -->
[license-mit-img]: https://img.shields.io/badge/MIT-FFF?logo=creativecommons&logoColor=FFFFFF&label=License&color=9d29a0
[license-mit-uri]: https://github.com/thebinaryninja/tvapp2/blob/main/LICENSE
<!-- BADGE > GITHUB > DOWNLOAD COUNT -->
[github-downloads-img]: https://img.shields.io/github/downloads/thebinaryninja/tvapp2/total?logo=github&logoColor=FFFFFF&label=Downloads&color=376892
[github-downloads-uri]: https://github.com/thebinaryninja/tvapp2/releases
<!-- BADGE > GITHUB > DOWNLOAD SIZE -->
[github-size-img]: https://img.shields.io/github/repo-size/thebinaryninja/tvapp2?logo=github&label=Size&color=59702a
[github-size-uri]: https://github.com/thebinaryninja/tvapp2/releases
<!-- BADGE > ALL CONTRIBUTORS -->
[contribs-all-img]: https://img.shields.io/github/all-contributors/thebinaryninja/tvapp2?logo=contributorcovenant&color=de1f6f&label=contributors
[contribs-all-uri]: https://github.com/all-contributors/all-contributors
<!-- BADGE > GITHUB > BUILD > NPM -->
[github-build-img]: https://img.shields.io/github/actions/workflow/status/thebinaryninja/tvapp2/npm-release.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-uri]: https://github.com/thebinaryninja/tvapp2/actions/workflows/npm-release.yml
<!-- BADGE > GITHUB > BUILD > Pypi -->
[github-build-pypi-img]: https://img.shields.io/github/actions/workflow/status/thebinaryninja/tvapp2/release-pypi.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-pypi-uri]: https://github.com/thebinaryninja/tvapp2/actions/workflows/pypi-release.yml
<!-- BADGE > GITHUB > TESTS -->
[github-tests-img]: https://img.shields.io/github/actions/workflow/status/thebinaryninja/tvapp2/npm-tests.yml?logo=github&label=Tests&color=2c6488
[github-tests-uri]: https://github.com/thebinaryninja/tvapp2/actions/workflows/npm-tests.yml
<!-- BADGE > GITHUB > COMMIT -->
[github-commit-img]: https://img.shields.io/github/last-commit/thebinaryninja/tvapp2?logo=conventionalcommits&logoColor=FFFFFF&label=Last%20Commit&color=313131
[github-commit-uri]: https://github.com/thebinaryninja/tvapp2/commits/main/
<!-- BADGE > Github > Docker Image > SELFHOSTED BADGES -->
[github-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=development-amd64%2Cdevelopment%2Cdevelopment-arm64%2Clatest&label=version&trim=
[github-docker-version-uri]: https://github.com/thebinaryninja/tvapp2/pkgs/container/tvapp2
<!-- BADGE > Dockerhub > Docker Image -->
[dockerhub-docker-version-img]: https://img.shields.io/docker/v/thebinaryninja/tvapp2?sort=semver&arch=arm64
[dockerhub-docker-version-uri]: https://hub.docker.com/repository/docker/thebinaryninja/tvapp2/general
<!-- BADGE > Gitea > Docker Image > SELFHOSTED BADGES -->
[gitea-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=latest&label=version&trim=
[gitea-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/tvapp2
<!-- BADGE > Gitea 2 > Docker Image -->
[gitea2-docker-version-img]: https://img.shields.io/gitea/v/release/binaryninja/tvapp2?gitea_url=https%3A%2F%2Fgit.binaryninja.net
[gitea2-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/-/packages/container/tvapp2/latest
<!-- BADGE > BUTTON > SUBMIT ISSUES -->
[btn-github-submit-img]: https://img.shields.io/badge/submit%20new%20issue-de1f5c?style=for-the-badge&logo=github&logoColor=FFFFFF
[btn-github-submit-uri]: https://github.com/thebinaryninja/tvapp2/issues
<!-- prettier-ignore-end -->
<!-- markdownlint-restore -->

View File

@@ -19,45 +19,69 @@
# arm64 docker buildx build --no-cache --pull --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:latest -t tvapp2:1.0.0 --platform=linux/arm64 --output type=docker --output type=docker .
# #
FROM ghcr.io/aetherinox/alpine-base:3.20-amd64
# #
# FROM
# any args defined before FROM cannot be called after FROM and the ARE is classified outside the build process.
# You will have to re-define the arg after FROM to utilize it anywhere else in the build process.
#
# @ref https://docs.docker.com/reference/dockerfile/#understand-how-arg-and-from-interact
# #
ARG ARCH=amd64
FROM --platform=linux/${ARCH} ghcr.io/aetherinox/alpine-base:3.21
# #
# Set Args
# #
ARG ARCH=amd64
ARG BUILDDATE
ARG VERSION
ARG RELEASE
# #
# Set Labels
# #
LABEL maintainer="aetherinox, iFlip721"
LABEL org.opencontainers.image.authors="aetherinox, iFlip721"
LABEL org.opencontainers.image.authors="Aetherinox, iFlip721, Optx"
LABEL org.opencontainers.image.vendor="BinaryNinja"
LABEL org.opencontainers.image.title="TVApp2"
LABEL org.opencontainers.image.description="Automatic m3u and xml guide updater for TheTvApp, TVPass, and MoveOnJoy utilized within your IPTV client."
LABEL org.opencontainers.image.source="https://github.com/TheBinaryNinja/tvapp2"
LABEL org.opencontainers.image.repo.1="https://github.com/TheBinaryNinja/tvapp2"
LABEL org.opencontainers.image.repo.2="https://git.binaryninja.net/BinaryNinja/tvapp2"
LABEL org.opencontainers.image.source="https://github.com/thebinaryninja/tvapp2"
LABEL org.opencontainers.image.repo.1="https://github.com/thebinaryninja/tvapp2"
LABEL org.opencontainers.image.repo.2="https://git.binaryninja.net/binaryninja/tvapp2"
LABEL org.opencontainers.image.repo.3="https://github.com/aetherinox/docker-base-alpine"
LABEL org.opencontainers.image.documentation="https://github.com/TheBinaryNinja/tvapp2/wiki"
LABEL org.opencontainers.image.url="https://github.com/TheBinaryNinja/tvapp2/pkgs/container/tvapp2"
LABEL org.opencontainers.image.documentation="https://thebinaryninja.github.io/tvapp2"
LABEL org.opencontainers.image.url="https://github.com/thebinaryninja/tvapp2/pkgs/container/tvapp2"
LABEL org.opencontainers.image.licenses="MIT"
LABEL BUILDVERSION="TVApp2 v${VERSION} Build ${BUILDDATE}"
LABEL org.opencontainers.image.architecture="${ARCH}"
LABEL org.opencontainers.image.ref.name="main"
LABEL org.opencontainers.image.registry="local"
LABEL org.opencontainers.image.release="${RELEASE}"
LABEL org.tvapp2.image.maintainers="Aetherinox, iFlip721, Optx"
LABEL org.tvapp2.image.build-version="Version:- ${VERSION} Date:- ${BUILDDATE}"
# #
# Set Env Var
# #
ENV TZ="Etc/UTC"
ENV URL_REPO="https://git.binaryninja.net/BinaryNinja/"
ENV WEB_IP="0.0.0.0"
ENV WEB_PORT=4124
ENV NODE_VERSION=18.20.5
ENV NODE_VERSION=22.8.0
ENV YARN_VERSION=1.22.22
ENV RELEASE="${RELEASE}"
ENV DIR_BUILD=/usr/src/app
ENV DIR_RUN=/usr/bin/app
ENV URL_REPO="https://git.binaryninja.net/binaryninja/"
ENV WEB_IP="0.0.0.0"
ENV WEB_PORT=4124
ENV WEB_ENCODING="deflate, br"
ENV STREAM_QUALITY="hd"
ENV FILE_URL="urls.txt"
ENV FILE_M3U="playlist.m3u8"
ENV FILE_EPG="xmltv.xml"
ENV FILE_TAR="xmltv.xml.gz"
ENV HEALTH_TIMER=600000
ENV LOG_LEVEL=4
ENV TZ="Etc/UTC"
# #
# Install

View File

@@ -1,115 +0,0 @@
# syntax=docker/dockerfile:1
# #
# @project TVApp2
# @usage docker image which allows you to download a m3u playlist and EPG guide data from
# multiple IPTV services.
# @file Dockerfile.aarch64
# @repo https://github.com/TheBinaryNinja/tvapp2
# https://git.binaryninja.net/BinaryNinja/tvapp2
# https://github.com/aetherinox/docker-base-alpine
#
# you can build your own image by running
# amd64 docker build --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:latest -t tvapp2:1.0.0 -t tvapp2:1.0.0-amd64 -f Dockerfile .
# arm64 docker build --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:1.0.0-arm64 -f Dockerfile.aarch64 .
#
# if you prefer to use `docker buildx`
# create docker buildx create --driver docker-container --name container --bootstrap --use
# amd64 docker buildx build --no-cache --pull --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:latest -t tvapp2:1.0.0 --platform=linux/amd64 --output type=docker --output type=docker .
# arm64 docker buildx build --no-cache --pull --build-arg VERSION=1.0.0 --build-arg BUILDDATE=20250218 -t tvapp2:latest -t tvapp2:1.0.0 --platform=linux/arm64 --output type=docker --output type=docker .
# #
FROM ghcr.io/aetherinox/alpine-base:3.20-arm64
# #
# Set Args
# #
ARG BUILDDATE
ARG VERSION
# #
# Set Labels
# #
LABEL maintainer="aetherinox, iFlip721"
LABEL org.opencontainers.image.authors="aetherinox, iFlip721"
LABEL org.opencontainers.image.vendor="BinaryNinja"
LABEL org.opencontainers.image.title="TVApp2"
LABEL org.opencontainers.image.description="Automatic m3u and xml guide updater for TheTvApp, TVPass, and MoveOnJoy utilized within your IPTV client."
LABEL org.opencontainers.image.source="https://github.com/TheBinaryNinja/tvapp2"
LABEL org.opencontainers.image.repo.1="https://github.com/TheBinaryNinja/tvapp2"
LABEL org.opencontainers.image.repo.2="https://git.binaryninja.net/BinaryNinja/tvapp2"
LABEL org.opencontainers.image.repo.3="https://github.com/aetherinox/docker-base-alpine"
LABEL org.opencontainers.image.documentation="https://github.com/TheBinaryNinja/tvapp2/wiki"
LABEL org.opencontainers.image.url="https://github.com/TheBinaryNinja/tvapp2/pkgs/container/tvapp2"
LABEL org.opencontainers.image.licenses="MIT"
LABEL BUILDVERSION="TVApp2 v${VERSION} Build ${BUILDDATE}"
# #
# Set Env Var
# #
ENV TZ="Etc/UTC"
ENV URL_REPO="https://git.binaryninja.net/BinaryNinja/"
ENV WEB_IP="0.0.0.0"
ENV WEB_PORT=4124
ENV NODE_VERSION=18.20.5
ENV YARN_VERSION=1.22.22
ENV DIR_BUILD=/usr/src/app
ENV DIR_RUN=/usr/bin/app
# #
# Install
# #
RUN \
apk add --no-cache \
wget \
bash \
nano \
npm \
openssl
# #
# Copy docker-entrypoint
# #
COPY docker-entrypoint.sh /usr/local/bin/
# #
# copy s6-overlays root to image root
# #
COPY root/ /
# #
# set work directory
# #
WORKDIR ${DIR_BUILD}
# #
# copy tvapp2 project to workdir
# #
COPY tvapp2/ ./
# #
# set work dir to built app
# #
WORKDIR ${DIR_RUN}
# #
# Ports and volumes
# #
EXPOSE ${WEB_PORT}/tcp
# #
# In case user sets up the cron for a longer duration, do a first run
# and then keep the container running. Hacky, but whatever.
# #
ENTRYPOINT ["/init"]

935
README.md

File diff suppressed because it is too large Load Diff

View File

@@ -44,3 +44,7 @@ services:
memlock:
soft: -1
hard: -1
healthcheck:
test: [ "CMD", "curl", "--fail", "http://127.0.0.1:4124" ]
interval: 30s
retries: 5

View File

@@ -6,21 +6,139 @@ tags:
# Changelog
This section outlines all releases of TVApp2, including the version of the release, and the changes made for that release.
<br />
<p align="center" markdown="1">
![Version](https://img.shields.io/github/v/tag/TheBinaryNinja/tvapp2?logo=GitHub&label=version&color=ba5225)
![Downloads](https://img.shields.io/github/downloads/TheBinaryNinja/tvapp2/total)
![Repo Size](https://img.shields.io/github/repo-size/TheBinaryNinja/tvapp2?label=size&color=59702a)
![Last Commit)](https://img.shields.io/github/last-commit/TheBinaryNinja/tvapp2?color=b43bcc)
<!-- prettier-ignore-start -->
[![Version][github-version-img]][github-version-uri]
[![Downloads][github-downloads-img]][github-downloads-uri]
[![Size][github-size-img]][github-size-img]
[![Last Commit][github-commit-img]][github-commit-img]
[![Contributors][contribs-all-img]](#contributors)
<!-- prettier-ignore-end -->
</p>
### <!-- md:version stable- --> 1.0.0 <small>Feb 24, 2025</small> { id="1.0.0" }
<br />
---
<br />
### <!-- md:version stable- --> 1.1.0 <small>Mar 25, 2025</small> { id="1.1.0" }
- `feat`: new interface & theme for web ui
- integrated bootstrap 4.x
- new dark theme
- all hosted files now display `date`, `download url`, `size`, and `description`
- automatic viewport resizing depending on the device used
- new favicon
- localized css, js, and image support instead of relying on externally hosted resources
- `feat`: app now offers a compressed `gzip` for EPG guide data
- `feat`: add multiple url paths to download each asset
- `/guide`, `/epg`, `xml`
- `/playlist`, `/m3u`, `/m3u8`
- `/gzip`, `/gz`
- `feat`: add mew environment variables
- `LOG_LEVEL`: specifies what level of logs you will see in console
- `STREAM_QUALITY`: specifies the quality of the stream; options: `hd` and `sd`
- `FILE_PLAYLIST`: filename that M3U playlist data will be stored to
- `FILE_EPG`: filename that EPG / XML guide data will be stored to
- `FILE_GZIP`: filename that compressed gzip guide data will be stored to
- `build`: app migrated from CommonJS to ES Modules
- `build`: bump alpine base image from v3.20 to v3.21
- `build`: migrated html template to independent file in `www` folder; utilizes `ejs` module
- `build`: **amd64** and **arm64** docker images merged into one image with architecture support
- `fix`: resolved bug where local server could not be started using nodejs; related to ip address variable
- `build(deps)`: add package `ejs` 3.1.10
- `build(deps)`: add package `chalk` 5.3.0
- `build(deps)`: add package `moment` 2.30.1
- `build(deps-dev)`: add package `eslint` 9.17.0
- `build(deps-dev)`: add package `eslint-plugin-chai-friendly` 1.0.1
- `build(deps-dev)`: add package `eslint-plugin-import` 2.31.0
- `build(deps-dev)`: add package `eslint-plugin-n` 17.15.0
- `build(deps-dev)`: add package `eslint-plugin-promise` 7.2.1
- `build(deps-dev)`: add package `@stylistic/eslint-plugin-js` 3.1.0
- `remove`: tvapp2.fonts.min.js
<br />
### <!-- md:version stable- --> 1.0.0 <small>Feb 24, 2025</small> { id="1.0.0" }
- Initial release
<br />
---
<br />
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- BADGE > GENERAL -->
[general-npmjs-uri]: https://npmjs.com
[general-nodejs-uri]: https://nodejs.org
[general-npmtrends-uri]: http://npmtrends.com/csf-firewall
<!-- BADGE > VERSION > GITHUB -->
[github-version-img]: https://img.shields.io/github/v/tag/TheBinaryNinja/tvapp2?logo=GitHub&label=Version&color=ba5225
[github-version-uri]: https://github.com/TheBinaryNinja/tvapp2/releases
<!-- BADGE > LICENSE > MIT -->
[license-mit-img]: https://img.shields.io/badge/MIT-FFF?logo=creativecommons&logoColor=FFFFFF&label=License&color=9d29a0
[license-mit-uri]: https://github.com/TheBinaryNinja/tvapp2/blob/main/LICENSE
<!-- BADGE > GITHUB > DOWNLOAD COUNT -->
[github-downloads-img]: https://img.shields.io/github/downloads/TheBinaryNinja/tvapp2/total?logo=github&logoColor=FFFFFF&label=Downloads&color=376892
[github-downloads-uri]: https://github.com/TheBinaryNinja/tvapp2/releases
<!-- BADGE > GITHUB > DOWNLOAD SIZE -->
[github-size-img]: https://img.shields.io/github/repo-size/TheBinaryNinja/tvapp2?logo=github&label=Size&color=59702a
[github-size-uri]: https://github.com/TheBinaryNinja/tvapp2/releases
<!-- BADGE > ALL CONTRIBUTORS -->
[contribs-all-img]: https://img.shields.io/github/all-contributors/TheBinaryNinja/tvapp2?logo=contributorcovenant&color=de1f6f&label=contributors
[contribs-all-uri]: https://github.com/all-contributors/all-contributors
<!-- BADGE > GITHUB > BUILD > NPM -->
[github-build-img]: https://img.shields.io/github/actions/workflow/status/TheBinaryNinja/tvapp2/npm-release.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-uri]: https://github.com/TheBinaryNinja/tvapp2/actions/workflows/npm-release.yml
<!-- BADGE > GITHUB > BUILD > Pypi -->
[github-build-pypi-img]: https://img.shields.io/github/actions/workflow/status/TheBinaryNinja/tvapp2/release-pypi.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-pypi-uri]: https://github.com/TheBinaryNinja/tvapp2/actions/workflows/pypi-release.yml
<!-- BADGE > GITHUB > TESTS -->
[github-tests-img]: https://img.shields.io/github/actions/workflow/status/TheBinaryNinja/tvapp2/npm-tests.yml?logo=github&label=Tests&color=2c6488
[github-tests-uri]: https://github.com/TheBinaryNinja/tvapp2/actions/workflows/npm-tests.yml
<!-- BADGE > GITHUB > COMMIT -->
[github-commit-img]: https://img.shields.io/github/last-commit/TheBinaryNinja/tvapp2?logo=conventionalcommits&logoColor=FFFFFF&label=Last%20Commit&color=313131
[github-commit-uri]: https://github.com/TheBinaryNinja/tvapp2/commits/main/
<!-- BADGE > Github > Docker Image > SELFHOSTED BADGES -->
[github-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=development-amd64%2Cdevelopment%2Cdevelopment-arm64%2Clatest&label=version&trim=
[github-docker-version-uri]: https://github.com/TheBinaryNinja/tvapp2/pkgs/container/tvapp2
<!-- BADGE > Dockerhub > Docker Image -->
[dockerhub-docker-version-img]: https://img.shields.io/docker/v/thebinaryninja/tvapp2?sort=semver&arch=arm64
[dockerhub-docker-version-uri]: https://hub.docker.com/repository/docker/thebinaryninja/tvapp2/general
<!-- BADGE > Gitea > Docker Image > SELFHOSTED BADGES -->
[gitea-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=latest&label=version&trim=
[gitea-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/tvapp2
<!-- BADGE > Gitea 2 > Docker Image -->
[gitea2-docker-version-img]: https://img.shields.io/gitea/v/release/binaryninja/tvapp2?gitea_url=https%3A%2F%2Fgit.binaryninja.net
[gitea2-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/-/packages/container/tvapp2/latest
<!-- BADGE > BUTTON > SUBMIT ISSUES -->
[btn-github-submit-img]: https://img.shields.io/badge/submit%20new%20issue-de1f5c?style=for-the-badge&logo=github&logoColor=FFFFFF
[btn-github-submit-uri]: https://github.com/TheBinaryNinja/tvapp2/issues
<!-- prettier-ignore-end -->
<!-- markdownlint-restore -->

View File

@@ -0,0 +1,652 @@
---
title: Contributing to TVApp2
tags:
- info
---
<div align="center" markdown="1">
<h1>♾️ Contributing ♾️</h1>
<br />
<p align="center" markdown="1">
<!-- prettier-ignore-start -->
[![Version][github-version-img]][github-version-uri]
[![Downloads][github-downloads-img]][github-downloads-uri]
[![Size][github-size-img]][github-size-img]
[![Last Commit][github-commit-img]][github-commit-img]
[![Contributors][contribs-all-img]](#contributors)
<!-- prettier-ignore-end -->
</p>
</div>
<br />
---
<br />
## About
Below are a list of ways that you can help contribute to this project, as well as policies and guides that explain how to get started.
Please review everything on this page before you submit your contribution.
<br />
---
<br />
- [About](#about)
- [Issues, Bugs, Ideas](#issues-bugs-ideas)
- [Contributing](#contributing)
- [Before Submitting Pull Requests](#before-submitting-pull-requests)
- [Conventional Commit Specification](#conventional-commit-specification)
- [Types](#types)
- [Example 1:](#example-1)
- [Example 2:](#example-2)
- [Committing](#committing)
- [Languages](#languages)
- [Python](#python)
- [Indentation](#indentation)
- [Line Length](#line-length)
- [Blank Lines](#blank-lines)
- [Imports](#imports)
- [Commenting](#commenting)
- [Casing](#casing)
- [NodeJS](#nodejs)
- [Prettier](#prettier)
- [ESLint](#eslint)
- [v9 \& Newer (Config)](#v9--newer-config)
- [v8 \& Older (Config)](#v8--older-config)
- [Packages](#packages)
- [Indentation](#indentation-1)
- [Style](#style)
- [Line Length](#line-length-1)
- [Commenting](#commenting-1)
- [Casing](#casing-1)
<br />
---
<br />
## Issues, Bugs, Ideas
Stuff happens, and sometimes as best as we try, there may be issues within this project that we are unaware of. That is the great thing about open-source; anyone can use the program and contribute to making it better.
<br />
If you have found a bug, have an issue, or maybe even a cool idea; you can let us know by [submitting it](https://github.com/thebinaryninja/tvapp2/issues). However, before you submit your new issue, bug report, or feature request; head over to the [Issues Section](https://github.com/thebinaryninja/tvapp2/issues) and ensure nobody else has already submitted it.
<br />
Once you are sure that your issue has not already being dealt with; you may submit a new issue at [here](https://github.com/thebinaryninja/tvapp2/issues/new/choose). You'll be asked to specify exactly what your new submission targets, such as:
- Bug report
- Feature Suggestion
<br />
When writing a new submission; ensure you fill out any of the questions asked of you. If you do not provide enough information, we cannot help. Be as detailed as possible, and provide any logs or screenshots you may have to help us better understand what you mean. Failure to fill out the submission properly may result in it being closed without a response.
<br />
If you are submitting a bug report:
- Explain the issue
- Describe how you expect for a feature to work, and what you're seeing instead of what you expected.
- List possible options for a resolution or insight
- Provide screenshots, logs, or anything else that can visually help track down the issue.
<br />
<div align="center">
[![Submit Issue][btn-github-submit-img]][btn-github-submit-uri]
</div>
<br />
<div align="center">
**[`^ back to top ^`](#about)**
</div>
<br />
---
<br />
## Contributing
If you are looking to contribute to this project by actually submit your own code; please review this section completely. There is important information and policies provided below that you must follow for your pull request to get accepted.
The source is here for everyone to collectively share and collaborate on. If you think you have a possible solution to a problem; don't be afraid to get your hands dirty.
All contributions are made via pull requests. To create a pull request, you need a GitHub account. If you are unclear on this process, see [GitHub's documentation on forking and pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork). Pull requests should be targeted at the master branch.
<br />
### Before Submitting Pull Requests
- Follow the repository's code formatting conventions (see below);
- Include tests that prove that the change works as intended and does not add regressions;
- Document the changes in the code and/or the project's documentation;
- Your PR must pass the CI pipeline;
- When submitting your Pull Request, use one of the following branches:
- For bug fixes: `main` branch
- For features & functionality: `development` branch
- Include a proper git commit message following the [Conventional Commit Specification](https://conventionalcommits.org/en/v1.0.0/#specification).
<br />
If you have completed the above tasks, the pull request is ready to be reviewed and your pull request's label will be changed to "Ready for Review". At this point, a human will need to step in and manually verify your submission.
Reviewers will approve the pull request once they are satisfied with the patch it will be merged.
<br />
### Conventional Commit Specification
When committing your changes, we require you to follow the [Conventional Commit Specification](https://conventionalcommits.org/en/v1.0.0/#specification). The **Conventional Commits** is a specification for the format and content of a commit message. The concept behind Conventional Commits is to provide a rich commit history that can be read and understood by both humans and automated tools. Conventional Commits have the following format:
<br />
```
<type>[(optional <scope>)]: <description>
[optional <body>]
[optional <footer(s)>]
```
<br />
#### Types
Our repositories make use of the following commit tags:
<br />
| Type | Description |
| --- | --- |
| `feat` | <sup><sub>Introduce new feature</sub></sup> |
| `fix` | <sup><sub>Bug fix</sub></sup> |
| `chore` | <sup><sub>Includes technical or preventative maintenance task that is necessary for managing the app or repo, such as updating grunt tasks, but is not tied to any specific feature. Usually done for maintenance purposes.<br/>E.g: Edit .gitignore, .prettierrc, .prettierignore, .gitignore, eslint.config.js file</sub></sup> |
| `revert` | <sup><sub>Revert a previous commit</sub></sup> |
| `style` | <sup><sub>Update / reformat style of source code. Does not change the way app is implemented. Changes that do not affect the meaning of the code<br />E.g: white-space, formatting, missing semi-colons, change tabs to spaces, etc)</sub></sup> |
| `docs` | <sup><sub>Change website or markdown documents. Does not mean changes to the documentation generator script itself, only the documents created from the generator. <br/>E.g: documentation, readme.md or markdown |
| `build` | <sup><sub>Changes to the build / compilation / packaging process or auxiliary tools such as doc generation<br />E.g: create new build tasks, update release script, etc.</sub></sup> |
| `refactor` | <sup><sub>Change to production code that leads to no behavior difference,<br/>E.g: split files, rename variables, rename package, improve code style, etc.</sub></sup> |
| `test` | <sup><sub>Add or refactor tests, no production code change. Changes the suite of automated tests for the app.</sub></sup> |
| `ci` | <sup><sub>Changes related to Continuous Integration (usually `yml` and other configuration files).</sub></sup> |
| `perf` | <sup><sub>Performance improvement of algorithms or execution time of the app. Does not change an existing feature.</sub></sup> |
<br />
##### Example 1:
```
feat(core): bug affecting menu [#22]
^───^────^ ^────────────────^ ^───^
| | | |
| | | └───⫸ (ISSUE): Reference issue ID
│ │ │
│ │ └──────────────────────⫸ (DESC): Summary in present tense. Use lower case not title case!
│ │
│ └──────────────────────────────⫸ (SCOPE): The package(s) that this change affects
└──────────────────────────────────⫸ (TYPE): See list above
```
<br />
##### Example 2:
```
<type>(<scope>): <short summary> [issue]
| | | |
| | | └─⫸ Reference issue id (optional)
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
│ elements|forms|http|language-service|localize|platform-browser|
│ platform-browser-dynamic|platform-server|router|service-worker|
│ upgrade|zone.js|packaging|changelog|docs-infra|migrations|ngcc|ve|
│ devtools....
└─⫸ Commit Type: build|ci|doc|docs|feat|fix|perf|refactor|test
website|chore|style|type|revert|deprecate
```
<br />
### Committing
If you are pushing a commit which addresses a submitted issue, reference your issue at the end of the commit message. You may also optionally add the major issue to the end of your commit body.
References should be on their own line, following the word `Ref` or `Refs`
```
Title: fix(core): fix error message displayed to users. [#22]
Description: The description of your commit
Ref: #22, #34, #37
```
<br />
<br />
### Languages
The formatting of code greatly depends on the language being used for this repository. We provide various different languages below as this guide is utilized across multiple repositories.
- [Python](#python)
- [Javascript / Typescript / NodeJS](#nodejs)
<br />
<br />
#### Python
The following guidelines apply to any projects written with Python:
<br />
##### Indentation
Use `4 spaces` per indentation level.
<br />
> [!TIP]
> ✅ Correct
> ```python
> def Encrypt( key : int, bytestr : bytes ):
> res = b''
> i_blk, left_bytes = divmod( len(bytestr), 3 )
> ```
<br />
> [!CAUTION]
> ❌ Wrong
> ```python
> def encrypt( key : int, byteStr : bytes ):
> Res = b''
> iBlk, leftBytes = divmod( len(byteStr), 3 )
> ```
<br />
##### Line Length
Keep the maximum character count to `100 characters per line`. If you are revising old code which doesn't follow this guideline; please rewrite it to conform.
<br />
##### Blank Lines
Surround top-level functions and class definitions with a blank in-between.
Method definitions inside a class are surrounded by a single blank line.
Extra blank lines may be used (sparingly) to separate groups of functions related to one another. Blank lines may be omitted between a bunch of related one-liners (e.g: set of dummy implementations).
<br />
##### Imports
Imports should usually be on separate lines:
<br />
> [!TIP]
> ✅ Correct
> ```python
> import os
> import sys
> ```
<br />
> [!CAUTION]
> ❌ Wrong
> ```python
> import sys, os
> ```
<br />
The following is acceptable:
<br />
> [!TIP]
> ✅ Correct
> ```python
> from mypkg import siblingA, siblingB, siblingC
> ```
<br />
##### Commenting
Comment your code. It helps novice readers to better understand the process. It doesn't have to be painfully obvious explanations, but it helps to give an idea of what something does.
Please append `#` to the beginning of each line.
```python
# #
# byteString : b'1#Aetherx|232#1#233262#0#0#0#'
# #
def Encrypt( key : int, byteString : bytes ):
res = bytearray( )
```
<br />
<br />
##### Casing
- Stick to `camelCase`; unless:
- naming functions, capitalize the first letter
- Capitalize enums
- If you see code not conforming with this, please revise it in your pull request.
<br />
> [!TIP]
> ✅ Correct
> ```python
> def Encrypt( key : int, byteStr : bytes ):
> res = b''
> iBlock, leftBytes = divmod( len(byteStr), 3 )
> ```
<br />
> [!CAUTION]
> ❌ Wrong
> ```python
> def encrypt( key : int, bytestr : bytes ):
> res = b''
> i_blk, left_bytes = divmod( len(bytestr), 3 )
> ```
<br />
<br />
<div align="center">
**[`^ back to top ^`](#about)**
</div>
<br />
---
<br />
#### NodeJS
The following allows you to configure ESLint and Prettier.
<br />
<br />
##### Prettier
We have opted to make use of [ESLint](#eslint) over Prettier. We provide a detailed ESLint flag config file with very specific linting rules. Please review that section for more information.
<br />
<br />
##### ESLint
Within the root folder of the repo, there are several configuration files which you should be using within the project. These files dictate how prettier and eslint will behave and what is acceptable / not acceptable.
<br />
Pick the config file below depending on which version of ESLint you are using. The v8 and older `.eslint` may not be there if we have migrated over to an Eslint v9 flat config file:
<br />
###### v9 & Newer (Config)
Our NodeJS applications require that you utilize ESLint v9 or newer which makes use of a flat config structure. You may find a copy of our flat config at the link below:
- [📄 eslint.config.mjs](https://github.com/thebinaryninja/tvapp2/blob/main/tvapp2/eslint.config.mjs)
<br />
###### v8 & Older (Config)
- We no longer utilize any version of ESLint older than version 9.
<br />
<br />
> [!NOTE]
> When submitting your pull request, these linting and style rules will be verified with all of your files. If you did not follow these rules; the linter tests on your pull request will fail; and you'll be expected to correct these issues before your submission will be transferred over for human review.
<br />
<br />
##### Packages
We use the following packages for linting and prettier.
<br />
| Package | Repo File | Description |
| --- | --- | --- |
| [@stylistic/eslint-plugin-js](https://npmjs.com/package/@stylistic/eslint-plugin-js) | [package.json](./package.json) | JavaScript stylistic rules for ESLint, migrated from eslint core. |
| [@stylistic/eslint-plugin-ts](https://npmjs.com/package/@stylistic/eslint-plugin-ts) | [package.json](./package.json) | TypeScript stylistic rules for ESLint, migrated from typescript-eslint. |
| [@stylistic/eslint-plugin-plus](https://npmjs.com/package/@stylistic/eslint-plugin-plus) | [package.json](./package.json) | Supplementary rules introduced by ESLint Stylistic. |
| [eslint-plugin-prettier](https://npmjs.com/package/eslint-plugin-prettier) | [package.json](./package.json) | Runs Prettier as an ESLint rule and reports differences as individual ESLint issues. |
<br />
You can add the following to your `package.json` file:
https://github.com/TheBinaryNinja/tvapp2/blob/1c75f11e9f0506ad3dd05133fdafc3aeb87686ca/tvapp2/package.json#L81-L92
<br />
<br />
##### Indentation
Use `4 spaces` per indentation level.
<br />
<br />
##### Style
For files that are not controlled by [Prettier](#prettier) or [ESLint](#eslint); use `Allman Style`. Braces should be on their own lines, and any code inside the braces should be indented 4 spaces.
<br />
```javascript
return {
status: "failure",
user:
{
id: "1aaa35aa-fb3a-62ae-ffec-a14g7fc401ac",
label: "Test String",
}
};
while (x == y)
{
foo();
bar();
}
```
<br />
<br />
##### Line Length
Keep the maximum character count to `100 characters per line`. The configs on this page have prettier automatically set up to detect more than 100 characters per line.
<br />
##### Commenting
Comment your code. It helps novice readers to better understand the process. You may use block style commenting, or single lines:
```javascript
/*
tests to decide if the end-user is running on Darwin or another platform.
*/
test(`Return true if platform is Darwin`, () => {
process.platform = 'darwin';
expect(bIsDarwin()).toBe(true);
});
test(`Return false if platform is not Darwin`, () => {
process.platform = 'linux';
expect(bIsDarwin()).toBe(false);
});
```
<br />
##### Casing
Stick to `camelCase` as much as possible.
```javascript
let myVar = 'one';
let secondVar = 'two';
```
<br />
If you are defining a new environment variable; it must be in ALL CAPS in the `Dockerfile`:
```dockerfile
ENV DIR_BUILD=/usr/src/app
ENV DIR_RUN=/usr/bin/app
ENV URL_REPO="https://git.binaryninja.net/binaryninja/"
ENV WEB_IP="0.0.0.0"
ENV WEB_PORT=4124
ENV STREAM_QUALITY="hd"
ENV FILE_PLAYLIST="playlist.m3u8"
ENV FILE_EPG="xmltv.xml"
ENV LOG_LEVEL=4
ENV TZ="Etc/UTC"
```
<br />
Then you may call your new environment variable within the Javascript code; and ensure you define a default value to correct any user misconfigurations:
```javascript
const envUrlRepo = process.env.URL_REPO || 'https://git.binaryninja.net/binaryninja';
const envStreamQuality = process.env.STREAM_QUALITY || 'hd';
const envFileM3U = process.env.FILE_PLAYLIST || 'playlist.m3u8';
const envFileXML = process.env.FILE_EPG || 'xmltv.xml';
const envFileTAR = process.env.FILE_TAR || 'xmltv.xml.gz';
```
<br />
<br />
<div align="center">
**[`^ back to top ^`](#about)**
</div>
<br />
<br />
<br />
<br />
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- BADGE > GENERAL -->
[general-npmjs-uri]: https://npmjs.com
[general-nodejs-uri]: https://nodejs.org
[general-npmtrends-uri]: http://npmtrends.com/tvapp2
<!-- BADGE > VERSION > GITHUB -->
[github-version-img]: https://img.shields.io/github/v/tag/thebinaryninja/tvapp2?logo=GitHub&label=Version&color=ba5225
[github-version-uri]: https://github.com/thebinaryninja/tvapp2/releases
<!-- BADGE > LICENSE > MIT -->
[license-mit-img]: https://img.shields.io/badge/MIT-FFF?logo=creativecommons&logoColor=FFFFFF&label=License&color=9d29a0
[license-mit-uri]: https://github.com/thebinaryninja/tvapp2/blob/main/LICENSE
<!-- BADGE > GITHUB > DOWNLOAD COUNT -->
[github-downloads-img]: https://img.shields.io/github/downloads/thebinaryninja/tvapp2/total?logo=github&logoColor=FFFFFF&label=Downloads&color=376892
[github-downloads-uri]: https://github.com/thebinaryninja/tvapp2/releases
<!-- BADGE > GITHUB > DOWNLOAD SIZE -->
[github-size-img]: https://img.shields.io/github/repo-size/thebinaryninja/tvapp2?logo=github&label=Size&color=59702a
[github-size-uri]: https://github.com/thebinaryninja/tvapp2/releases
<!-- BADGE > ALL CONTRIBUTORS -->
[contribs-all-img]: https://img.shields.io/github/all-contributors/thebinaryninja/tvapp2?logo=contributorcovenant&color=de1f6f&label=contributors
[contribs-all-uri]: https://github.com/all-contributors/all-contributors
<!-- BADGE > GITHUB > BUILD > NPM -->
[github-build-img]: https://img.shields.io/github/actions/workflow/status/thebinaryninja/tvapp2/npm-release.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-uri]: https://github.com/thebinaryninja/tvapp2/actions/workflows/npm-release.yml
<!-- BADGE > GITHUB > BUILD > Pypi -->
[github-build-pypi-img]: https://img.shields.io/github/actions/workflow/status/thebinaryninja/tvapp2/release-pypi.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-pypi-uri]: https://github.com/thebinaryninja/tvapp2/actions/workflows/pypi-release.yml
<!-- BADGE > GITHUB > TESTS -->
[github-tests-img]: https://img.shields.io/github/actions/workflow/status/thebinaryninja/tvapp2/npm-tests.yml?logo=github&label=Tests&color=2c6488
[github-tests-uri]: https://github.com/thebinaryninja/tvapp2/actions/workflows/npm-tests.yml
<!-- BADGE > GITHUB > COMMIT -->
[github-commit-img]: https://img.shields.io/github/last-commit/thebinaryninja/tvapp2?logo=conventionalcommits&logoColor=FFFFFF&label=Last%20Commit&color=313131
[github-commit-uri]: https://github.com/thebinaryninja/tvapp2/commits/main/
<!-- BADGE > Github > Docker Image > SELFHOSTED BADGES -->
[github-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=development-amd64%2Cdevelopment%2Cdevelopment-arm64%2Clatest&label=version&trim=
[github-docker-version-uri]: https://github.com/thebinaryninja/tvapp2/pkgs/container/tvapp2
<!-- BADGE > Dockerhub > Docker Image -->
[dockerhub-docker-version-img]: https://img.shields.io/docker/v/thebinaryninja/tvapp2?sort=semver&arch=arm64
[dockerhub-docker-version-uri]: https://hub.docker.com/repository/docker/thebinaryninja/tvapp2/general
<!-- BADGE > Gitea > Docker Image > SELFHOSTED BADGES -->
[gitea-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=latest&label=version&trim=
[gitea-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/tvapp2
<!-- BADGE > Gitea 2 > Docker Image -->
[gitea2-docker-version-img]: https://img.shields.io/gitea/v/release/binaryninja/tvapp2?gitea_url=https%3A%2F%2Fgit.binaryninja.net
[gitea2-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/-/packages/container/tvapp2/latest
<!-- BADGE > BUTTON > SUBMIT ISSUES -->
[btn-github-submit-img]: https://img.shields.io/badge/submit%20new%20issue-de1f5c?style=for-the-badge&logo=github&logoColor=FFFFFF
[btn-github-submit-uri]: https://github.com/thebinaryninja/tvapp2/issues
<!-- prettier-ignore-end -->
<!-- markdownlint-restore -->

View File

@@ -9,8 +9,9 @@ conventions:
The tag symbol in conjunction with a version number denotes when a specific feature or behavior was added. Make sure you're at least on this version if you want to use it.
: <!-- md:version --> default
: <!-- md:version stable- --> stable
: <!-- md:version beta- --> beta
: <!-- md:version development- --> development
<br />
@@ -19,11 +20,13 @@ The tag symbol in conjunction with a version number denotes when a specific feat
These icons define what type of control a specified setting uses.
: <!-- md:control toggle --> toggle
: <!-- md:control toggle_on --> toggle on
: <!-- md:control toggle_off --> toggle off
: <!-- md:control textbox --> textbox
: <!-- md:control dropdown --> dropdown
: <!-- md:control button --> button
: <!-- md:control slider --> slider
: <!-- md:control color --> color wheel
: <!-- md:control color #E5E5E5 #121315 --> color wheel
<br />
@@ -45,40 +48,42 @@ This defines a command
<br />
### <!-- md:flag experimental --> Experimental { data-toc-label="Experimental" }
### <!-- md:flag --> Flags { #flags data-toc-label="Flags" }
: <!-- md:flag --> Default
: <!-- md:flag experimental --> Experimental
: <!-- md:flag required --> Required
: <!-- md:flag customization --> Customization
: <!-- md:flag metadata --> Metadata
: <!-- md:flag dangerous --> Dangerous
: <!-- md:flag multiple --> Multiple
: <!-- md:flag setting --> Setting
Anything listed with this icon are features or functionality that are still in development and may change in future versions.
<br />
### <!-- md:flag required --> Required value { #required data-toc-label="Required value" }
Items listed with this symbol indicate that they are required to be set.
<br />
### <!-- md:flag customization --> Customization { #customization data-toc-label="Customization" }
This symbol denotes that the item described is a customization which affects the overall look of the app.
<br />
### <!-- md:3rdparty --> 3rd Party { data-toc-label="3rd Party" }
This symbol denotes that the item described is classified as something that changes the overall functionality of the plugin.
<br />
### <!-- md:flag metadata --> Metadata property { #metadata data-toc-label="Metadata property" }
### <!-- md:flag setting --> Configurable Settings { #setting data-toc-label="Configurable Setting" }
This symbol denotes that the item described is a metadata property, which can
be used in Markdown documents as part of the front matter definition.
The following denotes a configurable setting. These can also be broken up into individual settings as shown below:
<br />
#### <!-- md:setting example.setting.enabled -->
<!-- md:version 1.0.0 -->
<!-- md:default `true` -->
### <!-- md:flag setting --> Configurable Setting { #setting data-toc-label="Configurable Setting" }
This is an example setting
This symbol denotes that an item is configurable by the user
#### <!-- md:setting example.setting.other -->
<!-- md:version 1.0.0 -->
<!-- md:default `true` -->
This is another example setting
<br />
@@ -91,9 +96,23 @@ can be used multiple times in the `plugins` setting in `mkdocs.yml`.
### <!-- md:feature --> Optional feature { #feature data-toc-label="Optional feature" }
Most of the features are hidden behind feature flags, which means they must
be explicitly enabled via `mkdocs.yml`. This allows for the existence of
potentially orthogonal features.
Some features may be hidden behind feature flags, which means they must
be explicitly enabled first before they can be configured. This allows
for the existence of potentially orthogonal features.
<br />
### <!-- md:markdown --> Markdown extension { data-toc-label="Markdown extension" #extension }
This symbol denotes that the thing described is a Markdown element.
<br />
### <!-- md:flag dangerous --> Dangerous { #danger data-toc-label="Dangerous Property" }
This symbol denotes that the item described is a metadata property, which can
be used in Markdown documents as part of the front matter definition.
<br />
@@ -106,4 +125,59 @@ available to backers. Normal users will not have access to this particular item.
---
<br />
<br />
## Other Tags
<br />
### Example Download { #example data-toc-label="Dangerous Property" }
<!-- md:example my-example-file -->
The following denotes a downloadable file.
<br />
### Commands
<!-- md:command `-s, --start` -->
The above denotes a command which can be executed in a terminal / command prompt.
<br />
## Options
Options are another form of setting which lists what the option does, and then examples of how it works.
<!-- md:option rss.enabled -->
: <!-- md:default `true` --> This option specifies whether
the plugin is enabled when building your project. If you want to speed up
local builds, you can use an [environment variable][mkdocs.env]:
``` yaml
plugins:
- rss:
enabled: !ENV [CI, false]
```
<!-- md:option rss.match_path -->
: <!-- md:default `.*` --> This option specifies which
pages should be included in the feed. For example, to only include blog
posts in the feed, use the following regular expression:
``` yaml
plugins:
- rss:
match_path: blog/posts/.*
```
<br />
---
<br />
<br />
<br />

View File

@@ -0,0 +1,218 @@
---
title: About TVApp2
tags:
- info
---
# About
<figure markdown="span">
![Image settings](https://raw.githubusercontent.com/TheBinaryNinja/tvapp2/main/docs/img/screenshots/01.png){ width="60%" }
<figcaption>TVApp2 Main Interface</figcaption>
</figure>
<br />
<h1 align="center"><b>TVApp2: M3U Playlist & Data Guides</b></h1>
<p align="center" markdown="1">
<!-- prettier-ignore-start -->
[![Version][github-version-img]][github-version-uri]
[![Downloads][github-downloads-img]][github-downloads-uri]
[![Size][github-size-img]][github-size-img]
[![Last Commit][github-commit-img]][github-commit-img]
[![Contributors][contribs-all-img]](#contributors)
<!-- prettier-ignore-end -->
</p>
## What is TVApp2?
**TVApp2** is a docker image which allows you to download M3U playlists and EPG guide data from various online IPTV services such as **TheTVApp**, **TVPass**, and **MoveOnJoy**. The playlist and guide data files can be imported into your favorite IPTV applications such as Jellyfin, Plex, and Emby.
Once the docker container is started; a fresh copy of the channel list and TV guide data will be downloaded and generated within your docker container. You can then visit the website URL associated with your docker container; which will give you direct links to the files that you can utilize with the above listed IPTV apps.
All channels contain multiple sources so that you have a reliable streaming experience, and helps you combat moments when one channel source goes offline.
<br />
---
<br />
## Associated Links
Check out the following websites for additional resources for the TVApp2 docker image below.
<br />
---
<br />
## Features
The following is a small list of the features available with the TVApp2 container:
- Multiple IPTV service sources:
- TheTVApp
- TVPass
- MoveOnJoy
- Channel playlists can be downloaded as a `.m38u` or a compressed `.gzip` archive.
- Compressed gzip compatible with 3rd party apps like Cabernet and Jellyfin.
- Tracking statistics which show the last update time, size, and a description for each file's purpose.
- Direct access to download each of the generated files, including multiple easy-to-remember URLs for each file type.
- **M3U Playlist**:
- http://127.0.0.1:4124/playlist
- http://127.0.0.1:4124/m3u
- http://127.0.0.1:4124/m38u
- **EPG Guide Data (Uncompressed)**:
- http://127.0.0.1:4124/guide
- http://127.0.0.1:4124/epg
- http://127.0.0.1:4124/xml
- **EPG Guide Data (Compressed)**:
- http://127.0.0.1:4124/gzip
- http://127.0.0.1:4124/gz
- Video sources include both quality options `hd` and `sd`.
- Easily mountable docker volumes to access the generated files quickly.
- Wide variety of docker environment variables to change the binding IP, port, app root directory, quality, timezone, etc.
- Small docker image size; based on Alpine 3.x which averages `40MB`.
- Compatible with architectures `amd64` and `arm64/aarm64`.
- Example configurations for 3rd party apps such as Traefik and Authentik.
<br />
---
<br />
## ✨ Contributors
We are always looking for contributors. If you feel that you can provide something useful to Gistr, then we'd love to review your suggestion. Before submitting your contribution, please review the following resources:
- [Pull Request Procedure](https://github.com/TheBinaryNinja/tvapp2/blob/main/.github/PULL_REQUEST_TEMPLATE.md)
- [Contributor Policy](https://github.com/TheBinaryNinja/tvapp2/blob/main/CONTRIBUTING.md)
<br />
Want to help but can't write code?
- Review [active questions by our community](https://github.com/TheBinaryNinja/tvapp2/labels/help%20wanted) and answer the ones you know.
<br />
<div align="center" markdown="1">
![Alt](https://repobeats.axiom.co/api/embed/fb7e11f0bc61b125f923a0ee3eb0bd8aba79b8d5.svg "Repobeats analytics image")
</div>
<br />
The following people have helped get this project going:
<br />
<div align="center" markdown="1">
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![Contributors][contribs-all-img]](#contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top"><a href="https://github.com/Aetherinox">
<img src="https://avatars.githubusercontent.com/u/118329232?v=4?s=40" width="80px;" alt="Aetherinox"/><br /><sub><b>Aetherinox</b></sub></a><br /><a href="https://github.com/TheBinaryNinja/tvapp2/commits?author=Aetherinox" title="Code">💻</a>
</td>
<td align="center" valign="top"><a href="https://github.com/iFlip721">
<img src="https://avatars.githubusercontent.com/u/28721588?v=4" width="80px;" alt="iFlip721"/><br /><sub><b>iFlip721</b></sub></a><br /><a href="https://github.com/TheBinaryNinja/tvapp2/commits?author=iFlip721" title="Code">💻</a>
</td>
<td align="center" valign="top"><a href="https://github.com/Nvmdfth">
<img src="https://avatars.githubusercontent.com/u/32874812?v=4" width="80px;" alt="Nvmdfth"/><br /><sub><b>Optx</b></sub></a><br /><a href="https://github.com/TheBinaryNinja/tvapp2/commits?author=Nvmdfth" title="Code">💻</a>
</td>
</tr>
</tbody>
</table>
</div>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
<br />
---
<br />
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- BADGE > GENERAL -->
[general-npmjs-uri]: https://npmjs.com
[general-nodejs-uri]: https://nodejs.org
[general-npmtrends-uri]: http://npmtrends.com/csf-firewall
<!-- BADGE > VERSION > GITHUB -->
[github-version-img]: https://img.shields.io/github/v/tag/TheBinaryNinja/tvapp2?logo=GitHub&label=Version&color=ba5225
[github-version-uri]: https://github.com/TheBinaryNinja/tvapp2/releases
<!-- BADGE > LICENSE > MIT -->
[license-mit-img]: https://img.shields.io/badge/MIT-FFF?logo=creativecommons&logoColor=FFFFFF&label=License&color=9d29a0
[license-mit-uri]: https://github.com/TheBinaryNinja/tvapp2/blob/main/LICENSE
<!-- BADGE > GITHUB > DOWNLOAD COUNT -->
[github-downloads-img]: https://img.shields.io/github/downloads/TheBinaryNinja/tvapp2/total?logo=github&logoColor=FFFFFF&label=Downloads&color=376892
[github-downloads-uri]: https://github.com/TheBinaryNinja/tvapp2/releases
<!-- BADGE > GITHUB > DOWNLOAD SIZE -->
[github-size-img]: https://img.shields.io/github/repo-size/TheBinaryNinja/tvapp2?logo=github&label=Size&color=59702a
[github-size-uri]: https://github.com/TheBinaryNinja/tvapp2/releases
<!-- BADGE > ALL CONTRIBUTORS -->
[contribs-all-img]: https://img.shields.io/github/all-contributors/TheBinaryNinja/tvapp2?logo=contributorcovenant&color=de1f6f&label=contributors
[contribs-all-uri]: https://github.com/all-contributors/all-contributors
<!-- BADGE > GITHUB > BUILD > NPM -->
[github-build-img]: https://img.shields.io/github/actions/workflow/status/TheBinaryNinja/tvapp2/npm-release.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-uri]: https://github.com/TheBinaryNinja/tvapp2/actions/workflows/npm-release.yml
<!-- BADGE > GITHUB > BUILD > Pypi -->
[github-build-pypi-img]: https://img.shields.io/github/actions/workflow/status/TheBinaryNinja/tvapp2/release-pypi.yml?logo=github&logoColor=FFFFFF&label=Build&color=%23278b30
[github-build-pypi-uri]: https://github.com/TheBinaryNinja/tvapp2/actions/workflows/pypi-release.yml
<!-- BADGE > GITHUB > TESTS -->
[github-tests-img]: https://img.shields.io/github/actions/workflow/status/TheBinaryNinja/tvapp2/npm-tests.yml?logo=github&label=Tests&color=2c6488
[github-tests-uri]: https://github.com/TheBinaryNinja/tvapp2/actions/workflows/npm-tests.yml
<!-- BADGE > GITHUB > COMMIT -->
[github-commit-img]: https://img.shields.io/github/last-commit/TheBinaryNinja/tvapp2?logo=conventionalcommits&logoColor=FFFFFF&label=Last%20Commit&color=313131
[github-commit-uri]: https://github.com/TheBinaryNinja/tvapp2/commits/main/
<!-- BADGE > Github > Docker Image > SELFHOSTED BADGES -->
[github-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=development-amd64%2Cdevelopment%2Cdevelopment-arm64%2Clatest&label=version&trim=
[github-docker-version-uri]: https://github.com/TheBinaryNinja/tvapp2/pkgs/container/tvapp2
<!-- BADGE > Dockerhub > Docker Image -->
[dockerhub-docker-version-img]: https://img.shields.io/docker/v/thebinaryninja/tvapp2?sort=semver&arch=arm64
[dockerhub-docker-version-uri]: https://hub.docker.com/repository/docker/thebinaryninja/tvapp2/general
<!-- BADGE > Gitea > Docker Image > SELFHOSTED BADGES -->
[gitea-docker-version-img]: https://badges-ghcr.onrender.com/thebinaryninja/tvapp2/latest_tag?color=%233d9e18&ignore=latest&label=version&trim=
[gitea-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/tvapp2
<!-- BADGE > Gitea 2 > Docker Image -->
[gitea2-docker-version-img]: https://img.shields.io/gitea/v/release/binaryninja/tvapp2?gitea_url=https%3A%2F%2Fgit.binaryninja.net
[gitea2-docker-version-uri]: https://git.binaryninja.net/BinaryNinja/-/packages/container/tvapp2/latest
<!-- BADGE > BUTTON > SUBMIT ISSUES -->
[btn-github-submit-img]: https://img.shields.io/badge/submit%20new%20issue-de1f5c?style=for-the-badge&logo=github&logoColor=FFFFFF
[btn-github-submit-uri]: https://github.com/TheBinaryNinja/tvapp2/issues
<!-- prettier-ignore-end -->
<!-- markdownlint-restore -->

View File

@@ -1,13 +0,0 @@
---
title: About TVApp2
tags:
- info
---
# About TVApp2
<br />
---
<br />

429
docs/docs/config/env.md Normal file
View File

@@ -0,0 +1,429 @@
---
title: Environment Variables
tags:
- config
---
# Environment Variables
Environment variables allow you to modify how TVApp2 functions within a docker container. Ensure that
you understand the setting you are changing before you modify these values, otherwise, TVApp2 may fail to
start due to misconfigurations.
<br />
## TZ
<!-- md:control env -->
<!-- md:version stable-1.0.0 -->
<!-- md:default `Etc/UTC` -->
The `TZ` environment variable specifies the timezone that your docker container will
utilize. This is useful for syncing your local time with console outputs such as
our logging system.
=== "Example"
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- TZ=Etc/UTC # (1)
```
1. :information: Changing this env variable will change the time for anything
related to the TVApp2 docker container.
=== "Timezones"
``` yaml
Etc/UTC
Africa/Cairo
Africa/Johannesburg
Africa/Lagos
America/Argentina/Buenos_Aires
America/Bogota
America/Caracas
America/Chicago
America/El_Salvador
America/Juneau
America/Lima
America/Los_Angeles
America/Mexico_City
America/New_York
America/Phoenix
America/Santiago
America/Sao_Paulo
America/Toronto
America/Vancouver
Asia/Almaty
Asia/Ashkhabad
Asia/Bahrain
Asia/Bangkok
Asia/Chongqing
Asia/Dubai
Asia/Ho_Chi_Minh
Asia/Hong_Kong
Asia/Jakarta
Asia/Jerusalem
Asia/Kathmandu
Asia/Kolkata
Asia/Kuwait
Asia/Muscat
Asia/Qatar
Asia/Riyadh
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Taipei
Asia/Tehran
Asia/Tokyo
Atlantic/Reykjavik
Australia/ACT
Australia/Adelaide
Australia/Brisbane
Australia/Sydney
Europe/Athens
Europe/Belgrade
Europe/Berlin
Europe/Copenhagen
Europe/Helsinki
Europe/Istanbul
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Moscow
Europe/Paris
Europe/Riga
Europe/Rome
Europe/Stockholm
Europe/Tallinn
Europe/Vilnius
Europe/Warsaw
Europe/Zurich
Pacific/Auckland
Pacific/Chatham
Pacific/Fakaofo
Pacific/Honolulu
Pacific/Norfolk
US/Mountain
```
<br />
## WEB_IP
<!-- md:control env -->
<!-- md:version stable-1.0.0 -->
<!-- md:default `0.0.0.0` -->
The `WEB_IP` environment variable allows you to define what IP address will be
bound to the TVApp2 docker image.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- WEB_IP=0.0.0.0 # (1)
```
1. :information: Specify `0.0.0.0` to bind to all local IP addresses.
<br />
## WEB_PORT
<!-- md:control env -->
<!-- md:version stable-1.0.0 -->
<!-- md:default `4124` -->
The `WEB_PORT` environment variable allows you to define what port the TVApp2
docker container will listen to.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- WEB_IP=4124 # (1)
```
1. :information: The default port is `4124`
<br />
## URL_REPO
<!-- md:control env -->
<!-- md:version stable-1.0.0 -->
<!-- md:default `https://git.binaryninja.net/binaryninja` -->
<!-- md:flag dangerous -->
The `URL_REPO` environment variable allows you to specify what Github repo is used to communicate
with in order to fetch IPTV data. This is used as an internal environment variable by the developers
and should not be changed by the end-user; otherwise you will be unable to fetch IPTV data.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- URL_REPO=https://git.binaryninja.net/binaryninja # (1)
```
1. :warning: It is highly recommended that you do not change this value
otherwise you will not be able to download the latest M3U playlists and EPG
guide data.
<br />
## DIR_BUILD
<!-- md:control env -->
<!-- md:version stable-1.0.0 -->
<!-- md:default `/usr/src/app` -->
<!-- md:flag dangerous -->
The `DIR_BUILD` environment variable specifies what local folder will be utilized
by the TVApp2 docker container when the container builds the app.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- DIR_BUILD=/usr/src/app # (1)
```
1. :warning: You should not change this unless you are an advanced user.
<br />
## DIR_RUN
<!-- md:control env -->
<!-- md:version stable-1.0.0 -->
<!-- md:default `/usr/src/app` -->
<!-- md:flag dangerous -->
The `DIR_RUN` environment variable specifies what local folder will be utilized
by the TVApp2 docker container when the container has built the app and placed it
into a production folder.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- DIR_RUN=/usr/bin/app # (1)
```
1. :warning: You should not change this unless you are an advanced user.
<br />
## STREAM_QUALITY
<!-- md:control env -->
<!-- md:version stable-1.1.0 -->
<!-- md:default `hd` -->
The `STREAM_QUALITY` environment variable specifies the default stream quality that will
be used when you initiate a new channel to view.
Available Options:
* `hd` High Definition
* `sd` Standard Definition
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- STREAM_QUALITY=hd # (1)
```
1. :information: This environment variable has the following options:
- hd
- sd
<br />
## FILE_PLAYLIST
<!-- md:control env -->
<!-- md:version stable-1.1.0 -->
<!-- md:default `playlist.m3u8` -->
The `FILE_PLAYLIST` environment variable specifies the filename that will be utilized when
your .m3u playlist file is generated.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- FILE_PLAYLIST=playlist.m3u8 # (1)
```
1. :information: Changing this file only changes the filename locally; it does
not affect the server-side fetching mechanism.
<br />
## FILE_EPG
<!-- md:control env -->
<!-- md:version stable-1.1.0 -->
<!-- md:default `xmltv.xml` -->
The `FILE_EPG` environment variable specifies the filename that will be utilized when
your .xml EPG playlist file is generated.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- FILE_EPG=xmltv.xml # (1)
```
1. :information: Changing this file only changes the filename locally; it does
not affect the server-side fetching mechanism.
<br />
## FILE_GZIP
<!-- md:control env -->
<!-- md:version stable-1.1.0 -->
<!-- md:default `xmltv.xml.gz` -->
The `FILE_GZIP` environment variable specifies the filename that will be utilized when
a compressed `.gzip` is generated and when you download the file.
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- FILE_GZIP=xmltv.xml.gz # (1)
```
1. :information: Changing this file only changes the filename locally for
generation and downloading. It does not affect the server-side fetching
mechanism.
<br />
## LOG_LEVEL
<!-- md:control env -->
<!-- md:version stable-1.1.0 -->
<!-- md:default `4` -->
The `LOG_LEVEL` environment variable allows you specify how deep logs should go
when being output to your console.
=== "Example"
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- LOG_LEVEL=4 # (1)
```
1. :information: The default log level is `4` (info).
=== "Logging Options"
| Log Level | Name | Description |
| --------------- | ----------- | ------------------------------------------------------------------------------- |
| `6` | Trace | Displays all possible logs in console, along with anything below this line. |
| `5` | Debug | Displays debug / developer logs, along with anything below this line. |
| `4` | Info | Displays informative logs, along with anything below this line. |
| `3` | Notice | Displays important notices, along with anything below this line. |
| `2` | Warm | Displays warnings, along with anything below this line. |
| `1` | Error | Displays only errors, none of the log levels above this line will be shown |

120
docs/docs/config/volumes.md Normal file
View File

@@ -0,0 +1,120 @@
---
title: Environment Variables
tags:
- config
---
# Mountable Volumes
Mountable volumes in Docker allow you to share folders within a docker container with your host machine. This allows you to access these specific files without having to bash into the container and using the terminal to navigate around.
The TVApp2 docker image provides a few different paths that you can mount to your host machine; as outlined below.
<br />
## 📁 /usr/bin/app
<!-- md:control env -->
<!-- md:version stable-1.0.0 -->
<!-- md:default `Etc/UTC` -->
The `TZ` environment variable specifies the timezone that your docker container will
utilize. This is useful for syncing your local time with console outputs such as
our logging system.
=== "Example"
``` { .yaml .copy .select title="docker-compose.yml" linenums="1" hl_lines="13" }
services:
tvapp2:
container_name: tvapp2
image: ghcr.io/thebinaryninja/tvapp2:latest
restart: unless-stopped
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/config
- ./app:/usr/bin/app
environment:
- TZ=Etc/UTC # (1)
```
1. :information: Changing this env variable will change the time for anything
related to the TVApp2 docker container.
=== "Timezones"
``` yaml
Etc/UTC
Africa/Cairo
Africa/Johannesburg
Africa/Lagos
America/Argentina/Buenos_Aires
America/Bogota
America/Caracas
America/Chicago
America/El_Salvador
America/Juneau
America/Lima
America/Los_Angeles
America/Mexico_City
America/New_York
America/Phoenix
America/Santiago
America/Sao_Paulo
America/Toronto
America/Vancouver
Asia/Almaty
Asia/Ashkhabad
Asia/Bahrain
Asia/Bangkok
Asia/Chongqing
Asia/Dubai
Asia/Ho_Chi_Minh
Asia/Hong_Kong
Asia/Jakarta
Asia/Jerusalem
Asia/Kathmandu
Asia/Kolkata
Asia/Kuwait
Asia/Muscat
Asia/Qatar
Asia/Riyadh
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Taipei
Asia/Tehran
Asia/Tokyo
Atlantic/Reykjavik
Australia/ACT
Australia/Adelaide
Australia/Brisbane
Australia/Sydney
Europe/Athens
Europe/Belgrade
Europe/Berlin
Europe/Copenhagen
Europe/Helsinki
Europe/Istanbul
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Moscow
Europe/Paris
Europe/Riga
Europe/Rome
Europe/Stockholm
Europe/Tallinn
Europe/Vilnius
Europe/Warsaw
Europe/Zurich
Pacific/Auckland
Pacific/Chatham
Pacific/Fakaofo
Pacific/Honolulu
Pacific/Norfolk
US/Mountain
```
<br />

View File

@@ -0,0 +1,13 @@
[mkdocs]: https://www.mkdocs.org
[mkdocs.dotfiles]: https://www.mkdocs.org/dev-guide/themes/#dot-files
[mkdocs.metadata]: https://www.mkdocs.org/user-guide/writing-your-docs/#yaml-style-meta-data
[mkdocs.env]: https://www.mkdocs.org/user-guide/configuration/#environment-variables
[mkdocs.docs_dir]: https://www.mkdocs.org/user-guide/configuration/#docs_dir
[mkdocs.extra_templates]: https://www.mkdocs.org/user-guide/configuration/#extra_templates
[mkdocs.site_dir]: https://www.mkdocs.org/user-guide/configuration/#site_dir
[mkdocs.site_url]: https://www.mkdocs.org/user-guide/configuration/#site_url
[mkdocs.site_description]: https://www.mkdocs.org/user-guide/configuration/#site_description
[mkdocs.nav]: https://www.mkdocs.org/user-guide/configuration/#nav
[mkdocs.plugins]: https://www.mkdocs.org/user-guide/configuration/#plugins
[mkdocs.strict]: https://www.mkdocs.org/user-guide/configuration/#strict
[mkdocs.use_directory_urls]: https://www.mkdocs.org/user-guide/configuration/#use_directory_urls

View File

@@ -0,0 +1,6 @@
document$.subscribe(function() {
var tables = document.querySelectorAll("article table:not([class])")
tables.forEach(function(table) {
new Tablesort(table)
})
})

View File

@@ -5,6 +5,16 @@
[ data-md-color-scheme="default" ]
{
--md-accent-fg-color--transparent: #1b1b1b2f;
--md-typeset-a-color: #568afa;
--md-badge-icon-color: #2b2b2b;
--md-badge-icon-hover-color: #568afa;
--md-badge-bg-color--transparent: #1b1b1b2f;
--md-badge-bg-hover-color: #1b1b1b2f;
--md-table-head-bg-color: #597dd2;
--md-table-body-bg-color: rgb(221, 221, 221);
--md-table-body-text-color: rgb(20, 20, 20);
/*
Tag > Background Color
*/
@@ -24,15 +34,6 @@
line-height: 1.3;
}
/*
Badge > Left Box (Icon
*/
.md-typeset .mdx-badge__icon
{
background-color: var(--md-accent-fg-color);
}
/*
Badges > Right Box
*/
@@ -52,15 +53,6 @@
color: #FFF;
}
/*
Badge > Icon Color
*/
.md-typeset .mdx-badge svg
{
color: #FFFFFF;
}
/*
Make <small>text</small> opaque. used for changelog to show date
*/
@@ -84,16 +76,10 @@
margin-inline-end: 5px;
}
h3 .mdx-badge svg
{
padding-left: 2px;
padding-top: 1px;
}
.color-box {
float: left;
height: 24px;
width: 24px;
height: 21px;
width: 21px;
border: 1px solid rgba( 255, 255, 255, 0.2 );
clear: both;
}
@@ -111,11 +97,6 @@
padding-left: 4px;
}
.md-typeset table:not([class]) tbody tr
{
background-color: rgb(255, 255, 255);
}
/*
Table > Outter Border / Background
*/
@@ -125,6 +106,17 @@
}
.md-typeset table:not([class]) td
{
border-top: 2px solid var(--md-typeset-table-color);
padding: .9375em 1.25em;
padding-top: 0.9375em;
padding-bottom: 0.9375em;
padding-left: 1.25em;
vertical-align: top;
line-height: 20px;
}
/*
Table > Outter Border / Background
*/
@@ -156,15 +148,6 @@
{
white-space: nowrap;
/*background-color: var(--md-code-bg-color);*/
min-width: 25%;
border-right: 1px solid rgba( 255, 255, 255, 0.14);
background-color: rgba(194, 194, 194, 0.28);
}
.md-typeset__table thead
{
background-color: var(--md-accent-fg-color);
color: #FFF;
}
/*
@@ -233,29 +216,42 @@
--md-code-hl-generic-color: var(--md-default-fg-color--light);
--md-code-hl-variable-color: var(--md-default-fg-color--light);
--md-typeset-color: var(--md-default-fg-color);
--md-typeset-a-color: #568afa;
--md-typeset-a-color: #f91d5b;
--md-badge-icon-color: #d0d0d0;
--md-badge-icon-hover-color: #568afa;
--md-badge-bg-color--transparent: #ffffff1c;
--md-badge-bg-hover-color: #FFFFFF2E;
--md-typeset-kbd-color: hsla(var(--md-hue),15%,90%,0.12);
--md-typeset-kbd-accent-color: hsla(var(--md-hue),15%,90%,0.2);
--md-typeset-kbd-border-color: hsla(var(--md-hue),15%,14%,1);
--md-typeset-mark-color: #4287ff4d;
--md-typeset-table-color: hsla(var(--md-hue),15%,95%,0.12);
--md-typeset-table-color: hsla(0%, 0%, 40%, 0.12);
--md-typeset-table-color--light: hsla(var(--md-hue),15%,95%,0.035);
--md-admonition-fg-color: var(--md-default-fg-color);
--md-admonition-bg-color: var(--md-default-bg-color);
--md-footer-bg-color: rgba( 34, 34, 34, 1 );
--md-footer-bg-color--dark: rgba( 15, 15, 15, 1 );
--md-footer-bg-color: rgba( 17, 17, 17, 1 );
--md-footer-bg-color--dark: rgba( 13, 13, 13, 1 );
--md-shadow-z1: 0 0.2rem 0.5rem #0000000d,0 0 0.05rem #0000001a;
--md-shadow-z2: 0 0.2rem 0.5rem #00000040,0 0 0.05rem #00000040;
--md-shadow-z3: 0 0.2rem 0.5rem #0006,0 0 0.05rem #00000059;
--md-table-head-bg-color: #860038;
--md-table-body-text-color: rgb(231, 231, 231);
--md-accent-fg-color--transparent: #FFFFFF2E;
--md-admonition-icon--pied-piper: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M244 246c-3.2-2-6.3-2.9-10.1-2.9-6.6 0-12.6 3.2-19.3 3.7l1.7 4.9zm135.9 197.9c-19 0-64.1 9.5-79.9 19.8l6.9 45.1c35.7 6.1 70.1 3.6 106-9.8-4.8-10-23.5-55.1-33-55.1zM340.8 177c6.6 2.8 11.5 9.2 22.7 22.1 2-1.4 7.5-5.2 7.5-8.6 0-4.9-11.8-13.2-13.2-23 11.2-5.7 25.2-6 37.6-8.9 68.1-16.4 116.3-52.9 146.8-116.7C548.3 29.3 554 16.1 554.6 2l-2 2.6c-28.4 50-33 63.2-81.3 100-31.9 24.4-69.2 40.2-106.6 54.6l-6.3-.3v-21.8c-19.6 1.6-19.7-14.6-31.6-23-18.7 20.6-31.6 40.8-58.9 51.1-12.7 4.8-19.6 10-25.9 21.8 34.9-16.4 91.2-13.5 98.8-10zM555.5 0l-.6 1.1-.3.9.6-.6zm-59.2 382.1c-33.9-56.9-75.3-118.4-150-115.5l-.3-6c-1.1-13.5 32.8 3.2 35.1-31l-14.4 7.2c-19.8-45.7-8.6-54.3-65.5-54.3-14.7 0-26.7 1.7-41.4 4.6 2.9 18.6 2.2 36.7-10.9 50.3l19.5 5.5c-1.7 3.2-2.9 6.3-2.9 9.8 0 21 42.8 2.9 42.8 33.6 0 18.4-36.8 60.1-54.9 60.1-8 0-53.7-50-53.4-60.1l.3-4.6 52.3-11.5c13-2.6 12.3-22.7-2.9-22.7-3.7 0-43.1 9.2-49.4 10.6-2-5.2-7.5-14.1-13.8-14.1-3.2 0-6.3 3.2-9.5 4-9.2 2.6-31 2.9-21.5 20.1L15.9 298.5c-5.5 1.1-8.9 6.3-8.9 11.8 0 6 5.5 10.9 11.5 10.9 8 0 131.3-28.4 147.4-32.2 2.6 3.2 4.6 6.3 7.8 8.6 20.1 14.4 59.8 85.9 76.4 85.9 24.1 0 58-22.4 71.3-41.9 3.2-4.3 6.9-7.5 12.4-6.9.6 13.8-31.6 34.2-33 43.7-1.4 10.2-1 35.2-.3 41.1 26.7 8.1 52-3.6 77.9-2.9 4.3-21 10.6-41.9 9.8-63.5l-.3-9.5c-1.4-34.2-10.9-38.5-34.8-58.6-1.1-1.1-2.6-2.6-3.7-4 2.2-1.4 1.1-1 4.6-1.7 88.5 0 56.3 183.6 111.5 229.9 33.1-15 72.5-27.9 103.5-47.2-29-25.6-52.6-45.7-72.7-79.9zm-196.2 46.1v27.2l11.8-3.4-2.9-23.8zm-68.7-150.4l24.1 61.2 21-13.8-31.3-50.9zm84.4 154.9l2 12.4c9-1.5 58.4-6.6 58.4-14.1 0-1.4-.6-3.2-.9-4.6-26.8 0-36.9 3.8-59.5 6.3z"/></svg>');
/*
Tag > Background Color
Navigation > Tabs
*/
.md-typeset .md-tag
.md-tabs
{
background-color: var(--md-primary-fg-color);
background-color: #860038;
color: var(--md-primary-bg-color);
display: block;
line-height: 1.3;
overflow: auto;
width: 100%;
z-index: 3;
}
/*
@@ -264,8 +260,8 @@
.md-nav
{
font-size: .6rem;
line-height: 1.3;
font-size: .7rem;
line-height: 1.4;
}
.mdx-container
@@ -276,12 +272,18 @@
.md-main
{
background-color: hsla(140, 0%, 5%, 1) !important;
background-color: #161618 !important;
}
.md-main__inner
{
display: flex;
height: 100%;
}
.md-typeset table:not([ class ] ) tbody tr
{
background-color: rgb( 17, 15, 15 );
background-color: rgb( 15, 15, 15 );
}
/*
@@ -315,14 +317,6 @@
{
white-space: nowrap;
/*background-color: var(--md-code-bg-color);*/
min-width: 25%;
border-right: 1px solid rgba( 255, 255, 255, 0.14);
background-color: rgba(70, 65, 77, 0.36);
}
.md-typeset__table thead
{
background-color: #b10f52;
}
/*
@@ -417,16 +411,7 @@
.md-typeset .tabbed-labels
{
background-color: #090909;
}
/*
Badge > Left Box (Icon
*/
.md-typeset .mdx-badge__icon
{
background-color: #3f4faa;
background-color: #0d0d0d;
}
/*
@@ -453,8 +438,7 @@
h3 .mdx-badge svg
{
padding-left: 2px;
padding-top: 1px;
padding-left: 0px;
}
/*
@@ -476,15 +460,6 @@
color: #FFF;
}
/*
Badge > Icon Color
*/
.md-typeset .mdx-badge svg
{
color: #FFFFFF;
}
}
/*
@@ -509,6 +484,14 @@ h4:has(.twemoji) .twemoji
margin-left: -7px;
}
.md-typeset .emojione, .md-typeset .gemoji, .md-typeset .twemoji
{
--md-icon-size: 1.125em;
display: inline-flex;
height: var(--md-icon-size);
vertical-align: middle;
}
/*
Badge > Header Padding
if a badge is used in a header, add padding between the badge and text
@@ -523,12 +506,18 @@ h4:has(.twemoji) .twemoji
*/
.md-nav--primary .md-nav__title
{
background: none;
box-shadow: none;
}
/*
Navigation > Spacer
Add a gap between the last "File" item in nav menu, and the folders under.
*/
li:has(a[href*="about_patcher"])
.md-sidebar--primary li:has(a[href*="about_tvapp2"])
{
margin-bottom: 28px !important;
}
@@ -563,6 +552,34 @@ li:has(a[href*="about_patcher"])
transition: none !important;
}
.md-typeset .mdx-badge--dangerous
{
--md-badge-icon-color: #fff;
--md-badge-icon-hover-color: #ff1058;
--md-badge-bg-color--transparent: #7B1532 !important;
color: #f9f9f9;
--md-typeset-bg-color: #111;
}
.md-typeset .mdx-badge--heart {
--md-badge-icon-color: #e92063;
--md-badge-icon-hover-color: #FFFFFF;
--md-accent-fg-color: #ff4281;
--md-accent-fg-color--transparent: #e920631a;
}
.md-typeset .mdx-badge--heart .twemoji {
animation: heart 1s infinite;
}
.md-typeset .mdx-badge--command
{
--md-typeset-a-color: #ff2d72;
--md-accent-fg-color: #fff;
--md-accent-fg-color--transparent: #ffffff1a;
color: #e91e63;
}
/*
Badge > Header Positioning
This is mainly for the conventions page
@@ -584,7 +601,6 @@ h2:has(.mdx-badge) > .mdx-badge svg
:is(h1, h2, h3, h4, h5, h6) .mdx-badge__icon svg
{
padding-top: 3px !important;
padding-right: 1px;
}
@@ -598,6 +614,22 @@ h2:has(.mdx-badge) > .mdx-badge svg
}
/*
Table > Header
*/
.md-typeset__table table thead, .md-typeset__table > table
{
background-color: var(--md-table-head-bg-color);
color: #FFF;
}
.md-typeset table:not([class]) tbody tr
{
background-color: var(--md-table-body-bg-color);
color: var(--md-table-body-text-color);
}
.mdx-badge__text a
{
padding-top: 2px;
@@ -614,20 +646,40 @@ small
font-size: 60%;
}
/*
Navigation > Category Gap
if you have multiple sub-folders for a group of pages, add a gap between categories on left-side navigation
*/
.md-nav__item--section
{
display: block;
margin: 2.00em 0;
margin-bottom: 2em;
}
/*
Menu Navigation > FontAwesome Folder Icons (for folders)
*/
label.md-nav__link
{
color: #ffffff59 !important;
}
label.md-nav__link::before
{
content: ".";
opacity: 0.6;
content: "";
background-color: currentColor;
padding-right: 0.6rem;
margin-right: 0.1rem;
mask-repeat: no-repeat;
mask-size: contain;
mask-size: 20px;
padding-inline: 4px;
mask-position: center;
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512' fill='currentColor' width='16px' height='16px'%3E%3C!-- --%3E%3Cdefs%3E%3Cstyle%3E.fa-secondary%7Bopacity:.4%7D%3C/style%3E%3C/defs%3E%3Cpath class='fa-primary' d='M160 384H512c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64H394.5c-17 0-33.3-6.7-45.3-18.7L322.7 50.7c-12-12-28.3-18.7-45.3-18.7H160c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64z'%3E%3C/path%3E%3Cpath class='fa-secondary' d='M24 96c13.3 0 24 10.7 24 24V344c0 48.6 39.4 88 88 88H456c13.3 0 24 10.7 24 24s-10.7 24-24 24H136C60.9 480 0 419.1 0 344V120c0-13.3 10.7-24 24-24z'%3E%3C/path%3E%3C/svg%3E");
opacity: 0.6;
}
li.md-nav__item--nested > a > span::before
@@ -652,10 +704,56 @@ nav.md-nav > ul.md-nav__list > li.md-nav__item > a.md-nav__link > span::before
padding-right: 0.6rem;
margin-right: 0.1rem;
mask-repeat: no-repeat;
mask-size: contain;
mask-size: 9px;
padding-inline: 4px;
mask-position: center;
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='currentColor' width='16px' height='16px'%3E%3C!-- --%3E%3Cdefs%3E%3Cstyle%3E.fa-secondary%7Bopacity:.4%7D%3C/style%3E%3C/defs%3E%3Cpath class='fa-primary' d=''%3E%3C/path%3E%3Cpath class='fa-secondary' d='M0 256a160 160 0 1 1 320 0A160 160 0 1 1 0 256z'%3E%3C/path%3E%3C/svg%3E");
}
/*
Menu Navigation > Secondary > Text Size
*/
nav.md-nav--secondary li
{
font-size: 0.6rem !important;
}
/*
Badge > Override Icon Color
*/
.mdx-badge a
{
color: var(--md-badge-icon-color);
word-break: break-word;
}
.mdx-badge a:hover
{
color: var(--md-badge-icon-hover-color);
word-break: break-word;
}
.mdx-badge .mdx-badge__icon
{
background-color: var(--md-badge-bg-color--transparent);
}
.mdx-badge .mdx-badge__icon:hover
{
background-color: var(--md-badge-bg-hover-color);
}
/*
Tag > Background Color
*/
.md-typeset .md-tag
{
background-color: var(--md-primary-fg-color);
}
/*
Lightbox border
*/
@@ -727,6 +825,12 @@ figure img
transition: border .25s,box-shadow .25s;
border: 2px solid rgba( 255, 255, 255, 0.1 );
background-color: var(--md-default-fg-color--lightest);
margin-top: 10px;
margin-bottom: 10px;
margin: 0 auto;
margin-bottom: 0px;
margin-top: 5px;
width: clamp(200px, 100%, 75%);
}
.mkde-embed-container:hover
@@ -815,14 +919,14 @@ figure img
.mkde-right
{
padding: 8px 10px;
padding: 0px 10px;
}
@media ( min-width: 360px )
{
.mkde-right
{
padding: 12px 15px;
padding: 0px 15px;
}
}
@@ -830,7 +934,7 @@ figure img
{
.mkde-right
{
padding: 12px 12px;
padding: 0px 12px;
}
}
@@ -840,10 +944,12 @@ figure img
._lc._sm:not( .xd ) .mkde-left
{
min-width: 100px;
width: 100px;
min-height: 100px;
padding: 10px;
min-width: 70px;
width: 70px;
min-height: 70px;
height: 70px;
padding: 5px;
align-self: center;
background: rgba( 255, 255, 255, 0.10 );
}
@@ -851,9 +957,11 @@ figure img
{
._lc._sm:not( .xd ) .mkde-left
{
min-width: 110px;
width: 110px;
min-height: 110px;
min-width: 80px;
width: 80px;
min-height: 80px;
height: 80px;
align-self: center;
}
}
@@ -861,9 +969,11 @@ figure img
{
._lc._sm:not( .xd ) .mkde-left
{
min-width: 140px;
width: 140px;
min-height: 140px;
min-width: 110px;
width: 110px;
min-height: 110px;
height: 110px;
align-self: center;
}
}
@@ -871,9 +981,11 @@ figure img
{
._lc._sm:not( .xd ) .mkde-left
{
min-width: 160px;
width: 160px;
min-height: 160px;
min-width: 110px;
width: 110px;
min-height: 110px;
height: 110px;
align-self: center;
}
}
@@ -1049,24 +1161,24 @@ figure img
._fs-x,
._fs-m
{
font-size: 12px;
font-size: clamp(7px, 2.0vw, 12px);
}
._f1p
{
font-size: 13px;
font-size: clamp(10px, 2.5vw, 13px);
}
@media ( min-width: 360px )
{
._fs-x
{
font-size: 13px;
font-size: clamp(10px, 2.5vw, 13px);
}
._f1p
{
font-size: 14px;
font-size: clamp(10px, 2.5vw, 14px);
}
}
@@ -1074,17 +1186,17 @@ figure img
{
._fs-m
{
font-size: 13px;
font-size: clamp(10px, 2.5vw, 13px);
}
._fs-x
{
font-size: 14px;
font-size: clamp(10px, 2.5vw, 14px);
}
._f1p
{
font-size: 15px;
font-size: clamp(10px, 2.5vw, 15px);
}
}
@@ -1092,17 +1204,17 @@ figure img
{
._fs-m
{
font-size: 14px;
font-size: clamp(10px, 2.5vw, 13px);
}
._fs-x
{
font-size: 15px;
font-size: clamp(10px, 2.5vw, 14px);
}
._f1p
{
font-size: 17px;
font-size: clamp(10px, 2.5vw, 15px);
}
}
@@ -1216,13 +1328,12 @@ figure img
.item-link
{
color: var( --md-typeset-a-color );
font-size: 12px;
font-size: clamp(8px, 2.5vw, 12px);
padding-bottom: 6px;
}
.item-footer
{
padding-block-start: 12px;
padding-left: 5px;
}
@@ -1255,14 +1366,14 @@ figure img
{
display: inline-block;
padding-left: 5px;
margin-block-end: -5px;
margin-block-end: -7px;
}
.color-box
{
float: left;
height: 20px;
width: 20px;
height: 21px;
width: 21px;
border: 1px solid rgba( 255, 255, 255, 0.2 );
clear: both;
}
@@ -1276,3 +1387,187 @@ figure img
clear: both;
margin-right: 10px;
}
/*
Tools > Icon Search
*/
.md-typeset .mdx-iconsearch {
background-color:var(--md-default-bg-color);
border-radius:.1rem;
box-shadow:var(--md-shadow-z1);
position:relative;
transition:box-shadow 125ms
}
.md-typeset .mdx-iconsearch:focus-within,
.md-typeset .mdx-iconsearch:hover {
box-shadow:var(--md-shadow-z2)
}
.md-typeset .mdx-iconsearch .md-input {
background:var(--md-default-bg-color);
box-shadow:none
}
[data-md-color-scheme=slate] .md-typeset .mdx-iconsearch .md-input {
background:var(--md-code-bg-color)
}
.md-typeset .mdx-iconsearch-result {
-webkit-backface-visibility:hidden;
backface-visibility:hidden;
max-height:50vh;
overflow-y:auto;
scrollbar-color:var(--md-default-fg-color--lighter) #0000;
scrollbar-width:thin;
touch-action:pan-y
}
.md-tooltip .md-typeset .mdx-iconsearch-result {
max-height:10.25rem
}
.md-typeset .mdx-iconsearch-result::-webkit-scrollbar {
height:.2rem;
width:.2rem
}
.md-typeset .mdx-iconsearch-result::-webkit-scrollbar-thumb {
background-color:var(--md-default-fg-color--lighter)
}
.md-typeset .mdx-iconsearch-result::-webkit-scrollbar-thumb:hover {
background-color:var(--md-accent-fg-color)
}
.md-typeset .mdx-iconsearch-result__meta {
color:var(--md-default-fg-color--lighter);
font-size:.64rem;
position:absolute;
right:.6rem;
top:.4rem
}
@media screen and (max-width:29.984375em) {
.md-typeset .mdx-iconsearch-result__meta {
display:none
}
}
.md-typeset .mdx-iconsearch-result__select {
background-color:var(--md-default-fg-color--lightest);
border:none;
border-radius:.1rem;
color:var(--md-default-fg-color--light);
font-size:.64rem;
padding-bottom:.15em;
padding-top:.15em;
position:absolute;
right:.6rem;
top:.4rem;
transition:color 125ms,background-color 125ms
}
.md-typeset .mdx-iconsearch-result__select:focus,
.md-typeset .mdx-iconsearch-result__select:hover {
background-color:var(--md-accent-fg-color);
color:var(--md-accent-bg-color);
outline:none
}
.md-typeset .mdx-iconsearch-result__select+.mdx-iconsearch-result__meta {
right:4.1rem
}
[dir=ltr] .md-typeset .mdx-iconsearch-result__list {
margin-left:0
}
[dir=rtl] .md-typeset .mdx-iconsearch-result__list {
margin-right:0
}
.md-typeset .mdx-iconsearch-result__list {
list-style:none;
margin:0;
padding:0
}
[dir=ltr] .md-typeset .mdx-iconsearch-result__item {
margin-left:0
}
[dir=rtl] .md-typeset .mdx-iconsearch-result__item {
margin-right:0
}
.md-typeset .mdx-iconsearch-result__item {
border-bottom:.05rem solid var(--md-default-fg-color--lightest);
margin:0;
padding:.2rem .6rem
}
.md-typeset .mdx-iconsearch-result__item:last-child {
border-bottom:none
}
.md-typeset .mdx-iconsearch-result__item>* {
margin-right:.6rem
}
.md-typeset .mdx-iconsearch-result__item img {
height:.9rem;
width:.9rem
}
[data-md-color-scheme=slate] .md-typeset .mdx-iconsearch-result__item img[src*=squidfunk] {
filter:invert(1)
}
.md-typeset .mdx-premium p {
margin:2em 0;
text-align:center
}
.md-typeset .mdx-premium img {
height:3.25rem
}
.md-typeset .mdx-premium p:last-child {
display:flex;
flex-wrap:wrap;
justify-content:center
}
.md-typeset .mdx-premium p:last-child>a {
display:block;
flex-shrink:0
}
.md-typeset .mdx-sponsorship__list {
margin:2em 0
}
.md-typeset .mdx-sponsorship__list:after {
clear:both;
content:"";
display:block
}
[dir=ltr] .md-typeset .mdx-sponsorship__item {
float:left
}
[dir=rtl] .md-typeset .mdx-sponsorship__item {
float:right
}
.md-typeset .mdx-sponsorship__item {
border-radius:100%;
display:block;
height:1.6rem;
margin:.2rem;
overflow:hidden;
transform:scale(1);
transition:color 125ms,transform 125ms;
width:1.6rem
}
.md-typeset .mdx-sponsorship__item:focus,
.md-typeset .mdx-sponsorship__item:hover {
transform:scale(1.1)
}
.md-typeset .mdx-sponsorship__item:focus img,
.md-typeset .mdx-sponsorship__item:hover img {
filter:grayscale(0)
}
.md-typeset .mdx-sponsorship__item--private {
background:var(--md-default-fg-color--lightest);
color:var(--md-default-fg-color--lighter);
font-size:.6rem;
font-weight:700;
line-height:1.6rem;
text-align:center
}
.md-typeset .mdx-sponsorship__item img {
display:block;
filter:grayscale(100%) opacity(75%);
height:auto;
transition:filter 125ms;
width:100%
}
.md-typeset .mdx-sponsorship-button {
font-weight:400
}
.md-typeset .mdx-sponsorship-count,
.md-typeset .mdx-sponsorship-total {
font-weight:700
}

BIN
docs/img/core/01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
docs/img/core/02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
docs/img/core/03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/img/core/04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
docs/img/screenshots/01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M0 64L0 448c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-384c0-35.3-28.7-64-64-64L64 0C28.7 0 0 28.7 0 64zm64 48c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm0 128c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm0 128c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zM192 128c0-8.8 7.2-16 16-16l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16zm0 128c0-8.8 7.2-16 16-16l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16zm0 128c0-8.8 7.2-16 16-16l160 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-160 0c-8.8 0-16-7.2-16-16z"/><path class="fa-primary" d="M64 112c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm0 128c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zM80 352l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M264.8 64C277.6 64 288 74.4 288 87.2c0 9.2-5.8 17.3-13.2 22.8c-11.6 8.7-18.8 20.7-18.8 34c0 26.5 28.7 48 64 48s64-21.5 64-48c0-13.3-7.2-25.3-18.8-34c-7.4-5.5-13.2-13.6-13.2-22.8C352 74.4 362.4 64 375.2 64L464 64c26.5 0 48 21.5 48 48l0 88.8c0 12.8 10.4 23.2 23.2 23.2c9.2 0 17.3-5.8 22.8-13.2c8.7-11.6 20.7-18.8 34-18.8c26.5 0 48 28.7 48 64s-21.5 64-48 64c-13.3 0-25.3-7.2-34-18.8c-5.5-7.4-13.6-13.2-22.8-13.2c-12.8 0-23.2 10.4-23.2 23.2l0 88.8c0 26.5-21.5 48-48 48l-88.8 0c-12.8 0-23.2-10.4-23.2-23.2c0-9.2 5.8-17.3 13.2-22.8c11.6-8.7 18.8-20.7 18.8-34c0-26.5-28.7-48-64-48s-64 21.5-64 48c0 13.3 7.2 25.3 18.8 34c7.4 5.5 13.2 13.6 13.2 22.8c0 12.8-10.4 23.2-23.2 23.2L176 448c-26.5 0-48-21.5-48-48l0-88.8c0-12.8-10.4-23.2-23.2-23.2c-9.2 0-17.3 5.8-22.8 13.2C73.3 312.8 61.3 320 48 320c-26.5 0-48-28.7-48-64s21.5-64 48-64c13.3 0 25.3 7.2 34 18.8c5.5 7.4 13.6 13.2 22.8 13.2c12.8 0 23.2-10.4 23.2-23.2l0-88.8c0-26.5 21.5-48 48-48l88.8 0z"/><path class="fa-primary" d=""/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M192 104.8c0-9.2-5.8-17.3-13.2-22.8C167.2 73.3 160 61.3 160 48c0-26.5 28.7-48 64-48s64 21.5 64 48c0 13.3-7.2 25.3-18.8 34c-7.4 5.5-13.2 13.6-13.2 22.8c0 12.8 10.4 23.2 23.2 23.2l56.8 0c26.5 0 48 21.5 48 48l0 56.8c0 12.8 10.4 23.2 23.2 23.2c9.2 0 17.3-5.8 22.8-13.2c8.7-11.6 20.7-18.8 34-18.8c26.5 0 48 28.7 48 64s-21.5 64-48 64c-13.3 0-25.3-7.2-34-18.8c-5.5-7.4-13.6-13.2-22.8-13.2c-12.8 0-23.2 10.4-23.2 23.2L384 464c0 26.5-21.5 48-48 48l-56.8 0c-12.8 0-23.2-10.4-23.2-23.2c0-9.2 5.8-17.3 13.2-22.8c11.6-8.7 18.8-20.7 18.8-34c0-26.5-28.7-48-64-48s-64 21.5-64 48c0 13.3 7.2 25.3 18.8 34c7.4 5.5 13.2 13.6 13.2 22.8c0 12.8-10.4 23.2-23.2 23.2L48 512c-26.5 0-48-21.5-48-48L0 343.2C0 330.4 10.4 320 23.2 320c9.2 0 17.3 5.8 22.8 13.2C54.7 344.8 66.7 352 80 352c26.5 0 48-28.7 48-64s-21.5-64-48-64c-13.3 0-25.3 7.2-34 18.8C40.5 250.2 32.4 256 23.2 256C10.4 256 0 245.6 0 232.8L0 176c0-26.5 21.5-48 48-48l120.8 0c12.8 0 23.2-10.4 23.2-23.2z"/><path class="fa-primary" d=""/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M0 288L0 448c0 35.3 28.7 64 64 64l160 0 0-64c0-8.8-7.2-16-16-16l-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0c8.8 0 16-7.2 16-16l0-64-64 0c-8.8 0-16-7.2-16-16l0-16c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 16c0 8.8-7.2 16-16 16L0 288zM304 16l0 48c0 8.8 7.2 16 16 16l16 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0c-8.8 0-16 7.2-16 16l0 32c0 8.8 7.2 16 16 16l36 0c6.6 0 12 5.4 12 12l0 4c0 17.7 14.3 32 32 32s32-14.3 32-32l0-4c0-6.6 5.4-12 12-12l52 0c8.8 0 16-7.2 16-16l0-128c0-35.3-28.7-64-64-64L320 0c-8.8 0-16 7.2-16 16z"/><path class="fa-primary" d="M0 288l64 0c8.8 0 16-7.2 16-16l0-16c0-17.7 14.3-32 32-32s32 14.3 32 32l0 16c0 8.8 7.2 16 16 16l64 0 0-68c0-6.6 5.4-12 12-12l4 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-4 0c-6.6 0-12-5.4-12-12l0-52c0-8.8-7.2-16-16-16L64 64C28.7 64 0 92.7 0 128L0 288zm224 0l0 64c0 8.8-7.2 16-16 16l-16 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l16 0c8.8 0 16 7.2 16 16l0 64 160 0c35.3 0 64-28.7 64-64l0-144c0-8.8-7.2-16-16-16l-48 0c-8.8 0-16 7.2-16 16l0 16c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-16c0-8.8-7.2-16-16-16l-64 0z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M3.4 273.7c-7.9 15.8-1.5 35 14.3 42.9L152.4 384 17.7 451.4C1.9 459.3-4.5 478.5 3.4 494.3C9 505.5 20.3 512 32 512c4.8 0 9.7-1.1 14.3-3.4L224 419.8l177.7 88.8c4.6 2.3 9.5 3.4 14.3 3.4c11.7 0 23-6.5 28.6-17.7c7.9-15.8 1.5-35-14.3-42.9L295.6 384l134.8-67.4c15.8-7.9 22.2-27.1 14.3-42.9C439 262.5 427.7 256 416 256c-4.8 0-9.7 1.1-14.3 3.4L224 348.2 46.3 259.4c-4.6-2.3-9.5-3.4-14.3-3.4c-11.7 0-23 6.5-28.6 17.7z"/><path class="fa-primary" d="M304 234.4c38.6-23 64-62.1 64-106.4C368 57.3 303.5 0 224 0S80 57.3 80 128c0 44.4 25.4 83.5 64 106.4l0 21.6c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-21.6zM136 144a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm144-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>

After

Width:  |  Height:  |  Size: 1006 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M0 64C0 28.7 28.7 0 64 0L576 0c35.3 0 64 28.7 64 64l0 288c0 35.3-28.7 64-64 64L64 416c-35.3 0-64-28.7-64-64L0 64zm64 0l0 288 512 0 0-288L64 64zM96 480c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-384 0c-17.7 0-32-14.3-32-32z"/><path class="fa-primary" d="M64 64H576V352H64V64z"/></svg>

After

Width:  |  Height:  |  Size: 617 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120c.1-13.4 10.8-24 24-24c6.6 0 12.6 2.7 17 7c2.2 2.2 3.9 4.8 5.1 7.6c.6 1.4 1.1 2.9 1.4 4.5c.2 .8 .3 1.6 .4 2.4s.1 1.6 .1 2.5c0 41 0 82.1 0 123.2L365.3 300c6.9 4.6 10.7 12.2 10.7 20c0 4.6-1.3 9.2-4 13.3c-4.6 6.9-12.2 10.7-20 10.7c-4.6 0-9.2-1.3-13.3-4c-32-21.3-64-42.7-96-64C236 271.5 232 264 232 256c0-45.3 0-90.7 0-136z"/><path class="fa-primary" d="M256 96c-13.3 0-24 10.7-24 24l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24z"/></svg>

After

Width:  |  Height:  |  Size: 870 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M225.2 471.2c-4.9 17 5 34.7 22 39.6c2.9 .8 5.9 1.2 8.8 1.2c13.9 0 26.7-9.2 30.7-23.2l128-448c.8-2.9 1.2-5.9 1.2-8.8c0-13.9-9.2-26.7-23.2-30.8c-17-4.9-34.7 5-39.6 22l-128 448z"/><path class="fa-primary" d="M473.4 121.4c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z"/></svg>

After

Width:  |  Height:  |  Size: 879 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-secondary" d="M192 104.8c0-9.2-5.8-17.3-13.2-22.8C167.2 73.3 160 61.3 160 48c0-26.5 28.7-48 64-48s64 21.5 64 48c0 13.3-7.2 25.3-18.8 34c-7.4 5.5-13.2 13.6-13.2 22.8c0 12.8 10.4 23.2 23.2 23.2l56.8 0c26.5 0 48 21.5 48 48l0 56.8c0 12.8 10.4 23.2 23.2 23.2c9.2 0 17.3-5.8 22.8-13.2c8.7-11.6 20.7-18.8 34-18.8c26.5 0 48 28.7 48 64s-21.5 64-48 64c-13.3 0-25.3-7.2-34-18.8c-5.5-7.4-13.6-13.2-22.8-13.2c-12.8 0-23.2 10.4-23.2 23.2L384 464c0 26.5-21.5 48-48 48l-56.8 0c-12.8 0-23.2-10.4-23.2-23.2c0-9.2 5.8-17.3 13.2-22.8c11.6-8.7 18.8-20.7 18.8-34c0-26.5-28.7-48-64-48s-64 21.5-64 48c0 13.3 7.2 25.3 18.8 34c7.4 5.5 13.2 13.6 13.2 22.8c0 12.8-10.4 23.2-23.2 23.2L48 512c-26.5 0-48-21.5-48-48L0 343.2C0 330.4 10.4 320 23.2 320c9.2 0 17.3 5.8 22.8 13.2C54.7 344.8 66.7 352 80 352c26.5 0 48-28.7 48-64s-21.5-64-48-64c-13.3 0-25.3 7.2-34 18.8C40.5 250.2 32.4 256 23.2 256C10.4 256 0 245.6 0 232.8L0 176c0-26.5 21.5-48 48-48l120.8 0c12.8 0 23.2-10.4 23.2-23.2z"/><path class="fa-primary" d=""/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

File diff suppressed because one or more lines are too long

View File

@@ -71,9 +71,9 @@ class clr():
MAGENTA = '\033[35m'
CYAN = '\033[36m'
WHITE = '\033[37m'
GREY = '\033[90m'
UNDERLINE = '\033[4m'
RESET = '\033[0m'
GREY = '\033[90m'
# #
# Pages
@@ -87,6 +87,8 @@ PAGE_CONVENTIONS = "about/conventions.md"
# #
# Hooks > on_page_markdown
#
# do not change this function name
# #
def on_page_markdown(markdown: str, *, page: Page, config: MkDocsConfig, files: Files):
@@ -99,28 +101,28 @@ def on_page_markdown(markdown: str, *, page: Page, config: MkDocsConfig, files:
args = args.strip()
if type == "version":
if args.startswith( "beta-" ):
return Version_Beta(args, page, files)
if args.startswith( "development-" ):
return Version_Development(args, page, files)
elif args.startswith( "stable-" ):
return Version_Stable( args, page, files )
else:
return Version( args, page, files )
elif type == "backers": return Badge_Backers(page, files)
elif type == "control": return Create_Control(args, page, files)
elif type == "flag": return Create_Flag(args, page, files)
elif type == "option": return Create_Option(args)
elif type == "setting": return Create_Setting(args)
elif type == "command": return Badge_Command(args, page, files)
elif type == "feature": return Badge_Feature(args, page, files)
elif type == "plugin": return Badge_Plugin(args, page, files)
elif type == "extension": return Badge_Extension(args, page, files)
elif type == "3rdparty": return Badge_3rdparty(args, page, files)
elif type == "example": return Badge_Example(args, page, files)
elif type == "control": return badgeControl(args, page, files)
elif type == "flag": return badgeFlag(args, page, files)
elif type == "option": return badgeOption(args)
elif type == "setting": return badgeSetting(args)
elif type == "backers": return badgeBackers(page, files)
elif type == "command": return badgeCommand(args, page, files)
elif type == "feature": return badgeFeature(args, page, files)
elif type == "plugin": return badgePlugin(args, page, files)
elif type == "markdown": return badgeMarkdown(args, page, files)
elif type == "3rdparty": return badge3rdParty(args, page, files)
elif type == "example": return badgeExample(args, page, files)
elif type == "default":
if args == "none": return Badge_DefaultValue_None(page, files)
elif args == "computed": return Badge_DefaultValue_Computed(page, files)
else: return Badge_DefaultValue_Custom(args, page, files)
if args == "none": return badgeDefaultNone(page, files)
elif args == "computed": return badgeDefaultVal(page, files)
else: return badgeDefaultCustom(args, page, files)
# Otherwise, raise an error
raise RuntimeError( f"Error in shortcodes.yp - Specified an unknown shortcode: {type}" )
@@ -135,31 +137,35 @@ def on_page_markdown(markdown: str, *, page: Page, config: MkDocsConfig, files:
# Create > Flag
# #
def Create_Flag(args: str, page: Page, files: Files):
def badgeFlag(args: str, page: Page, files: Files):
type, *_ = args.split(" ", 1)
if type == "experimental": return Badge_Flag_Experimental(page, files)
elif type == "required": return Badge_Flag_Required(page, files)
elif type == "customization": return Badge_Flag_Customization(page, files)
elif type == "metadata": return Badge_Flag_Metadata(page, files)
elif type == "multiple": return Badge_Flag_Multiple_Instances(page, files)
elif type == "setting": return Badge_Flag_Setting(page, files)
if type == "experimental": return badgeFlagExperimental(page, files)
elif type == "required": return badgeFlagRequired(page, files)
elif type == "customization": return badgeFlagCustomization(page, files)
elif type == "metadata": return badgeFlagMetadata(page, files)
elif type == "dangerous": return badgeFlagDangerous(page, files)
elif type == "multiple": return badgeFlagMultiInstances(page, files)
elif type == "setting": return badgeFlagSetting(page, files)
else: return badgeFlagDefault( page, files )
raise RuntimeError(f"Unknown type: {type}")
# #
# Create > Controls
# #
def Create_Control( args: str, page: Page, files: Files ):
def badgeControl( args: str, page: Page, files: Files ):
type, *_ = args.split( " ", 2 )
if type == "toggle": return icon_control_toggle( page, files )
elif type == "toggle_on": return icon_control_toggle_on( page, files )
elif type == "toggle_off": return icon_control_toggle_off( page, files )
elif type == "textbox": return icon_control_textbox( page, files )
elif type == "dropdown": return icon_control_dropdown( page, files )
elif type == "button": return icon_control_button( page, files )
elif type == "slider": return icon_control_slider( page, files )
elif type == "color": return icon_control_color( args, page, files )
else: return icon_control_default( page, files )
if type == "toggle": return newControlToggle( page, files )
elif type == "toggle_on": return newControlToggleOn( page, files )
elif type == "toggle_off": return newControlToggleOff( page, files )
elif type == "textbox": return newControlTextbox( page, files )
elif type == "dropdown": return newControlDropdown( page, files )
elif type == "button": return newControlButton( page, files )
elif type == "slider": return newControlSlider( page, files )
elif type == "env": return newControlEnvVar( page, files )
elif type == "color": return newControlColor( args, page, files )
else: return newControlDefault( page, files )
raise RuntimeError(f"Unknown type: {type}")
@@ -167,15 +173,19 @@ def Create_Control( args: str, page: Page, files: Files ):
# Create > Option
# #
def Create_Option(type: str):
def badgeOption(type: str):
_, *_, name = re.split(r"[.:]", type)
return f"[`{name}`](#+{type}){{ #+{type} }}\n\n"
# #
# Create > Setting
#
# #### <!-- md:setting example.setting.enabled -->
# <!-- md:version 1.0.0 -->
# <!-- md:default `true` -->
# #
def Create_Setting(type: str):
def badgeSetting(type: str):
_, *_, name = re.split(r"[.*]", type)
return f"`{name}` {{ #{type} }}\n\n[{type}]: #{type}\n\n"
@@ -202,7 +212,7 @@ def _resolve(file: File, page: Page):
# Create > Badge
# #
def Create_Badge(icon: str, text: str = "", type: str = ""):
def badgeCreate(icon: str, text: str = "", type: str = ""):
classes = f"mdx-badge mdx-badge--{type}" if type else "mdx-badge"
return "".join([
f"<span class=\"{classes}\">",
@@ -215,7 +225,7 @@ def Create_Badge(icon: str, text: str = "", type: str = ""):
# Badge > Color Palette
# #
def Badge_ColorPalette(icon: str, text: str = "", type: str = ""):
def badgeColorPalette(icon: str, text: str = "", type: str = ""):
args = type.split( " " )
bg1_clr = "#000000"
@@ -252,10 +262,10 @@ def Badge_ColorPalette(icon: str, text: str = "", type: str = ""):
# <!-- md:sponsors -->
# #
def Badge_Backers(page: Page, files: Files):
def badgeBackers(page: Page, files: Files):
icon = "material-heart"
href = _resolve_path(PAGE_BACKERS, page, files)
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Backers only')",
type = "heart"
)
@@ -280,8 +290,8 @@ def Version( text: str, page: Page, files: Files ):
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
icon = f"[:{icon}:]({href} 'Mkdocs Release')",
return badgeCreate(
icon = f"[:{icon}:]({href} 'TVApp2 Release')",
text = f"[{text}]({_resolve_path(path, page, files)})" if spec else ""
)
@@ -294,8 +304,8 @@ def Version_Stable( text: str, page: Page, files: Files ):
path = f"{PAGE_CHANGELOG}#{spec}"
# Return badge
icon = "aetherx-axs-tag"
href = _resolve_path( f"{PAGE_CONVENTIONS}#version-beta", page, files )
icon = "aetherx-axs-tag"
href = _resolve_path( f"{PAGE_CONVENTIONS}#version-stable", page, files )
output = ""
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
@@ -306,22 +316,22 @@ def Version_Stable( text: str, page: Page, files: Files ):
else:
output = f"Stable Release"
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} '{output}' )",
text = f"[{spec}]({_resolve_path(path, page, files)})" if spec else ""
)
# #
# Badge > Version > Beta
# Badge > Version > Development
# #
def Version_Beta( text: str, page: Page, files: Files ):
spec = text.replace( "beta-", "" )
def Version_Development( text: str, page: Page, files: Files ):
spec = text.replace( "development-", "" )
path = f"{PAGE_CHANGELOG}#{spec}"
# Return badge
icon = "aetherx-axs-b"
href = _resolve_path( f"{PAGE_CONVENTIONS}#version-beta", page, files )
icon = "aetherx-axs-code"
href = _resolve_path( f"{PAGE_CONVENTIONS}#version-development", page, files )
output = ""
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
@@ -330,9 +340,9 @@ def Version_Beta( text: str, page: Page, files: Files ):
if spec:
output = f"Requires version {spec}"
else:
output = f"Beta Release"
output = f"Development Release"
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} '{output}' )",
text = f"[{text}]({_resolve_path(path, page, files)})" if spec else ""
)
@@ -344,13 +354,13 @@ def Version_Beta( text: str, page: Page, files: Files ):
# <!-- md:feature -->
# #
def Badge_Feature(text: str, page: Page, files: Files):
def badgeFeature(text: str, page: Page, files: Files):
icon = "material-toggle-switch"
href = _resolve_path( f"{PAGE_CONVENTIONS}#feature", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Optional feature')",
text = text
)
@@ -364,32 +374,32 @@ def Badge_Feature(text: str, page: Page, files: Files):
# <!-- md:plugin [typeset] built-in -->
# #
def Badge_Plugin(text: str, page: Page, files: Files):
def badgePlugin(text: str, page: Page, files: Files):
icon = "material-floppy"
href = _resolve_path( f"{PAGE_CONVENTIONS}#plugin", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Plugin')",
text = text
)
# #
# Create badge for extension
# Create badge for Markdown
#
# use the following tag in your md file:
# <!-- md:extension [admonition][Admonition] -->
# <!-- md:markdown [admonition][Admonition] -->
# #
def Badge_Extension(text: str, page: Page, files: Files):
def badgeMarkdown(text: str, page: Page, files: Files):
icon = "material-language-markdown"
href = _resolve_path( f"{PAGE_CONVENTIONS}#extension", page, files)
href = _resolve_path( f"{PAGE_CONVENTIONS}#markdown", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
icon = f"[:{icon}:]({href} 'Markdown extension')",
return badgeCreate(
icon = f"[:{icon}:]({href} 'Markdown functionality')",
text = text
)
@@ -403,13 +413,13 @@ def Badge_Extension(text: str, page: Page, files: Files):
# <!-- md:3rdparty [mike] -->
# #
def Badge_3rdparty(text: str, page: Page, files: Files):
def badge3rdParty(text: str, page: Page, files: Files):
icon = "material-package-variant"
href = _resolve_path( f"{PAGE_CONVENTIONS}#3rdparty", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Third-party utility')",
text = text
)
@@ -433,30 +443,30 @@ def Badge_3rdparty(text: str, page: Page, files: Files):
# <!-- md:example my-example-file -->
# #
def Badge_Example(text: str, page: Page, files: Files):
def badgeExample(text: str, page: Page, files: Files):
return "\n".join([
Badge_Example_Download_Zip(text, page, files),
Badge_Example_View(text, page, files)
badgeExampleDownloadZip(text, page, files),
badgeExampleView(text, page, files)
])
def Badge_Example_View(text: str, page: Page, files: Files):
def badgeExampleView(text: str, page: Page, files: Files):
icon = "material-folder-eye"
href = f"https://github.com/TheBinaryNinja/tvapp2/{text}/"
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'View example')",
type = "right"
)
def Badge_Example_Download_Zip(text: str, page: Page, files: Files):
def badgeExampleDownloadZip(text: str, page: Page, files: Files):
icon = "material-folder-download"
href = f"https://github.com/TheBinaryNinja/tvapp2/{text}.zip"
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Download example')",
text = f"[`.zip`]({href})",
type = "right"
@@ -471,15 +481,16 @@ def Badge_Example_Download_Zip(text: str, page: Page, files: Files):
# <!-- md:command `-s, --start` -->
# #
def Badge_Command(text: str, page: Page, files: Files):
def badgeCommand(text: str, page: Page, files: Files):
icon = "material-console-line"
href = _resolve_path( f"{PAGE_CONVENTIONS}#command", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Terminal / Console Command')",
text = text
text = text,
type = "command"
)
# #
@@ -494,13 +505,13 @@ def Badge_Command(text: str, page: Page, files: Files):
# <!-- md:default none -->
# #
def Badge_DefaultValue_Custom(text: str, page: Page, files: Files):
def badgeDefaultCustom(text: str, page: Page, files: Files):
icon = "material-water"
href = _resolve_path( f"{PAGE_CONVENTIONS}#default", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Default value')",
text = text
)
@@ -517,13 +528,13 @@ def Badge_DefaultValue_Custom(text: str, page: Page, files: Files):
# <!-- md:default none -->
# #
def Badge_DefaultValue_None(page: Page, files: Files):
def badgeDefaultNone(page: Page, files: Files):
icon = "material-water-outline"
href = _resolve_path( f"{PAGE_CONVENTIONS}#default", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Default value is empty')"
)
@@ -539,53 +550,127 @@ def Badge_DefaultValue_None(page: Page, files: Files):
# <!-- md:default none -->
# #
def Badge_DefaultValue_Computed(page: Page, files: Files):
def badgeDefaultVal(page: Page, files: Files):
icon = "material-water-check"
href = _resolve_path( f"{PAGE_CONVENTIONS}#default", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Default value is computed')"
)
# #
# Badge > Flag > Default
#
# This symbol denotes that the specified item is a customizable setting
#
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def badgeFlagDefault(page: Page, files: Files):
icon = "material-flag"
href = _resolve_path( f"{PAGE_CONVENTIONS}#setting", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return badgeCreate(
icon = f"[:{icon}:]({href} 'Configurable Setting')"
)
# #
# Badge > Flag > Metadata Property
#
# This symbol denotes that the item described is a metadata property, which can
# be used in Markdown documents as part of the front matter definition.
#
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# <!-- md:flag metadata -->
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def Badge_Flag_Metadata(page: Page, files: Files):
def badgeFlagMetadata(page: Page, files: Files):
icon = "material-list-box-outline"
href = _resolve_path( f"{PAGE_CONVENTIONS}#metadata", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Metadata property')"
)
# #
# Badge > Flag > Dangerous
#
# This symbol denotes that the item or setting specified may be dangerous to change.
#
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def badgeFlagDangerous(page: Page, files: Files):
icon = "aetherx-axd-skull-crossbones"
href = _resolve_path( f"{PAGE_CONVENTIONS}#dangerous", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return badgeCreate(
icon = f"[:{icon}:]({href} 'This setting is dangerous to change')",
type = "dangerous"
)
# #
# Badge > Flag > Required
#
# Specifies that a value is required.
#
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# <!-- md:flag required -->
# <!-- md:flag required --> This option enables the content tabs
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def Badge_Flag_Required(page: Page, files: Files):
def badgeFlagRequired(page: Page, files: Files):
icon = "material-alert"
href = _resolve_path( f"{PAGE_CONVENTIONS}#required", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Required value')"
)
@@ -594,17 +679,26 @@ def Badge_Flag_Required(page: Page, files: Files):
#
# This symbol denotes that the item described is a customization which affects the overall look of the app.
#
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# <!-- md:flag customization -->
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def Badge_Flag_Customization(page: Page, files: Files):
def badgeFlagCustomization(page: Page, files: Files):
icon = "material-brush-variant"
href = _resolve_path( f"{PAGE_CONVENTIONS}#customization", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Customization')"
)
@@ -616,16 +710,23 @@ def Badge_Flag_Customization(page: Page, files: Files):
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# <!-- md:flag experimental -->
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def Badge_Flag_Experimental(page: Page, files: Files):
def badgeFlagExperimental(page: Page, files: Files):
icon = "material-flask-outline"
href = _resolve_path( f"{PAGE_CONVENTIONS}#experimental", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Experimental')"
)
@@ -638,16 +739,23 @@ def Badge_Flag_Experimental(page: Page, files: Files):
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# <!-- md:flag multiple -->
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def Badge_Flag_Multiple_Instances(page: Page, files: Files):
def badgeFlagMultiInstances(page: Page, files: Files):
icon = "material-inbox-multiple"
href = _resolve_path( f"{PAGE_CONVENTIONS}#multiple-instances", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Multiple instances')"
)
@@ -659,16 +767,23 @@ def Badge_Flag_Multiple_Instances(page: Page, files: Files):
# MUST add an entry in conventions.md
#
# use the following tag in your md file:
# <!-- md:flag setting -->
# : <!-- md:flag --> Default
# : <!-- md:flag experimental --> Experimental
# : <!-- md:flag required --> Required
# : <!-- md:flag customization --> Customization
# : <!-- md:flag metadata --> Metadata
# : <!-- md:flag dangerous --> Dangerous
# : <!-- md:flag multiple --> Multiple
# : <!-- md:flag setting --> Setting
# #
def Badge_Flag_Setting(page: Page, files: Files):
def badgeFlagSetting(page: Page, files: Files):
icon = "material-cog"
href = _resolve_path( f"{PAGE_CONVENTIONS}#setting", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Configurable Setting')"
)
@@ -681,13 +796,13 @@ def Badge_Flag_Setting(page: Page, files: Files):
# <!-- md:control -->
# #
def icon_control_default( page: Page, files: Files ):
def newControlDefault( page: Page, files: Files ):
icon = "aetherx-axs-hand-pointer"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files )
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Type: Textbox')"
)
@@ -698,13 +813,13 @@ def icon_control_default( page: Page, files: Files ):
# <!-- md:control textbox -->
# #
def icon_control_textbox( page: Page, files: Files ):
def newControlTextbox( page: Page, files: Files ):
icon = "aetherx-axs-input-text"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files )
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Type: Textbox')"
)
@@ -717,33 +832,33 @@ def icon_control_textbox( page: Page, files: Files ):
# <!-- md:control toggle_off --> `Disabled`
# #
def icon_control_toggle( page: Page, files: Files ):
def newControlToggle( page: Page, files: Files ):
icon = "aetherx-axs-toggle-large-on"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Type: Toggle Switch')"
)
def icon_control_toggle_on( page: Page, files: Files ):
def newControlToggleOn( page: Page, files: Files ):
icon = "aetherx-axd-toggle-on"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Toggle: Enabled')"
)
def icon_control_toggle_off( page: Page, files: Files ):
def newControlToggleOff( page: Page, files: Files ):
icon = "aetherx-axd-toggle-off"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Toggle: Disabled')"
)
@@ -754,13 +869,13 @@ def icon_control_toggle_off( page: Page, files: Files ):
# <!-- md:control dropdown -->
# #
def icon_control_dropdown( page: Page, files: Files ):
def newControlDropdown( page: Page, files: Files ):
icon = "aetherx-axs-square-caret-down"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files)
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Type: Dropdown')"
)
@@ -771,13 +886,13 @@ def icon_control_dropdown( page: Page, files: Files ):
# <!-- md:control button -->
# #
def icon_control_button( page: Page, files: Files ):
def newControlButton( page: Page, files: Files ):
icon = "material-button-pointer"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files )
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Type: Button')"
)
@@ -788,13 +903,13 @@ def icon_control_button( page: Page, files: Files ):
# <!-- md:control slider -->
# #
def icon_control_slider( page: Page, files: Files ):
def newControlSlider( page: Page, files: Files ):
icon = "aetherx-axd-sliders-simple"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files )
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Create_Badge(
return badgeCreate(
icon = f"[:{icon}:]({href} 'Type: Slider')"
)
@@ -805,13 +920,31 @@ def icon_control_slider( page: Page, files: Files ):
# <!-- md:control color #E5E5E5 #121315 -->
# #
def icon_control_color( text: str, page: Page, files: Files ):
def newControlColor( text: str, page: Page, files: Files ):
icon = "aetherx-axs-palette"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files )
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return Badge_ColorPalette(
return badgeColorPalette(
icon = f"[:{icon}:]({href} 'Type: Color Wheel')",
type = text
)
# #
# Icon : Control : Env Variable
#
# use the following tag in your md file:
# <!-- md:control slider -->
# #
def newControlEnvVar( page: Page, files: Files ):
icon = "aetherx-axd-puzzle-piece"
href = _resolve_path( f"{PAGE_CONVENTIONS}#control", page, files )
print(clr.MAGENTA + 'VERBOSE - ' + clr.WHITE + ' Running ' + clr.YELLOW + inspect.stack()[0][3] + clr.WHITE + ' for page ' + clr.GREY + str(href) + clr.WHITE )
return badgeCreate(
icon = f"[:{icon}:]({href} 'Type: Environment Variable')",
type = "env"
)

View File

@@ -1,262 +1,332 @@
# #
# Mkdocs Config
#
# @notes this documentation requires the following plugins to be installed:
# pip install mkdocs
# pip install mkdocs-material
# pip install mike
# pip install mkdocs-git-committers-plugin-2
# pip install mkdocs-encryptcontent-plugin
# pip install mkdocs-embed-external-markdown
# pip install mkdocs-redirects mkdocs-glightbox pymdown-extensions mkdocs-git-revision-date-localized-plugin mkdocs-git-authors-plugin mkdocs-link-embeds-plugin
# cd docs
# mkdocs build
#
# @update use the following commands to update mkdocs and the mkdocs-material theme:
# pip install --upgrade mkdocs
# pip install --upgrade --force-reinstall mkdocs-material
# #
site_name: !!python/object/apply:os.getenv ["DOCS_NAME", "TVApp2"]
repo_url: https://github.com/TheBinaryNinja/tvapp2
repo_name: TheBinaryNinja/tvapp2
edit_uri: edit/main/docs/docs/
site_author: TheBinaryNinja
site_url: 'https://thebinaryninja.github.io/tvapp2/'
# #
# Section Markdown Extensions
# #
markdown_extensions:
- markdown.extensions.extra
- toc:
permalink: true
- abbr
- admonition
- attr_list
- pymdownx.magiclink:
normalize_issue_symbols: true
repo_url_shorthand: true
user: TheBinaryNinja
repo: tvapp2
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
options:
custom_icons:
- material/overrides/.icons
- md_in_html
- def_list
- footnotes
- tables
- pymdownx.inlinehilite
- pymdownx.betterem:
smart_enable: all
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.highlight:
use_pygments: true
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.tabbed:
alternate_style: true
combine_header_slug: true
slugify: !!python/object/apply:pymdownx.slugs.slugify
kwds:
case: lower
- pymdownx.tabbed
- pymdownx.caret
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.tilde
- pymdownx.blocks.html
- pymdownx.details
- pymdownx.magiclink:
normalize_issue_symbols: true
repo_url_shorthand: true
user: TheBinaryNinja
repo: tvapp2
- pymdownx.keys
- pymdownx.snippets:
auto_append:
- includes/abbreviations.md
url_download: true
- pymdownx.arithmatex:
generic: true
- markdown.extensions.extra
- toc:
permalink: true
- abbr
- admonition
- attr_list
- pymdownx.magiclink:
normalize_issue_symbols: true
repo_url_shorthand: true
user: TheBinaryNinja
repo: tvapp2
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
options:
custom_icons:
- material/overrides/.icons
- md_in_html
- def_list
- footnotes
- tables
- pymdownx.inlinehilite
- pymdownx.betterem:
smart_enable: all
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.highlight:
use_pygments: true
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.tabbed:
alternate_style: true
combine_header_slug: true
slugify: !!python/object/apply:pymdownx.slugs.slugify
kwds:
case: lower
- pymdownx.tabbed
- pymdownx.caret
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.tilde
- pymdownx.blocks.html
- pymdownx.details
- pymdownx.magiclink:
normalize_issue_symbols: true
repo_url_shorthand: true
user: TheBinaryNinja
repo: tvapp2
- pymdownx.keys
- pymdownx.snippets:
auto_append:
- docs/includes/abbreviations.md
url_download: true
- pymdownx.arithmatex:
generic: true
# #
# Section Theme
# #
theme:
highlightjs: true
hljs_languages:
- yaml
- yml
- rust
- markdown
icon:
note: fontawesome/solid/note-sticky
abstract: fontawesome/solid/book
info: fontawesome/solid/circle-info
tip: fontawesome/solid/bullhorn
success: fontawesome/solid/check
question: fontawesome/solid/circle-question
warning: fontawesome/solid/triangle-exclamation
failure: fontawesome/solid/bomb
danger: fontawesome/solid/skull
bug: fontawesome/solid/robot
example: fontawesome/solid/flask
quote: fontawesome/solid/quote-left
annotation: material/arrow-right-circle
tag:
html: fontawesome/brands/html5
js: fontawesome/brands/js
css: fontawesome/brands/css3
repo: fontawesome/brands/git-alt
name: material
custom_dir: material/overrides
palette:
# Palette toggle for light mode
- scheme: default
primary: custom
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode
highlightjs: true
hljs_languages:
- yaml
- yml
- rust
- markdown
- json
- batch
- typescript
- javascript
- lua
- python
icon:
note: fontawesome/solid/note-sticky
abstract: fontawesome/solid/book
info: fontawesome/solid/circle-info
tip: fontawesome/solid/bullhorn
success: fontawesome/solid/check
question: fontawesome/solid/circle-question
warning: fontawesome/solid/triangle-exclamation
failure: fontawesome/solid/bomb
danger: fontawesome/solid/skull
bug: fontawesome/solid/robot
example: fontawesome/solid/flask
quote: fontawesome/solid/quote-left
annotation: material/arrow-right-circle
hi: aetherx/axs/clock
tag:
html: fontawesome/brands/html5
js: fontawesome/brands/js
css: fontawesome/brands/css3
repo: fontawesome/brands/git-alt
name: material
custom_dir: material/overrides
palette:
# Palette toggle for light mode
- scheme: default
primary: custom
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode
# Palette toggle for dark mode
- scheme: main
primary: custom
accent: custom
toggle:
icon: material/brightness-4
name: Switch to light mode
font:
text: Roboto
code: Roboto Mono
favicon: assets/favicon.png
icon:
logo: logo
features:
- announce.dismiss
- toc.follow
- content.action.edit
- content.action.view
- content.tooltips
- search.highlight
- search.share
- search.suggest
- content.code.annotate
- content.code.select
- content.code.copy
- navigation.footer
- navigation.indexes
- navigation.instant
- navigation.instant.progress
- navigation.instant.prefetch
- navigation.instant.preview
- navigation.tracking
- navigation.path
- navigation.top
# Palette toggle for dark mode
- scheme: main
primary: custom
accent: custom
toggle:
icon: material/brightness-4
name: Switch to light mode
font:
text: Roboto
code: Roboto Mono
favicon: assets/favicon.png
icon:
logo: /aetherx/axd/tv
features:
- navigation.tabs
- navigation.sections
- announce.dismiss
- toc.follow
- content.action.edit
- content.action.view
- content.tooltips
- search.highlight
- search.share
- search.suggest
- content.code.annotate
- content.code.select
- content.code.copy
- navigation.footer
- navigation.indexes
- navigation.instant
- navigation.instant.progress
- navigation.instant.prefetch
- navigation.instant.preview
- navigation.tracking
- navigation.path
- navigation.top
# #
# Section Hooks
# #
# Hooks
hooks:
- material/overrides/hooks/shortcodes.py
- material/overrides/hooks/translations.py
- material/overrides/hooks/shortcodes.py
- material/overrides/hooks/translations.py
# #
# Section Extra CSS
# #
extra_css:
- stylesheets/extra.css?v1.000
- stylesheets/extra.css?v1.000
# #
# Section Extra Javascript
# #
extra_javascript:
- https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js
- javascripts/tablesort.js
nav:
- Home: 'home.md'
- About TVApp2: 'about_tvapp2.md'
- About:
- License: 'about/license.md'
- Conventions: 'about/conventions.md'
- Tags: 'about/tags.md'
- Changelog: 'about/changelog.md'
- Backers: 'backers/index.md'
- https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js
- javascripts/tablesort.js
plugins:
- search:
separator: '[\s\u200b\-_,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
- tags:
tags_file: about/tags.md
- group:
plugins:
- optimize
- minify
- git-committers:
repository: TheBinaryNinja/tvapp2
docs_path: docs/docs/
branch: main
token: !!python/object/apply:os.getenv [GH_TOKEN, "NULL"]
- blog:
authors: true
authors_file: .authors.yml
- encryptcontent:
title_prefix: '[🔒]'
summary: 'Access Restricted'
placeholder: 'Authentication Code'
placeholder_user: User
password_button: True
password_button_text: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor" width="16px" height="16px"><!--! Font Awesome Pro 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-primary" d="M384 160L224 0V128c0 17.7 14.3 32 32 32H384zm80 80c17.7 0 32 14.3 32 32v48H432V272c0-17.7 14.3-32 32-32zm-80 32v48c-17.7 0-32 14.3-32 32V480c0 17.7 14.3 32 32 32H544c17.7 0 32-14.3 32-32V352c0-17.7-14.3-32-32-32V272c0-44.2-35.8-80-80-80s-80 35.8-80 80z"></path><path class="fa-secondary" d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384v33.6c-19.8 20.2-32 47.9-32 78.4v24.6c-19.1 11.1-32 31.7-32 55.4V480c0 11.4 3 22.2 8.3 31.5c-2.7 .3-5.5 .5-8.3 .5H64c-35.3 0-64-28.7-64-64V64z"></path></svg>'
# input_class: 'w3-input' # CSS class used for input username and password
# button_class: 'w3-button w3-theme-l1 w3-hover-theme' # CSS class for password_button
decryption_failure_message: 'Authentication code not correct.'
encryption_info_message: "This information is restricted to certain users with access."
password_inventory:
classified:
- !!python/object/apply:os.getenv [DOCS_SECRET_L1, "NULL"]
confidential:
- !!python/object/apply:os.getenv [DOCS_SECRET_L2, "NULL"]
- git-revision-date-localized:
type: timeago
enabled: true
- git-authors:
show_contribution: true
sort_authors_by: name
exclude:
- index.md
enabled: true
- glightbox:
touchNavigation: true
loop: false
effect: zoom
slide_effect: slide
width: 100%
height: auto
zoomable: true
draggable: false
skip_classes:
- custom-skip-class-name
auto_caption: false
caption_position: bottom
background: black
shadow: false
- mike:
alias_type: symlink
redirect_template: null
deploy_prefix: ''
canonical_version: null
version_selector: true
css_dir: css
javascript_dir: js
- redirects:
redirect_maps:
docs/settings/summary.md: settings/summary.md
- link-embeds:
enabled: true
name_default: "Untitled Link"
desc_default: "No description found"
image_default: "https://github.com/Aetherinox/mkdocs-link-embeds/assets/118329232/c0298d98-0910-4235-a88f-0c3e2f704ba7"
image_disabled: false
favicon_default: "https://github.com/Aetherinox/mkdocs-link-embeds/assets/118329232/b37da9c6-6f17-4c3f-9c94-c346a6f31bfa"
favicon_disabled: true
favicon_size: 25
target: "blank"
accent: "FFFFFF1A"
verbose: true
# #
# Section Extras
# #
extra:
tags:
HTML5: html
JavaScript: js
CSS: css
generator: false
version:
default: stable
provider: mike
consent:
title: Cookie Consent
description: >-
We use cookies to recognize your repeated visits and preferences, as well
as to measure the effectiveness of our documentation and whether users
find what they're searching for. With your consent, you're helping us to
make our documentation better.
social:
- icon: fontawesome/brands/github
link: https://github.com/TheBinaryNinja/tvapp2
- icon: fontawesome/brands/discord
link: https://discord.gg/gTze6hRe
tags:
HTML5: html
JavaScript: js
CSS: css
generator: false
version:
default: latest
provider: mike
alias: true
consent:
title: Cookie Consent
description: >-
We use cookies to recognize your repeated visits and preferences, as well
as to measure the effectiveness of our documentation and whether users
find what they're searching for. With your consent, you're helping us to
make our documentation better.
# #
# Section Navigation
# #
nav:
- Home: 'home.md'
- About:
- What Is TVApp2: 'about/what_is_tvapp.md'
- Contributing: 'about/contributing.md'
- License: 'about/license.md'
- Wiki:
- Conventions: 'about/conventions.md'
- Tags: 'about/tags.md'
- Config:
- Environment Variables: 'config/env.md'
- Volumes: 'config/volumes.md'
- Changelog: 'about/changelog.md'
- Discord: 'https://discord.gg/gTze6hRe'
# #
# Section Plugins
# #
plugins:
- search:
separator: '[\s\u200b\-_,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
- group:
plugins:
- optimize
- minify
- git-committers:
repository: TheBinaryNinja/tvapp2
docs_path: docs/docs/
branch: main
token: !!python/object/apply:os.getenv [GH_TOKEN, "NULL"]
- blog:
authors: true
authors_file: .authors.yml
- encryptcontent:
title_prefix: '[🔒]'
summary: 'Access Restricted'
placeholder: 'Authentication Code'
placeholder_user: User
password_button: True
password_button_text: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor" width="16px" height="16px"><!--! Font Awesome Pro 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><defs><style>.fa-secondary{opacity:.4}</style></defs><path class="fa-primary" d="M384 160L224 0V128c0 17.7 14.3 32 32 32H384zm80 80c17.7 0 32 14.3 32 32v48H432V272c0-17.7 14.3-32 32-32zm-80 32v48c-17.7 0-32 14.3-32 32V480c0 17.7 14.3 32 32 32H544c17.7 0 32-14.3 32-32V352c0-17.7-14.3-32-32-32V272c0-44.2-35.8-80-80-80s-80 35.8-80 80z"></path><path class="fa-secondary" d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384v33.6c-19.8 20.2-32 47.9-32 78.4v24.6c-19.1 11.1-32 31.7-32 55.4V480c0 11.4 3 22.2 8.3 31.5c-2.7 .3-5.5 .5-8.3 .5H64c-35.3 0-64-28.7-64-64V64z"></path></svg>'
# input_class: 'w3-input' # CSS class used for input username and password
# button_class: 'w3-button w3-theme-l1 w3-hover-theme' # CSS class for password_button
decryption_failure_message: 'Authentication code not correct.'
encryption_info_message: "This information is restricted to certain users with access."
password_inventory:
classified:
- !!python/object/apply:os.getenv [DOCS_SECRET_L1, "NULL"]
confidential:
- !!python/object/apply:os.getenv [DOCS_SECRET_L2, "NULL"]
- git-revision-date-localized:
type: timeago
enabled: true
- git-authors:
show_contribution: true
sort_authors_by: name
exclude:
- index.md
enabled: true
- glightbox:
touchNavigation: true
loop: false
effect: zoom
slide_effect: slide
width: 100%
height: auto
zoomable: true
draggable: false
skip_classes:
- custom-skip-class-name
auto_caption: false
caption_position: bottom
background: black
shadow: false
- mike:
alias_type: symlink
redirect_template: null
deploy_prefix: ''
canonical_version: null
version_selector: true
css_dir: css
javascript_dir: js
- redirects:
redirect_maps:
docs/settings/summary.md: settings/summary.md
- link-embeds:
enabled: true
name_default: "Untitled Link"
desc_default: "No description found"
image_default: "https://github.com/Aetherinox/mkdocs-link-embeds/assets/118329232/c0298d98-0910-4235-a88f-0c3e2f704ba7"
image_disabled: false
favicon_default: "https://github.com/Aetherinox/mkdocs-link-embeds/assets/118329232/b37da9c6-6f17-4c3f-9c94-c346a6f31bfa"
favicon_disabled: false
favicon_size: 25
target: "blank"
accent: "FFFFFF1A"
verbose: true
- external-markdown
copyright: >
Copyright &copy; 2025 - BinaryNinja

View File

@@ -6,15 +6,19 @@ MODE con:cols=125 lines=120
MODE 125,40
GOTO comment_end
Starts up mkdocs from a windows system.
Ensure you have defined `GH_TOKEN` or the git-committers plugin will rate limit you.
@usage Starts up mkdocs from a windows system.
Ensure you have defined `GH_TOKEN` or the git-committers plugin will rate limit you.
setx /m GH_TOKEN "github_pat_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
setx /m GH_TOKEN "github_pat_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
If using a Github Workflow, create a new secret in the repo settings named `GH_TOKEN`
and give it your Github fine-grained personal access token.
If using a Github Workflow, create a new secret in the repo settings named `GH_TOKEN`
and give it your Github fine-grained personal access token.
The token variable is defined in mkdocs.yml
The token variable is defined in mkdocs.yml
@update use the following commands to update mkdocs and the mkdocs-material theme:
pip install --upgrade mkdocs
pip install --upgrade --force-reinstall mkdocs-material
:comment_end
@@ -30,28 +34,33 @@ set dir_home=%~dp0
:: define: env variable
:: #
set TOKEN=%GH_TOKEN2%
echo --------------------------------------------------------------------------------
echo ------------------------------------------------------------------------------------------------
echo Mkdocs Launcher
echo --------------------------------------------------------------------------------
IF [!TOKEN!]==[] (
echo --------------------------------------------------------------------------------
echo GH_TOKEN not defined. Open %0%
echo Create a new one at https://github.com/settings/personal-access-tokens
echo --------------------------------------------------------------------------------
set /P TOKEN= Enter Github Personal Access Token (fine-grained):
echo ------------------------------------------------------------------------------------------------
IF "!GH_TOKEN!"=="" (
echo GH_TOKEN not defined.
echo Open %0%
echo Create a new one at:
echo https://github.com/settings/personal-access-tokens
echo ------------------------------------------------------------------------------------------------
set /p TOKEN=" Enter Github Personal Access Token (fine-grained): "
)
echo GH_TOKEN: !TOKEN!
echo GH_TOKEN: !GH_TOKEN!
echo.
echo.
echo Creating environment variable GH_TOKEN
setx GH_TOKEN "!GH_TOKEN!"
timeout 2 > NUL
:: #
:: start mkdocs
:: #
echo Starting mkdocs ...
start cmd /k "mkdocs serve --clean"
timeout 5 > NUL

83
renovate.json Normal file
View File

@@ -0,0 +1,83 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":preserveSemverRanges"
],
"timezone": "Etc/UTC",
"includeForks": true,
"forkProcessing": "enabled",
"baseBranches": ["main"],
"prCreation": "immediate",
"rebaseWhen": "conflicted",
"rebaseLabel": "AC Needs Rebase",
"gitAuthor": "EuropaServ <161414668+EuropaServ@users.noreply.github.com>",
"updatePinnedDependencies": false,
"dependencyDashboard": true,
"dependencyDashboardTitle": "📁 Dependency Dashboard",
"dependencyDashboardLabels": ["📰 Progress Report"],
"vulnerabilityAlerts": {
"enabled": true,
"labels": ["Type ◦ Vulnerability"]
},
"labels": [
"Type ◦ Dependency"
],
"major": {
"automerge": false
},
"lockFileMaintenance": {
"enabled": true,
"automerge": true
},
"packageRules": [
{
"matchManagers": [
"nodenv",
"npm",
"nvm"
],
"addLabels": [
"Type ◦ Dependency"
],
"rangeStrategy": "auto"
},
{
"matchManagers": [
"nodenv",
"npm",
"nvm"
],
"matchUpdateTypes": [
"minor",
"patch"
],
"addLabels": [
"Type ◦ Dependency"
],
"automerge": false
},
{
"matchManagers": [
"github-actions"
],
"addLabels": [
"Type ◦ Git Action"
],
"rangeStrategy": "auto"
},
{
"matchManagers": [
"github-actions"
],
"addLabels": [
"Type ◦ Git Action"
],
"matchUpdateTypes": [
"minor",
"patch"
],
"automerge": false
}
]
}

View File

@@ -1,5 +1,18 @@
#!/usr/bin/with-contenv sh
# #
# Store env variables in s6
# #
ip_gateway=$(/sbin/ip route|awk '/default/ { print $3 }')
ip_container=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
printf "$ip_gateway" > /var/run/s6/container_environment/IP_GATEWAY
printf "$ip_container" > /var/run/s6/container_environment/IP_CONTAINER
export IP_GATEWAY=$ip_gateway
export IP_GATEWAY=$ip_container
# #
# install and startup for tvapp2
# #
@@ -7,4 +20,5 @@
cp -r ${DIR_BUILD}/* ${DIR_RUN}
rm -rf ${DIR_BUILD}/*
cd ${DIR_RUN}
npm install --omit=dev
npm start

273
tvapp2/eslint.config.mjs Normal file
View File

@@ -0,0 +1,273 @@
/*
Eslint 9 Flat Config
old eslint < 8 .rc files are no longer supported! do not place .eslintrc files in subfolders.
eslint developers are currently working on an experimental feature to allow for sub-folder
override rules
@ref https://github.com/eslint/eslint/discussions/18574#discussioncomment-9729092
https://eslint.org/docs/latest/use/configure/configuration-files#experimental-configuration-file-resolution
eslint config migration docs
@ref https://eslint.org/docs/latest/use/configure/migration-guide
*/
import path from 'path';
import globals from 'globals';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
/*
Plugins
*/
import pluginImport from 'eslint-plugin-import';
import pluginNode from 'eslint-plugin-n'
import pluginChaiFriendly from 'eslint-plugin-chai-friendly';
import pluginStylisticJs from '@stylistic/eslint-plugin-js'
/*
Globals
*/
const customGlobals =
{
guid: 'readable',
uuid: 'readable',
Buffer: "readonly",
BufferEncoding: "readonly"
};
/*
Compatibility
*/
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url); // get resolved path to file
const __dirname = path.dirname(__filename); // get name of directory
const compat = new FlatCompat({
baseDirectory: __dirname, // optional; default: process.cwd()
resolvePluginsRelativeTo: __dirname, // optional
recommendedConfig: js.configs.recommended, // optional unless using 'eslint:recommended'
allConfig: js.configs.all, // optional unless using 'eslint:all'
});
/*
Eslint > Flat Config
*/
export default
[
{
ignores: [
'coverage/**',
'node_modules/**',
'**/dist/**/*',
'**/__tmp__/**/*',
'eslint.config.mjs',
'eslint.config.cjs',
"root.js",
"www/**/*"
]
},
...compat.extends('eslint:recommended'),
{
plugins: {
'n': pluginNode,
'import': pluginImport,
'@stylistic/js': pluginStylisticJs,
'chai-friendly': pluginChaiFriendly
},
linterOptions: {
reportUnusedDisableDirectives: false
},
languageOptions: {
globals: {
...customGlobals,
...globals.browser,
process: true, // Node.js global
_: true,
$: true
},
sourceType: 'module',
ecmaVersion: 'latest',
parserOptions: {
requireConfigFile: false
}
},
rules: {
// eslint/js rules
'one-var': 'off',
'no-throw-literal': 'off',
'camelcase': [
'error',
{
'properties': 'always'
}
],
'no-unused-vars': 'off',
'no-console': 'off',
'no-alert': 'error',
'no-debugger': 'error',
'prefer-arrow-callback': 'error',
'no-useless-escape': 'off',
'no-var': 'error',
'prefer-const': 'error',
'no-unused-expressions': 0,
'chai-friendly/no-unused-expressions': 'off',
'strict': ['error', 'never'],
'prefer-promise-reject-errors': 'off',
'no-object-constructor': 'error',
'object-shorthand': 'off',
'no-array-constructor': 'error',
'array-callback-return': 'error',
'no-eval': 'error',
'no-new-func': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'no-useless-constructor': 'error',
'no-dupe-class-members': 'error',
'no-duplicate-imports': 'error',
'eqeqeq': 'error',
'no-unneeded-ternary': 'error',
'curly': 'off',
'no-empty': 'off',
'no-restricted-syntax': [
'error',
{
'selector': 'ExportDefaultDeclaration',
'message': 'Prefer named exports'
}
],
'import/no-webpack-loader-syntax': 'off',
'import/no-relative-parent-imports': 'error',
'import/first': 'error',
'import/no-default-export': 'error',
'node/no-callback-literal': 0,
/*
@plugin eslint-plugin-n
*/
'n/no-callback-literal': 0,
'n/no-deprecated-api': 'error',
'n/no-exports-assign': 'error',
'n/no-extraneous-import': 'error',
'n/no-extraneous-require': [
'error',
{
'allowModules': ['electron', 'electron-notarize'],
'resolvePaths': [],
'tryExtensions': []
}
],
'n/no-missing-import': 'off',
'n/no-missing-require': 'off',
'n/no-mixed-requires': 'error',
'n/no-new-require': 'error',
'n/no-path-concat': 'error',
'n/no-process-env': 'off',
'n/no-process-exit': 'off',
'n/no-restricted-import': 'error',
'n/no-restricted-require': 'error',
'n/no-sync': 'off',
'n/no-unpublished-bin': 'error',
'n/no-unpublished-import': 'error',
'n/no-unpublished-require': 'error',
'n/no-unsupported-features/es-builtins': 'error',
'n/no-unsupported-features/es-syntax': 'error',
'n/no-unsupported-features/node-builtins': 'off',
'n/prefer-global/buffer': 'error',
'n/prefer-global/console': 'error',
'n/prefer-global/process': 'error',
'n/prefer-global/text-decoder': 'error',
'n/prefer-global/text-encoder': 'error',
'n/prefer-global/url': 'error',
'n/prefer-global/url-search-params': 'error',
'n/prefer-node-protocol': 'off',
'n/prefer-promises/dns': 'off',
'n/prefer-promises/fs': 'off',
'n/process-exit-as-throw': 'error',
'@stylistic/js/object-property-newline': 'off',
'@stylistic/js/no-multi-spaces': [ 0, { ignoreEOLComments: true } ],
'@stylistic/js/arrow-spacing': [ 'error', { before: true, after: true } ],
'@stylistic/js/semi-spacing': ['error', {
before: false,
after: false,
}],
"@stylistic/js/space-before-function-paren": ["error", {
anonymous: "always",
asyncArrow: "never",
named: "never"
}],
'@stylistic/js/padded-blocks': ['error', {
blocks: 'never',
switches: 'never',
classes: 'never',
}],
'@stylistic/js/arrow-parens': [ 'error', 'always' ],
'@stylistic/js/block-spacing': [ 'error', 'always' ],
'@stylistic/js/comma-dangle': [ 'error', 'never' ],
'@stylistic/js/comma-spacing': [ 'error', { before: false, after: true }],
'@stylistic/js/computed-property-spacing': ['error', 'never'],
'@stylistic/js/no-mixed-operators': ['off'],
'@stylistic/js/eol-last': ['error', 'always'],
'@stylistic/js/jsx-quotes': ['error', 'prefer-single'],
'@stylistic/js/linebreak-style': ['error', 'unix'],
'@stylistic/js/no-mixed-spaces-and-tabs': ['error'],
'@stylistic/js/no-tabs': ['error'],
'@stylistic/js/no-trailing-spaces': ['error', { skipBlankLines: true, ignoreComments: true }],
'@stylistic/js/no-whitespace-before-property': ['error'],
'@stylistic/js/object-curly-spacing': ['error', 'always'],
'@stylistic/js/quote-props': ['error', 'as-needed'],
'@stylistic/js/quotes': ['error', 'single', { allowTemplateLiterals: true }],
'@stylistic/js/semi': ['error', 'always'],
'@stylistic/js/space-infix-ops': ['error'],
'@stylistic/js/template-curly-spacing': ['error', 'always'],
'@stylistic/js/template-tag-spacing': ['error', 'always'],
'@stylistic/js/space-in-parens': [ 'error', 'always',
{
exceptions: ["{}", "[]"]
}],
'@stylistic/js/spaced-comment': [ 'error', 'always',
{
markers: ['/']
}],
'@stylistic/js/array-bracket-newline': [ 'warn',
{
multiline: true,
minItems: 5,
}],
'@stylistic/js/brace-style': [ 'error', 'allman',
{
allowSingleLine: true,
}],
'@stylistic/js/array-bracket-spacing': [ 'error', 'always',
{
arraysInArrays: false,
objectsInArrays: false,
singleValue: false,
}],
'@stylistic/js/wrap-iife': [2, 'inside', { functionPrototypeMethods: true }],
'@stylistic/js/keyword-spacing': [ 'error',
{
before: true,
after: true,
overrides:
{
return: { before: true, after: true },
throw: { before: true, after: true },
case: { before: true, after: true },
as: { before: true, after: true },
if: { before: true, after: true },
for: { before: true, after: true },
while: { before: true, after: true },
static: { before: true, after: true }
}
}],
},
}
];

File diff suppressed because it is too large Load Diff

4579
tvapp2/node_modules/.package-lock.json generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -3,31 +3,43 @@
"browsers": [
{
"name": "chromium",
"revision": "1155",
"revision": "1161",
"installByDefault": true,
"browserVersion": "133.0.6943.16"
"browserVersion": "134.0.6998.35"
},
{
"name": "chromium-headless-shell",
"revision": "1161",
"installByDefault": true,
"browserVersion": "134.0.6998.35"
},
{
"name": "chromium-tip-of-tree",
"revision": "1293",
"revision": "1304",
"installByDefault": false,
"browserVersion": "133.0.6943.0"
"browserVersion": "135.0.7021.0"
},
{
"name": "chromium-tip-of-tree-headless-shell",
"revision": "1304",
"installByDefault": false,
"browserVersion": "135.0.7021.0"
},
{
"name": "firefox",
"revision": "1471",
"revision": "1475",
"installByDefault": true,
"browserVersion": "134.0"
"browserVersion": "135.0"
},
{
"name": "firefox-beta",
"revision": "1467",
"revision": "1471",
"installByDefault": false,
"browserVersion": "133.0b9"
"browserVersion": "136.0b4"
},
{
"name": "webkit",
"revision": "2123",
"revision": "2140",
"installByDefault": true,
"revisionOverrides": {
"debian11-x64": "2105",
@@ -41,7 +53,7 @@
"ubuntu20.04-x64": "2092",
"ubuntu20.04-arm64": "2092"
},
"browserVersion": "18.2"
"browserVersion": "18.4"
},
{
"name": "ffmpeg",

View File

@@ -19,7 +19,6 @@ const semver = currentNodeVersion.split('.');
const [major] = [+semver[0]];
if (major < minimumMajorNodeVersion) {
// eslint-disable-next-line no-console
console.error(
'You are running Node.js ' +
currentNodeVersion +

View File

@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AndroidServerLauncherImpl = void 0;
var _utilsBundle = require("./utilsBundle");
var _utils = require("./utils");
var _playwright = require("./server/playwright");
var _playwrightServer = require("./remote/playwrightServer");
var _playwright = require("./server/playwright");
var _crypto = require("./server/utils/crypto");
var _utilsBundle = require("./utilsBundle");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -43,7 +43,7 @@ class AndroidServerLauncherImpl {
}
if (devices.length > 1) throw new Error(`More than one device found. Please specify deviceSerialNumber`);
const device = devices[0];
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _utils.createGuid)()}`;
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _crypto.createGuid)()}`;
// 2. Start the server
const server = new _playwrightServer.PlaywrightServer({

View File

@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BrowserServerLauncherImpl = void 0;
var _utilsBundle = require("./utilsBundle");
var _clientHelper = require("./client/clientHelper");
var _utils = require("./utils");
var _instrumentation = require("./server/instrumentation");
var _playwright = require("./server/playwright");
var _socksProxy = require("./server/utils/socksProxy");
var _playwrightServer = require("./remote/playwrightServer");
var _helper = require("./server/helper");
var _stackTrace = require("./utils/stackTrace");
var _socksProxy = require("./common/socksProxy");
var _instrumentation = require("./server/instrumentation");
var _playwright = require("./server/playwright");
var _crypto = require("./server/utils/crypto");
var _stackTrace = require("./utils/isomorphic/stackTrace");
var _utilsBundle = require("./utilsBundle");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -49,13 +48,13 @@ class BrowserServerLauncherImpl {
...options,
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined,
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
env: options.env ? (0, _clientHelper.envObjectToArray)(options.env) : undefined
env: options.env ? envObjectToArray(options.env) : undefined
}, toProtocolLogger(options.logger)).catch(e => {
const log = _helper.helper.formatBrowserLogs(metadata.log);
(0, _stackTrace.rewriteErrorMessage)(e, `${e.message} Failed to launch browser.${log}`);
throw e;
});
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _utils.createGuid)()}`;
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _crypto.createGuid)()}`;
// 2. Start the server
const server = new _playwrightServer.PlaywrightServer({
@@ -89,4 +88,14 @@ function toProtocolLogger(logger) {
return logger ? (direction, message) => {
if (logger.isEnabled('protocol', 'verbose')) logger.log('protocol', 'verbose', (direction === 'send' ? 'SEND ► ' : '◀ RECV ') + JSON.stringify(message), [], {});
} : undefined;
}
function envObjectToArray(env) {
const result = [];
for (const name in env) {
if (!Object.is(env[name], undefined)) result.push({
name,
value: String(env[name])
});
}
return result;
}

View File

@@ -9,13 +9,13 @@ exports.runDriver = runDriver;
exports.runServer = runServer;
var _fs = _interopRequireDefault(require("fs"));
var playwright = _interopRequireWildcard(require("../.."));
var _server = require("../server");
var _transport = require("../protocol/transport");
var _pipeTransport = require("../server/utils/pipeTransport");
var _playwrightServer = require("../remote/playwrightServer");
var _processLauncher = require("../utils/processLauncher");
var _server = require("../server");
var _processLauncher = require("../server/utils/processLauncher");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Microsoft Corporation.
*
@@ -48,7 +48,7 @@ function runDriver() {
});
return new _server.PlaywrightDispatcher(rootScope, playwright);
});
const transport = new _transport.PipeTransport(process.stdout, process.stdin);
const transport = new _pipeTransport.PipeTransport(process.stdout, process.stdin);
transport.onmessage = message => dispatcherConnection.dispatch(JSON.parse(message));
// Certain Language Binding JSON parsers (e.g. .NET) do not like strings with lone surrogates.
const isJavaScriptLanguageBinding = !process.env.PW_LANG_NAME || process.env.PW_LANG_NAME === 'javascript';

View File

@@ -12,16 +12,16 @@ Object.defineProperty(exports, "program", {
var _fs = _interopRequireDefault(require("fs"));
var _os = _interopRequireDefault(require("os"));
var _path = _interopRequireDefault(require("path"));
var _utilsBundle = require("../utilsBundle");
var _driver = require("./driver");
var _traceViewer = require("../server/trace/viewer/traceViewer");
var playwright = _interopRequireWildcard(require("../.."));
var _utils = require("../utils");
var _driver = require("./driver");
var _server = require("../server");
var _errors = require("../client/errors");
var _utils = require("../utils");
var _traceViewer = require("../server/trace/viewer/traceViewer");
var _ascii = require("../server/utils/ascii");
var _utilsBundle = require("../utilsBundle");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Microsoft Corporation.
*
@@ -97,7 +97,7 @@ _utilsBundle.program.command('install [browser...]').description('ensure browser
// For '--no-shell' option, commander sets `shell: false` instead.
if (options.shell === false) options.noShell = true;
if ((0, _utils.isLikelyNpxGlobal)()) {
console.error((0, _utils.wrapInASCIIBox)([`WARNING: It looks like you are running 'npx playwright install' without first`, `installing your project's dependencies.`, ``, `To avoid unexpected behavior, please install your dependencies first, and`, `then run Playwright's install command:`, ``, ` npm install`, ` npx playwright install`, ``, `If your project does not yet depend on Playwright, first install the`, `applicable npm package (most commonly @playwright/test), and`, `then run Playwright's install command to download the browsers:`, ``, ` npm install @playwright/test`, ` npx playwright install`, ``].join('\n'), 1));
console.error((0, _ascii.wrapInASCIIBox)([`WARNING: It looks like you are running 'npx playwright install' without first`, `installing your project's dependencies.`, ``, `To avoid unexpected behavior, please install your dependencies first, and`, `then run Playwright's install command:`, ``, ` npm install`, ` npx playwright install`, ``, `If your project does not yet depend on Playwright, first install the`, `applicable npm package (most commonly @playwright/test), and`, `then run Playwright's install command to download the browsers:`, ``, ` npm install @playwright/test`, ` npx playwright install`, ``].join('\n'), 1));
}
try {
const hasNoArguments = !args.length;
@@ -408,7 +408,7 @@ async function openPage(context, url) {
if (url) {
if (_fs.default.existsSync(url)) url = 'file://' + _path.default.resolve(url);else if (!url.startsWith('http') && !url.startsWith('file://') && !url.startsWith('about:') && !url.startsWith('data:')) url = 'http://' + url;
await page.goto(url).catch(error => {
if (process.env.PWTEST_CLI_AUTO_EXIT_WHEN && (0, _errors.isTargetClosedError)(error)) {
if (process.env.PWTEST_CLI_AUTO_EXIT_WHEN) {
// Tests with PWTEST_CLI_AUTO_EXIT_WHEN might close page too fast, resulting
// in a stray navigation aborted error. We should ignore it.
} else {

View File

@@ -9,6 +9,7 @@ Object.defineProperty(exports, "program", {
return _program.program;
}
});
var _processLauncher = require("../server/utils/processLauncher");
var _utils = require("../utils");
var _program = require("./program");
/**
@@ -60,7 +61,7 @@ function addExternalPlaywrightTestCommands() {
playwrightTest.description(`${description} Available in @playwright/test package.`);
playwrightTest.action(async () => {
printPlaywrightTestError(command);
(0, _utils.gracefullyProcessExitDoNotHang)(1);
(0, _processLauncher.gracefullyProcessExitDoNotHang)(1);
});
}
}

View File

@@ -4,18 +4,17 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AndroidWebView = exports.AndroidSocket = exports.AndroidInput = exports.AndroidDevice = exports.Android = void 0;
var _fs = _interopRequireDefault(require("fs"));
var _utils = require("../utils");
var _events = require("./events");
var _eventEmitter = require("./eventEmitter");
var _browserContext = require("./browserContext");
var _channelOwner = require("./channelOwner");
var _timeoutSettings = require("../common/timeoutSettings");
var _waiter = require("./waiter");
var _events2 = require("events");
var _connection = require("./connection");
var _errors = require("./errors");
var _timeoutRunner = require("../utils/timeoutRunner");
let _Symbol$asyncDispose;
var _events = require("./events");
var _waiter = require("./waiter");
var _timeoutSettings = require("./timeoutSettings");
var _rtti = require("../utils/isomorphic/rtti");
var _time = require("../utils/isomorphic/time");
var _timeoutRunner = require("../utils/isomorphic/timeoutRunner");
var _webSocket = require("./webSocket");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -31,7 +30,7 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Android extends _channelOwner.ChannelOwner {
static from(android) {
return android._object;
@@ -40,13 +39,15 @@ class Android extends _channelOwner.ChannelOwner {
super(parent, type, guid, initializer);
this._timeoutSettings = void 0;
this._serverLauncher = void 0;
this._timeoutSettings = new _timeoutSettings.TimeoutSettings();
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform);
}
setDefaultTimeout(timeout) {
this._timeoutSettings.setDefaultTimeout(timeout);
this._channel.setDefaultTimeoutNoReply({
timeout
});
this._wrapApiCall(async () => {
await this._channel.setDefaultTimeoutNoReply({
timeout
});
}, true).catch(() => {});
}
async devices(options = {}) {
const {
@@ -60,68 +61,44 @@ class Android extends _channelOwner.ChannelOwner {
}
async connect(wsEndpoint, options = {}) {
return await this._wrapApiCall(async () => {
const deadline = options.timeout ? (0, _utils.monotonicTime)() + options.timeout : 0;
const deadline = options.timeout ? (0, _time.monotonicTime)() + options.timeout : 0;
const headers = {
'x-playwright-browser': 'android',
...options.headers
};
const localUtils = this._connection.localUtils();
const connectParams = {
wsEndpoint,
headers,
slowMo: options.slowMo,
timeout: options.timeout
};
const {
pipe
} = await localUtils._channel.connect(connectParams);
const closePipe = () => pipe.close().catch(() => {});
const connection = new _connection.Connection(localUtils, this._instrumentation);
connection.markAsRemote();
connection.on('close', closePipe);
const connection = await (0, _webSocket.connectOverWebSocket)(this._connection, connectParams);
let device;
let closeError;
const onPipeClosed = () => {
connection.on('close', () => {
var _device;
(_device = device) === null || _device === void 0 || _device._didClose();
connection.close(closeError);
};
pipe.on('closed', onPipeClosed);
connection.onmessage = message => pipe.send({
message
}).catch(onPipeClosed);
pipe.on('message', ({
message
}) => {
try {
connection.dispatch(message);
} catch (e) {
closeError = String(e);
closePipe();
}
});
const result = await (0, _timeoutRunner.raceAgainstDeadline)(async () => {
const playwright = await connection.initializePlaywright();
if (!playwright._initializer.preConnectedAndroidDevice) {
closePipe();
connection.close();
throw new Error('Malformed endpoint. Did you use Android.launchServer method?');
}
device = AndroidDevice.from(playwright._initializer.preConnectedAndroidDevice);
device._shouldCloseConnectionOnClose = true;
device.on(_events.Events.AndroidDevice.Close, closePipe);
device.on(_events.Events.AndroidDevice.Close, () => connection.close());
return device;
}, deadline);
if (!result.timedOut) {
return result.result;
} else {
closePipe();
connection.close();
throw new Error(`Timeout ${options.timeout}ms exceeded`);
}
});
}
}
exports.Android = Android;
_Symbol$asyncDispose = Symbol.asyncDispose;
class AndroidDevice extends _channelOwner.ChannelOwner {
static from(androidDevice) {
return androidDevice._object;
@@ -133,7 +110,7 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
this._shouldCloseConnectionOnClose = false;
this.input = void 0;
this.input = new AndroidInput(this);
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(parent._timeoutSettings);
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform, parent._timeoutSettings);
this._channel.on('webViewAdded', ({
webView
}) => this._onWebViewAdded(webView));
@@ -154,9 +131,11 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
}
setDefaultTimeout(timeout) {
this._timeoutSettings.setDefaultTimeout(timeout);
this._channel.setDefaultTimeoutNoReply({
timeout
});
this._wrapApiCall(async () => {
await this._channel.setDefaultTimeoutNoReply({
timeout
});
}, true).catch(() => {});
}
serial() {
return this._initializer.serial;
@@ -262,10 +241,10 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
const {
binary
} = await this._channel.screenshot();
if (options.path) await _fs.default.promises.writeFile(options.path, binary);
if (options.path) await this._platform.fs().promises.writeFile(options.path, binary);
return binary;
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.close();
}
async close() {
@@ -294,19 +273,19 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
}
async installApk(file, options) {
await this._channel.installApk({
file: await loadFile(file),
file: await loadFile(this._platform, file),
args: options && options.args
});
}
async push(file, path, options) {
await this._channel.push({
file: await loadFile(file),
file: await loadFile(this._platform, file),
path,
mode: options ? options.mode : undefined
});
}
async launchBrowser(options = {}) {
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(options);
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(this._platform, options);
const result = await this._channel.launchBrowser(contextOptions);
const context = _browserContext.BrowserContext.from(result.context);
context._setOptions(contextOptions, {});
@@ -350,8 +329,8 @@ class AndroidSocket extends _channelOwner.ChannelOwner {
}
}
exports.AndroidSocket = AndroidSocket;
async function loadFile(file) {
if ((0, _utils.isString)(file)) return await _fs.default.promises.readFile(file);
async function loadFile(platform, file) {
if ((0, _rtti.isString)(file)) return await platform.fs().promises.readFile(file);
return file;
}
class AndroidInput {
@@ -411,7 +390,7 @@ function toSelectorChannel(selector) {
} = selector;
const toRegex = value => {
if (value === undefined) return undefined;
if ((0, _utils.isRegExp)(value)) return value.source;
if ((0, _rtti.isRegExp)(value)) return value.source;
return '^' + value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d') + '$';
};
return {
@@ -439,9 +418,9 @@ function toSelectorChannel(selector) {
selected
};
}
class AndroidWebView extends _events2.EventEmitter {
class AndroidWebView extends _eventEmitter.EventEmitter {
constructor(device, data) {
super();
super(device._platform);
this._device = void 0;
this._data = void 0;
this._pagePromise = void 0;

View File

@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Artifact = void 0;
var fs = _interopRequireWildcard(require("fs"));
var _stream = require("./stream");
var _fileUtils = require("../utils/fileUtils");
var _channelOwner = require("./channelOwner");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
var _stream = require("./stream");
var _fileUtils = require("./fileUtils");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -43,9 +40,9 @@ class Artifact extends _channelOwner.ChannelOwner {
}
const result = await this._channel.saveAsStream();
const stream = _stream.Stream.from(result.stream);
await (0, _fileUtils.mkdirIfNeeded)(path);
await (0, _fileUtils.mkdirIfNeeded)(this._platform, path);
await new Promise((resolve, reject) => {
stream.stream().pipe(fs.createWriteStream(path)).on('finish', resolve).on('error', reject);
stream.stream().pipe(this._platform.fs().createWriteStream(path)).on('finish', resolve).on('error', reject);
});
}
async failure() {

View File

@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Browser = void 0;
var _fs = _interopRequireDefault(require("fs"));
var _browserContext = require("./browserContext");
var _channelOwner = require("./channelOwner");
var _events = require("./events");
var _errors = require("./errors");
var _cdpSession = require("./cdpSession");
var _artifact = require("./artifact");
var _utils = require("../utils");
let _Symbol$asyncDispose;
var _browserContext = require("./browserContext");
var _cdpSession = require("./cdpSession");
var _channelOwner = require("./channelOwner");
var _errors = require("./errors");
var _events = require("./events");
var _fileUtils = require("./fileUtils");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -28,8 +26,7 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Symbol$asyncDispose = Symbol.asyncDispose;
class Browser extends _channelOwner.ChannelOwner {
static from(browser) {
return browser._object;
@@ -44,8 +41,6 @@ class Browser extends _channelOwner.ChannelOwner {
this._options = {};
this._name = void 0;
this._path = void 0;
// Used from @playwright/test fixtures.
this._connectHeaders = void 0;
this._closeReason = void 0;
this._name = initializer.name;
this._channel.on('close', () => this._didClose());
@@ -76,10 +71,10 @@ class Browser extends _channelOwner.ChannelOwner {
}
async _innerNewContext(options = {}, forReuse) {
options = {
...this._browserType._defaultContextOptions,
...this._browserType._playwright._defaultContextOptions,
...options
};
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(options);
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(this._platform, options);
const response = forReuse ? await this._channel.newContextForReuse(contextOptions) : await this._channel.newContext(contextOptions);
const context = _browserContext.BrowserContext.from(response.context);
await this._browserType._didCreateContext(context, contextOptions, this._options, options.logger || this._logger);
@@ -118,13 +113,13 @@ class Browser extends _channelOwner.ChannelOwner {
const buffer = await artifact.readIntoBuffer();
await artifact.delete();
if (this._path) {
await (0, _utils.mkdirIfNeeded)(this._path);
await _fs.default.promises.writeFile(this._path, buffer);
await (0, _fileUtils.mkdirIfNeeded)(this._platform, this._path);
await this._platform.fs().promises.writeFile(this._path, buffer);
this._path = undefined;
}
return buffer;
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.close();
}
async close(options = {}) {

View File

@@ -6,31 +6,33 @@ Object.defineProperty(exports, "__esModule", {
exports.BrowserContext = void 0;
exports.prepareBrowserContextParams = prepareBrowserContextParams;
exports.toClientCertificatesProtocol = toClientCertificatesProtocol;
var _page = require("./page");
var _frame = require("./frame");
var network = _interopRequireWildcard(require("./network"));
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var _artifact = require("./artifact");
var _browser = require("./browser");
var _cdpSession = require("./cdpSession");
var _channelOwner = require("./channelOwner");
var _clientHelper = require("./clientHelper");
var _browser = require("./browser");
var _worker = require("./worker");
var _events = require("./events");
var _timeoutSettings = require("../common/timeoutSettings");
var _waiter = require("./waiter");
var _utils = require("../utils");
var _cdpSession = require("./cdpSession");
var _tracing = require("./tracing");
var _artifact = require("./artifact");
var _fetch = require("./fetch");
var _stackTrace = require("../utils/stackTrace");
var _harRouter = require("./harRouter");
var _clock = require("./clock");
var _consoleMessage = require("./consoleMessage");
var _dialog = require("./dialog");
var _webError = require("./webError");
var _errors = require("./errors");
var _clock = require("./clock");
let _Symbol$asyncDispose;
var _events = require("./events");
var _fetch = require("./fetch");
var _frame = require("./frame");
var _harRouter = require("./harRouter");
var network = _interopRequireWildcard(require("./network"));
var _page = require("./page");
var _tracing = require("./tracing");
var _waiter = require("./waiter");
var _webError = require("./webError");
var _worker = require("./worker");
var _timeoutSettings = require("./timeoutSettings");
var _fileUtils = require("./fileUtils");
var _headers = require("../utils/isomorphic/headers");
var _urlMatch = require("../utils/isomorphic/urlMatch");
var _rtti = require("../utils/isomorphic/rtti");
var _stackTrace = require("../utils/isomorphic/stackTrace");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
/**
* Copyright 2017 Google Inc. All rights reserved.
* Modifications copyright (c) Microsoft Corporation.
@@ -47,10 +49,7 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
_Symbol$asyncDispose = Symbol.asyncDispose;
class BrowserContext extends _channelOwner.ChannelOwner {
static from(context) {
return context._object;
@@ -67,7 +66,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
this._browser = null;
this._browserType = void 0;
this._bindings = new Map();
this._timeoutSettings = new _timeoutSettings.TimeoutSettings();
this._timeoutSettings = void 0;
this._ownerPage = void 0;
this._closedPromise = void 0;
this._options = {};
@@ -81,6 +80,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
this._closeWasCalled = false;
this._closeReason = void 0;
this._harRouters = [];
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform);
if (parent instanceof _browser.Browser) this._browser = parent;
(_this$_browser = this._browser) === null || _this$_browser === void 0 || _this$_browser._contexts.add(this);
this._isChromium = ((_this$_browser2 = this._browser) === null || _this$_browser2 === void 0 ? void 0 : _this$_browser2._name) === 'chromium';
@@ -116,7 +116,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
this.emit(_events.Events.BrowserContext.ServiceWorker, serviceWorker);
});
this._channel.on('console', event => {
const consoleMessage = new _consoleMessage.ConsoleMessage(event);
const consoleMessage = new _consoleMessage.ConsoleMessage(this._platform, event);
this.emit(_events.Events.BrowserContext.Console, consoleMessage);
const page = consoleMessage.page();
if (page) page.emit(_events.Events.Page.Console, consoleMessage);
@@ -233,18 +233,18 @@ class BrowserContext extends _channelOwner.ChannelOwner {
setDefaultNavigationTimeout(timeout) {
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
this._wrapApiCall(async () => {
this._channel.setDefaultNavigationTimeoutNoReply({
await this._channel.setDefaultNavigationTimeoutNoReply({
timeout
}).catch(() => {});
}, true);
});
}, true).catch(() => {});
}
setDefaultTimeout(timeout) {
this._timeoutSettings.setDefaultTimeout(timeout);
this._wrapApiCall(async () => {
this._channel.setDefaultTimeoutNoReply({
await this._channel.setDefaultTimeoutNoReply({
timeout
}).catch(() => {});
}, true);
});
}, true).catch(() => {});
}
browser() {
return this._browser;
@@ -270,15 +270,15 @@ class BrowserContext extends _channelOwner.ChannelOwner {
}
async clearCookies(options = {}) {
await this._channel.clearCookies({
name: (0, _utils.isString)(options.name) ? options.name : undefined,
nameRegexSource: (0, _utils.isRegExp)(options.name) ? options.name.source : undefined,
nameRegexFlags: (0, _utils.isRegExp)(options.name) ? options.name.flags : undefined,
domain: (0, _utils.isString)(options.domain) ? options.domain : undefined,
domainRegexSource: (0, _utils.isRegExp)(options.domain) ? options.domain.source : undefined,
domainRegexFlags: (0, _utils.isRegExp)(options.domain) ? options.domain.flags : undefined,
path: (0, _utils.isString)(options.path) ? options.path : undefined,
pathRegexSource: (0, _utils.isRegExp)(options.path) ? options.path.source : undefined,
pathRegexFlags: (0, _utils.isRegExp)(options.path) ? options.path.flags : undefined
name: (0, _rtti.isString)(options.name) ? options.name : undefined,
nameRegexSource: (0, _rtti.isRegExp)(options.name) ? options.name.source : undefined,
nameRegexFlags: (0, _rtti.isRegExp)(options.name) ? options.name.flags : undefined,
domain: (0, _rtti.isString)(options.domain) ? options.domain : undefined,
domainRegexSource: (0, _rtti.isRegExp)(options.domain) ? options.domain.source : undefined,
domainRegexFlags: (0, _rtti.isRegExp)(options.domain) ? options.domain.flags : undefined,
path: (0, _rtti.isString)(options.path) ? options.path : undefined,
pathRegexSource: (0, _rtti.isRegExp)(options.path) ? options.path.source : undefined,
pathRegexFlags: (0, _rtti.isRegExp)(options.path) ? options.path.flags : undefined
});
}
async grantPermissions(permissions, options) {
@@ -298,7 +298,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
async setExtraHTTPHeaders(headers) {
network.validateHeaders(headers);
await this._channel.setExtraHTTPHeaders({
headers: (0, _utils.headersObjectToArray)(headers)
headers: (0, _headers.headersObjectToArray)(headers)
});
}
async setOffline(offline) {
@@ -312,7 +312,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
});
}
async addInitScript(script, arg) {
const source = await (0, _clientHelper.evaluationScript)(script, arg);
const source = await (0, _clientHelper.evaluationScript)(this._platform, script, arg);
await this._channel.addInitScript({
source
});
@@ -332,7 +332,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
this._bindings.set(name, binding);
}
async route(url, handler, options = {}) {
this._routes.unshift(new network.RouteHandler(this._options.baseURL, url, handler, options.times));
this._routes.unshift(new network.RouteHandler(this._platform, this._options.baseURL, url, handler, options.times));
await this._updateInterceptionPatterns();
}
async routeWebSocket(url, handler) {
@@ -358,11 +358,13 @@ class BrowserContext extends _channelOwner.ChannelOwner {
});
}
async routeFromHAR(har, options = {}) {
const localUtils = this._connection.localUtils();
if (!localUtils) throw new Error('Route from har is not supported in thin clients');
if (options.update) {
await this._recordIntoHAR(har, null, options);
return;
}
const harRouter = await _harRouter.HarRouter.create(this._connection.localUtils(), har, options.notFound || 'abort', {
const harRouter = await _harRouter.HarRouter.create(localUtils, har, options.notFound || 'abort', {
urlMatch: options.url
});
this._harRouters.push(harRouter);
@@ -380,7 +382,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
const removed = [];
const remaining = [];
for (const route of this._routes) {
if ((0, _utils.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
if ((0, _urlMatch.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
}
await this._unrouteInternal(removed, remaining, 'default');
}
@@ -420,10 +422,12 @@ class BrowserContext extends _channelOwner.ChannelOwner {
});
}
async storageState(options = {}) {
const state = await this._channel.storageState();
const state = await this._channel.storageState({
indexedDB: options.indexedDB
});
if (options.path) {
await (0, _utils.mkdirIfNeeded)(options.path);
await _fs.default.promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
await this._platform.fs().promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
}
return state;
}
@@ -451,7 +455,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
this.tracing._resetStackCounter();
this.emit(_events.Events.BrowserContext.Close, this);
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.close();
}
async close(options = {}) {
@@ -473,8 +477,10 @@ class BrowserContext extends _channelOwner.ChannelOwner {
const isCompressed = harParams.content === 'attach' || harParams.path.endsWith('.zip');
const needCompressed = harParams.path.endsWith('.zip');
if (isCompressed && !needCompressed) {
const localUtils = this._connection.localUtils();
if (!localUtils) throw new Error('Uncompressed har is not supported in thin clients');
await artifact.saveAs(harParams.path + '.tmp');
await this._connection.localUtils()._channel.harUnzip({
await localUtils.harUnzip({
zipFile: harParams.path + '.tmp',
harFile: harParams.path
});
@@ -492,10 +498,10 @@ class BrowserContext extends _channelOwner.ChannelOwner {
}
}
exports.BrowserContext = BrowserContext;
async function prepareStorageState(options) {
async function prepareStorageState(platform, options) {
if (typeof options.storageState !== 'string') return options.storageState;
try {
return JSON.parse(await _fs.default.promises.readFile(options.storageState, 'utf8'));
return JSON.parse(await platform.fs().promises.readFile(options.storageState, 'utf8'));
} catch (e) {
(0, _stackTrace.rewriteErrorMessage)(e, `Error reading storage state from ${options.storageState}:\n` + e.message);
throw e;
@@ -506,28 +512,29 @@ function prepareRecordHarOptions(options) {
return {
path: options.path,
content: options.content || (options.omitContent ? 'omit' : undefined),
urlGlob: (0, _utils.isString)(options.urlFilter) ? options.urlFilter : undefined,
urlRegexSource: (0, _utils.isRegExp)(options.urlFilter) ? options.urlFilter.source : undefined,
urlRegexFlags: (0, _utils.isRegExp)(options.urlFilter) ? options.urlFilter.flags : undefined,
urlGlob: (0, _rtti.isString)(options.urlFilter) ? options.urlFilter : undefined,
urlRegexSource: (0, _rtti.isRegExp)(options.urlFilter) ? options.urlFilter.source : undefined,
urlRegexFlags: (0, _rtti.isRegExp)(options.urlFilter) ? options.urlFilter.flags : undefined,
mode: options.mode
};
}
async function prepareBrowserContextParams(options) {
async function prepareBrowserContextParams(platform, options) {
if (options.videoSize && !options.videosPath) throw new Error(`"videoSize" option requires "videosPath" to be specified`);
if (options.extraHTTPHeaders) network.validateHeaders(options.extraHTTPHeaders);
const contextParams = {
...options,
viewport: options.viewport === null ? undefined : options.viewport,
noDefaultViewport: options.viewport === null,
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _utils.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
storageState: await prepareStorageState(options),
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _headers.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
storageState: await prepareStorageState(platform, options),
serviceWorkers: options.serviceWorkers,
recordHar: prepareRecordHarOptions(options.recordHar),
colorScheme: options.colorScheme === null ? 'no-override' : options.colorScheme,
reducedMotion: options.reducedMotion === null ? 'no-override' : options.reducedMotion,
forcedColors: options.forcedColors === null ? 'no-override' : options.forcedColors,
contrast: options.contrast === null ? 'no-override' : options.contrast,
acceptDownloads: toAcceptDownloadsProtocol(options.acceptDownloads),
clientCertificates: await toClientCertificatesProtocol(options.clientCertificates)
clientCertificates: await toClientCertificatesProtocol(platform, options.clientCertificates)
};
if (!contextParams.recordVideo && options.videosPath) {
contextParams.recordVideo = {
@@ -535,7 +542,7 @@ async function prepareBrowserContextParams(options) {
size: options.videoSize
};
}
if (contextParams.recordVideo && contextParams.recordVideo.dir) contextParams.recordVideo.dir = _path.default.resolve(process.cwd(), contextParams.recordVideo.dir);
if (contextParams.recordVideo && contextParams.recordVideo.dir) contextParams.recordVideo.dir = platform.path().resolve(contextParams.recordVideo.dir);
return contextParams;
}
function toAcceptDownloadsProtocol(acceptDownloads) {
@@ -543,11 +550,11 @@ function toAcceptDownloadsProtocol(acceptDownloads) {
if (acceptDownloads) return 'accept';
return 'deny';
}
async function toClientCertificatesProtocol(certs) {
async function toClientCertificatesProtocol(platform, certs) {
if (!certs) return undefined;
const bufferizeContent = async (value, path) => {
if (value) return value;
if (path) return await _fs.default.promises.readFile(path);
if (path) return await platform.fs().promises.readFile(path);
};
return await Promise.all(certs.map(async cert => ({
origin: cert.origin,

View File

@@ -7,11 +7,13 @@ exports.BrowserType = void 0;
var _browser3 = require("./browser");
var _browserContext = require("./browserContext");
var _channelOwner = require("./channelOwner");
var _connection = require("./connection");
var _events = require("./events");
var _clientHelper = require("./clientHelper");
var _utils = require("../utils");
var _timeoutRunner = require("../utils/timeoutRunner");
var _events = require("./events");
var _assert = require("../utils/isomorphic/assert");
var _headers = require("../utils/isomorphic/headers");
var _time = require("../utils/isomorphic/time");
var _timeoutRunner = require("../utils/isomorphic/timeoutRunner");
var _webSocket = require("./webSocket");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -36,11 +38,6 @@ class BrowserType extends _channelOwner.ChannelOwner {
this._serverLauncher = void 0;
this._contexts = new Set();
this._playwright = void 0;
// Instrumentation.
this._defaultContextOptions = void 0;
this._defaultContextTimeout = void 0;
this._defaultContextNavigationTimeout = void 0;
this._defaultLaunchOptions = void 0;
}
static from(browserType) {
return browserType._object;
@@ -53,12 +50,12 @@ class BrowserType extends _channelOwner.ChannelOwner {
return this._initializer.name;
}
async launch(options = {}) {
var _this$_defaultLaunchO;
(0, _utils.assert)(!options.userDataDir, 'userDataDir option is not supported in `browserType.launch`. Use `browserType.launchPersistentContext` instead');
(0, _utils.assert)(!options.port, 'Cannot specify a port without launching as a server.');
const logger = options.logger || ((_this$_defaultLaunchO = this._defaultLaunchOptions) === null || _this$_defaultLaunchO === void 0 ? void 0 : _this$_defaultLaunchO.logger);
var _this$_playwright$_de;
(0, _assert.assert)(!options.userDataDir, 'userDataDir option is not supported in `browserType.launch`. Use `browserType.launchPersistentContext` instead');
(0, _assert.assert)(!options.port, 'Cannot specify a port without launching as a server.');
const logger = options.logger || ((_this$_playwright$_de = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de === void 0 ? void 0 : _this$_playwright$_de.logger);
options = {
...this._defaultLaunchOptions,
...this._playwright._defaultLaunchOptions,
...options
};
const launchOptions = {
@@ -76,28 +73,28 @@ class BrowserType extends _channelOwner.ChannelOwner {
async launchServer(options = {}) {
if (!this._serverLauncher) throw new Error('Launching server is not supported');
options = {
...this._defaultLaunchOptions,
...this._playwright._defaultLaunchOptions,
...options
};
return await this._serverLauncher.launchServer(options);
}
async launchPersistentContext(userDataDir, options = {}) {
var _this$_defaultLaunchO2;
const logger = options.logger || ((_this$_defaultLaunchO2 = this._defaultLaunchOptions) === null || _this$_defaultLaunchO2 === void 0 ? void 0 : _this$_defaultLaunchO2.logger);
(0, _utils.assert)(!options.port, 'Cannot specify a port without launching as a server.');
var _this$_playwright$_de2;
const logger = options.logger || ((_this$_playwright$_de2 = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de2 === void 0 ? void 0 : _this$_playwright$_de2.logger);
(0, _assert.assert)(!options.port, 'Cannot specify a port without launching as a server.');
options = {
...this._defaultLaunchOptions,
...this._defaultContextOptions,
...this._playwright._defaultLaunchOptions,
...this._playwright._defaultContextOptions,
...options
};
const contextParams = await (0, _browserContext.prepareBrowserContextParams)(options);
const contextParams = await (0, _browserContext.prepareBrowserContextParams)(this._platform, options);
const persistentParams = {
...contextParams,
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined,
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
env: options.env ? (0, _clientHelper.envObjectToArray)(options.env) : undefined,
channel: options.channel,
userDataDir
userDataDir: this._platform.path().isAbsolute(userDataDir) || !userDataDir ? userDataDir : this._platform.path().resolve(userDataDir)
};
return await this._wrapApiCall(async () => {
const result = await this._channel.launchPersistentContext(persistentParams);
@@ -111,19 +108,18 @@ class BrowserType extends _channelOwner.ChannelOwner {
...options,
wsEndpoint: optionsOrWsEndpoint
});
(0, _utils.assert)(optionsOrWsEndpoint.wsEndpoint, 'options.wsEndpoint is required');
(0, _assert.assert)(optionsOrWsEndpoint.wsEndpoint, 'options.wsEndpoint is required');
return await this._connect(optionsOrWsEndpoint);
}
async _connect(params) {
const logger = params.logger;
return await this._wrapApiCall(async () => {
var _params$exposeNetwork;
const deadline = params.timeout ? (0, _utils.monotonicTime)() + params.timeout : 0;
const deadline = params.timeout ? (0, _time.monotonicTime)() + params.timeout : 0;
const headers = {
'x-playwright-browser': this.name(),
...params.headers
};
const localUtils = this._connection.localUtils();
const connectParams = {
wsEndpoint: params.wsEndpoint,
headers,
@@ -132,69 +128,39 @@ class BrowserType extends _channelOwner.ChannelOwner {
timeout: params.timeout
};
if (params.__testHookRedirectPortForwarding) connectParams.socksProxyRedirectPortForTest = params.__testHookRedirectPortForwarding;
const {
pipe,
headers: connectHeaders
} = await localUtils._channel.connect(connectParams);
const closePipe = () => pipe.close().catch(() => {});
const connection = new _connection.Connection(localUtils, this._instrumentation);
connection.markAsRemote();
connection.on('close', closePipe);
const connection = await (0, _webSocket.connectOverWebSocket)(this._connection, connectParams);
let browser;
let closeError;
const onPipeClosed = reason => {
connection.on('close', () => {
// Emulate all pages, contexts and the browser closing upon disconnect.
for (const context of ((_browser = browser) === null || _browser === void 0 ? void 0 : _browser.contexts()) || []) {
var _browser;
for (const page of context.pages()) page._onClose();
context._onClose();
}
connection.close(reason || closeError);
// Give a chance to any API call promises to reject upon page/context closure.
// This happens naturally when we receive page.onClose and browser.onClose from the server
// in separate tasks. However, upon pipe closure we used to dispatch them all synchronously
// here and promises did not have a chance to reject.
// The order of rejects vs closure is a part of the API contract and our test runner
// relies on it to attribute rejections to the right test.
setTimeout(() => {
var _browser2;
return (_browser2 = browser) === null || _browser2 === void 0 ? void 0 : _browser2._didClose();
}, 0);
};
pipe.on('closed', params => onPipeClosed(params.reason));
connection.onmessage = message => this._wrapApiCall(() => pipe.send({
message
}).catch(() => onPipeClosed()), /* isInternal */true);
pipe.on('message', ({
message
}) => {
try {
connection.dispatch(message);
} catch (e) {
closeError = String(e);
closePipe();
}
});
const result = await (0, _timeoutRunner.raceAgainstDeadline)(async () => {
// For tests.
if (params.__testHookBeforeCreateBrowser) await params.__testHookBeforeCreateBrowser();
const playwright = await connection.initializePlaywright();
if (!playwright._initializer.preLaunchedBrowser) {
closePipe();
connection.close();
throw new Error('Malformed endpoint. Did you use BrowserType.launchServer method?');
}
playwright._setSelectors(this._playwright.selectors);
browser = _browser3.Browser.from(playwright._initializer.preLaunchedBrowser);
this._didLaunchBrowser(browser, {}, logger);
browser._shouldCloseConnectionOnClose = true;
browser._connectHeaders = connectHeaders;
browser.on(_events.Events.Browser.Disconnected, () => this._wrapApiCall(() => closePipe(), /* isInternal */true));
browser.on(_events.Events.Browser.Disconnected, () => connection.close());
return browser;
}, deadline);
if (!result.timedOut) {
return result.result;
} else {
closePipe();
connection.close();
throw new Error(`Timeout ${params.timeout}ms exceeded`);
}
});
@@ -202,12 +168,12 @@ class BrowserType extends _channelOwner.ChannelOwner {
async connectOverCDP(endpointURLOrOptions, options) {
if (typeof endpointURLOrOptions === 'string') return await this._connectOverCDP(endpointURLOrOptions, options);
const endpointURL = 'endpointURL' in endpointURLOrOptions ? endpointURLOrOptions.endpointURL : endpointURLOrOptions.wsEndpoint;
(0, _utils.assert)(endpointURL, 'Cannot connect over CDP without wsEndpoint.');
(0, _assert.assert)(endpointURL, 'Cannot connect over CDP without wsEndpoint.');
return await this.connectOverCDP(endpointURL, endpointURLOrOptions);
}
async _connectOverCDP(endpointURL, params = {}) {
if (this.name() !== 'chromium') throw new Error('Connecting over CDP is only supported in Chromium.');
const headers = params.headers ? (0, _utils.headersObjectToArray)(params.headers) : undefined;
const headers = params.headers ? (0, _headers.headersObjectToArray)(params.headers) : undefined;
const result = await this._channel.connectOverCDP({
endpointURL,
headers,
@@ -229,8 +195,8 @@ class BrowserType extends _channelOwner.ChannelOwner {
context._browserType = this;
this._contexts.add(context);
context._setOptions(contextOptions, browserOptions);
if (this._defaultContextTimeout !== undefined) context.setDefaultTimeout(this._defaultContextTimeout);
if (this._defaultContextNavigationTimeout !== undefined) context.setDefaultNavigationTimeout(this._defaultContextNavigationTimeout);
if (this._playwright._defaultContextTimeout !== undefined) context.setDefaultTimeout(this._playwright._defaultContextTimeout);
if (this._playwright._defaultContextNavigationTimeout !== undefined) context.setDefaultNavigationTimeout(this._playwright._defaultContextNavigationTimeout);
await this._instrumentation.runAfterCreateBrowserContext(context);
}
async _willCloseContext(context) {

View File

@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
exports.ChannelOwner = void 0;
var _eventEmitter = require("./eventEmitter");
var _validator = require("../protocol/validator");
var _debugLogger = require("../utils/debugLogger");
var _stackTrace = require("../utils/stackTrace");
var _utils = require("../utils");
var _zones = require("../utils/zones");
var _clientStackTrace = require("./clientStackTrace");
var _stackTrace = require("../utils/isomorphic/stackTrace");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -28,7 +26,8 @@ var _zones = require("../utils/zones");
class ChannelOwner extends _eventEmitter.EventEmitter {
constructor(parent, type, guid, initializer) {
super();
const connection = parent instanceof ChannelOwner ? parent._connection : parent;
super(connection._platform);
this._connection = void 0;
this._parent = void 0;
this._objects = new Map();
@@ -42,7 +41,7 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
this._isInternalType = false;
this._wasCollected = false;
this.setMaxListeners(0);
this._connection = parent instanceof ChannelOwner ? parent._connection : parent;
this._connection = connection;
this._type = type;
this._guid = guid;
this._parent = parent instanceof ChannelOwner ? parent : undefined;
@@ -52,7 +51,7 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
this._parent._objects.set(guid, this);
this._logger = this._parent._logger;
}
this._channel = this._createChannel(new _eventEmitter.EventEmitter());
this._channel = this._createChannel(new _eventEmitter.EventEmitter(connection._platform));
this._initializer = initializer;
}
markAsInternalType() {
@@ -118,6 +117,13 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
objects: Array.from(this._objects.values()).map(o => o._debugScopeState())
};
}
_validatorToWireContext() {
return {
tChannelImpl: tChannelImplToWire,
binary: this._connection.rawBuffers() ? 'buffer' : 'toBase64',
isUnderTest: () => this._platform.isUnderTest()
};
}
_createChannel(base) {
const channel = new Proxy(base, {
get: (obj, prop) => {
@@ -126,16 +132,13 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
if (validator) {
return async params => {
return await this._wrapApiCall(async apiZone => {
const validatedParams = validator(params, '', {
tChannelImpl: tChannelImplToWire,
binary: this._connection.rawBuffers() ? 'buffer' : 'toBase64'
});
const validatedParams = validator(params, '', this._validatorToWireContext());
if (!apiZone.isInternal && !apiZone.reported) {
// Reporting/tracing/logging this api call for the first time.
apiZone.params = params;
apiZone.reported = true;
this._instrumentation.onApiCallBegin(apiZone);
logApiCall(this._logger, `=> ${apiZone.apiName} started`);
logApiCall(this._platform, this._logger, `=> ${apiZone.apiName} started`);
return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone.apiName, apiZone.frames, apiZone.stepId);
}
// Since this api call is either internal, or has already been reported/traced once,
@@ -153,10 +156,10 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
}
async _wrapApiCall(func, isInternal) {
const logger = this._logger;
const existingApiZone = _zones.zones.zoneData('apiZone');
const existingApiZone = this._platform.zones.current().data();
if (existingApiZone) return await func(existingApiZone);
if (isInternal === undefined) isInternal = this._isInternalType;
const stackTrace = (0, _stackTrace.captureLibraryStackTrace)();
const stackTrace = (0, _clientStackTrace.captureLibraryStackTrace)(this._platform);
const apiZone = {
apiName: stackTrace.apiName,
frames: stackTrace.frames,
@@ -166,20 +169,20 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
stepId: undefined
};
try {
const result = await _zones.zones.run('apiZone', apiZone, async () => await func(apiZone));
const result = await this._platform.zones.current().push(apiZone).run(async () => await func(apiZone));
if (!isInternal) {
logApiCall(logger, `<= ${apiZone.apiName} succeeded`);
logApiCall(this._platform, logger, `<= ${apiZone.apiName} succeeded`);
this._instrumentation.onApiCallEnd(apiZone);
}
return result;
} catch (e) {
const innerError = (process.env.PWDEBUGIMPL || (0, _utils.isUnderTest)()) && e.stack ? '\n<inner error>\n' + e.stack : '';
const innerError = (this._platform.showInternalStackFrames() || this._platform.isUnderTest()) && e.stack ? '\n<inner error>\n' + e.stack : '';
if (apiZone.apiName && !apiZone.apiName.includes('<anonymous>')) e.message = apiZone.apiName + ': ' + e.message;
const stackFrames = '\n' + (0, _stackTrace.stringifyStackFrames)(stackTrace.frames).join('\n') + innerError;
if (stackFrames.trim()) e.stack = e.message + stackFrames;else e.stack = '';
if (!isInternal) {
apiZone.error = e;
logApiCall(logger, `<= ${apiZone.apiName} failed`);
logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);
this._instrumentation.onApiCallEnd(apiZone);
}
throw e;
@@ -201,11 +204,11 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
}
}
exports.ChannelOwner = ChannelOwner;
function logApiCall(logger, message) {
function logApiCall(platform, logger, message) {
if (logger && logger.isEnabled('api', 'info')) logger.log('api', 'info', message, [], {
color: 'cyan'
});
_debugLogger.debugLogger.log('api', message);
platform.log('api', message);
}
function tChannelImplToWire(names, arg, path, context) {
if (arg._object instanceof ChannelOwner && (names === '*' || names.includes(arg._object._type))) return {

View File

@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
exports.addSourceUrlToScript = addSourceUrlToScript;
exports.envObjectToArray = envObjectToArray;
exports.evaluationScript = evaluationScript;
var _fs = _interopRequireDefault(require("fs"));
var _utils = require("../utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _rtti = require("../utils/isomorphic/rtti");
/**
* Copyright 2017 Google Inc. All rights reserved.
* Modifications copyright (c) Microsoft Corporation.
@@ -36,17 +34,17 @@ function envObjectToArray(env) {
}
return result;
}
async function evaluationScript(fun, arg, addSourceUrl = true) {
async function evaluationScript(platform, fun, arg, addSourceUrl = true) {
if (typeof fun === 'function') {
const source = fun.toString();
const argString = Object.is(arg, undefined) ? 'undefined' : JSON.stringify(arg);
return `(${source})(${argString})`;
}
if (arg !== undefined) throw new Error('Cannot evaluate a string with arguments');
if ((0, _utils.isString)(fun)) return fun;
if ((0, _rtti.isString)(fun)) return fun;
if (fun.content !== undefined) return fun.content;
if (fun.path !== undefined) {
let source = await _fs.default.promises.readFile(fun.path, 'utf8');
let source = await platform.fs().promises.readFile(fun.path, 'utf8');
if (addSourceUrl) source = addSourceUrlToScript(source, fun.path);
return source;
}

View File

@@ -4,35 +4,34 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Connection = void 0;
var _eventEmitter = require("./eventEmitter");
var _android = require("./android");
var _artifact = require("./artifact");
var _browser = require("./browser");
var _browserContext = require("./browserContext");
var _browserType = require("./browserType");
var _cdpSession = require("./cdpSession");
var _channelOwner = require("./channelOwner");
var _clientInstrumentation = require("./clientInstrumentation");
var _dialog = require("./dialog");
var _electron = require("./electron");
var _elementHandle = require("./elementHandle");
var _errors = require("./errors");
var _fetch = require("./fetch");
var _frame = require("./frame");
var _jsHandle = require("./jsHandle");
var _jsonPipe = require("./jsonPipe");
var _localUtils = require("./localUtils");
var _network = require("./network");
var _page = require("./page");
var _worker = require("./worker");
var _dialog = require("./dialog");
var _errors = require("./errors");
var _cdpSession = require("./cdpSession");
var _playwright = require("./playwright");
var _electron = require("./electron");
var _stream = require("./stream");
var _writableStream = require("./writableStream");
var _debugLogger = require("../utils/debugLogger");
var _selectors = require("./selectors");
var _android = require("./android");
var _artifact = require("./artifact");
var _events = require("events");
var _jsonPipe = require("./jsonPipe");
var _fetch = require("./fetch");
var _localUtils = require("./localUtils");
var _stream = require("./stream");
var _tracing = require("./tracing");
var _worker = require("./worker");
var _writableStream = require("./writableStream");
var _validator = require("../protocol/validator");
var _clientInstrumentation = require("./clientInstrumentation");
var _utils = require("../utils");
var _stackTrace = require("../utils/isomorphic/stackTrace");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -60,9 +59,9 @@ class Root extends _channelOwner.ChannelOwner {
}
}
class DummyChannelOwner extends _channelOwner.ChannelOwner {}
class Connection extends _events.EventEmitter {
constructor(localUtils, instrumentation) {
super();
class Connection extends _eventEmitter.EventEmitter {
constructor(platform, localUtils, instrumentation, headers = []) {
super(platform);
this._objects = new Map();
this.onmessage = message => {};
this._lastId = 0;
@@ -76,9 +75,12 @@ class Connection extends _events.EventEmitter {
this.toImpl = void 0;
this._tracingCount = 0;
this._instrumentation = void 0;
// Used from @playwright/test fixtures -> TODO remove?
this.headers = void 0;
this._instrumentation = instrumentation || (0, _clientInstrumentation.createInstrumentation)();
this._localUtils = localUtils;
this._rootObject = new Root(this);
this.headers = headers;
}
markAsRemote() {
this._isRemote = true;
@@ -117,9 +119,9 @@ class Connection extends _events.EventEmitter {
method,
params
};
if (_debugLogger.debugLogger.isEnabled('channel')) {
if (this._platform.isLogEnabled('channel')) {
// Do not include metadata in debug logs to avoid noise.
_debugLogger.debugLogger.log('channel', 'SEND> ' + JSON.stringify(message));
this._platform.log('channel', 'SEND> ' + JSON.stringify(message));
}
const location = frames[0] ? {
file: frames[0].file,
@@ -132,7 +134,7 @@ class Connection extends _events.EventEmitter {
internal: !apiName,
stepId
};
if (this._tracingCount && frames && type !== 'LocalUtils') (_this$_localUtils = this._localUtils) === null || _this$_localUtils === void 0 || _this$_localUtils._channel.addStackToTracingNoReply({
if (this._tracingCount && frames && type !== 'LocalUtils') (_this$_localUtils = this._localUtils) === null || _this$_localUtils === void 0 || _this$_localUtils.addStackToTracingNoReply({
callData: {
stack: frames,
id
@@ -140,7 +142,7 @@ class Connection extends _events.EventEmitter {
}).catch(() => {});
// We need to exit zones before calling into the server, otherwise
// when we receive events from the server, we would be in an API zone.
_utils.zones.empty().run(() => this.onmessage({
this._platform.zones.empty.run(() => this.onmessage({
...message,
metadata
}));
@@ -152,6 +154,13 @@ class Connection extends _events.EventEmitter {
method
}));
}
_validatorFromWireContext() {
return {
tChannelImpl: this._tChannelImplFromWire.bind(this),
binary: this._rawBuffers ? 'buffer' : 'fromBase64',
isUnderTest: () => this._platform.isUnderTest()
};
}
dispatch(message) {
if (this._closedError) return;
const {
@@ -164,24 +173,21 @@ class Connection extends _events.EventEmitter {
log
} = message;
if (id) {
if (_debugLogger.debugLogger.isEnabled('channel')) _debugLogger.debugLogger.log('channel', '<RECV ' + JSON.stringify(message));
if (this._platform.isLogEnabled('channel')) this._platform.log('channel', '<RECV ' + JSON.stringify(message));
const callback = this._callbacks.get(id);
if (!callback) throw new Error(`Cannot find command to respond: ${id}`);
this._callbacks.delete(id);
if (error && !result) {
const parsedError = (0, _errors.parseError)(error);
(0, _utils.rewriteErrorMessage)(parsedError, parsedError.message + (0, _utils.formatCallLog)(log));
(0, _stackTrace.rewriteErrorMessage)(parsedError, parsedError.message + formatCallLog(this._platform, log));
callback.reject(parsedError);
} else {
const validator = (0, _validator.findValidator)(callback.type, callback.method, 'Result');
callback.resolve(validator(result, '', {
tChannelImpl: this._tChannelImplFromWire.bind(this),
binary: this._rawBuffers ? 'buffer' : 'fromBase64'
}));
callback.resolve(validator(result, '', this._validatorFromWireContext()));
}
return;
}
if (_debugLogger.debugLogger.isEnabled('channel')) _debugLogger.debugLogger.log('channel', '<EVENT ' + JSON.stringify(message));
if (this._platform.isLogEnabled('channel')) this._platform.log('channel', '<EVENT ' + JSON.stringify(message));
if (method === '__create__') {
this._createRemoteObject(guid, params.type, params.guid, params.initializer);
return;
@@ -199,10 +205,7 @@ class Connection extends _events.EventEmitter {
return;
}
const validator = (0, _validator.findValidator)(object._type, method, 'Event');
object._channel.emit(method, validator(params, '', {
tChannelImpl: this._tChannelImplFromWire.bind(this),
binary: this._rawBuffers ? 'buffer' : 'fromBase64'
}));
object._channel.emit(method, validator(params, '', this._validatorFromWireContext()));
}
close(cause) {
if (this._closedError) return;
@@ -225,10 +228,7 @@ class Connection extends _events.EventEmitter {
if (!parent) throw new Error(`Cannot find parent object ${parentGuid} to create ${guid}`);
let result;
const validator = (0, _validator.findValidator)(type, '', 'Initializer');
initializer = validator(initializer, '', {
tChannelImpl: this._tChannelImplFromWire.bind(this),
binary: this._rawBuffers ? 'buffer' : 'fromBase64'
});
initializer = validator(initializer, '', this._validatorFromWireContext());
switch (type) {
case 'Android':
result = new _android.Android(parent, type, guid, initializer);
@@ -330,4 +330,11 @@ class Connection extends _events.EventEmitter {
return result;
}
}
exports.Connection = Connection;
exports.Connection = Connection;
function formatCallLog(platform, log) {
if (!log || !log.some(l => !!l)) return '';
return `
Call log:
${platform.colors.dim(log.join('\n'))}
`;
}

View File

@@ -4,10 +4,8 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ConsoleMessage = void 0;
var util = _interopRequireWildcard(require("util"));
var _jsHandle = require("./jsHandle");
var _page = require("./page");
let _util$inspect$custom;
/**
* Copyright (c) Microsoft Corporation.
*
@@ -23,15 +21,14 @@ let _util$inspect$custom;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
_util$inspect$custom = util.inspect.custom;
class ConsoleMessage {
constructor(event) {
constructor(platform, event) {
this._page = void 0;
this._event = void 0;
this._page = 'page' in event && event.page ? _page.Page.from(event.page) : null;
this._event = event;
if (platform.inspectCustom) this[platform.inspectCustom] = () => this._inspect();
}
page() {
return this._page;
@@ -48,7 +45,7 @@ class ConsoleMessage {
location() {
return this._event.location;
}
[_util$inspect$custom]() {
_inspect() {
return this.text();
}
}

View File

@@ -4,16 +4,15 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ElectronApplication = exports.Electron = void 0;
var _timeoutSettings = require("../common/timeoutSettings");
var _browserContext = require("./browserContext");
var _channelOwner = require("./channelOwner");
var _clientHelper = require("./clientHelper");
var _consoleMessage = require("./consoleMessage");
var _errors = require("./errors");
var _events = require("./events");
var _jsHandle = require("./jsHandle");
var _consoleMessage = require("./consoleMessage");
var _waiter = require("./waiter");
var _errors = require("./errors");
let _Symbol$asyncDispose;
var _timeoutSettings = require("./timeoutSettings");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -29,6 +28,7 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Electron extends _channelOwner.ChannelOwner {
static from(electron) {
return electron._object;
@@ -38,8 +38,8 @@ class Electron extends _channelOwner.ChannelOwner {
}
async launch(options = {}) {
const params = {
...(await (0, _browserContext.prepareBrowserContextParams)(options)),
env: (0, _clientHelper.envObjectToArray)(options.env ? options.env : process.env),
...(await (0, _browserContext.prepareBrowserContextParams)(this._platform, options)),
env: (0, _clientHelper.envObjectToArray)(options.env ? options.env : this._platform.env),
tracesDir: options.tracesDir
};
const app = ElectronApplication.from((await this._channel.launch(params)).electronApplication);
@@ -48,7 +48,6 @@ class Electron extends _channelOwner.ChannelOwner {
}
}
exports.Electron = Electron;
_Symbol$asyncDispose = Symbol.asyncDispose;
class ElectronApplication extends _channelOwner.ChannelOwner {
static from(electronApplication) {
return electronApplication._object;
@@ -57,14 +56,15 @@ class ElectronApplication extends _channelOwner.ChannelOwner {
super(parent, type, guid, initializer);
this._context = void 0;
this._windows = new Set();
this._timeoutSettings = new _timeoutSettings.TimeoutSettings();
this._timeoutSettings = void 0;
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform);
this._context = _browserContext.BrowserContext.from(initializer.context);
for (const page of this._context._pages) this._onPage(page);
this._context.on(_events.Events.BrowserContext.Page, page => this._onPage(page));
this._channel.on('close', () => {
this.emit(_events.Events.ElectronApplication.Close);
});
this._channel.on('console', event => this.emit(_events.Events.ElectronApplication.Console, new _consoleMessage.ConsoleMessage(event)));
this._channel.on('console', event => this.emit(_events.Events.ElectronApplication.Console, new _consoleMessage.ConsoleMessage(this._platform, event)));
this._setEventToSubscriptionMapping(new Map([[_events.Events.ElectronApplication.Console, 'console']]));
}
process() {
@@ -86,7 +86,7 @@ class ElectronApplication extends _channelOwner.ChannelOwner {
context() {
return this._context;
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.close();
}
async close() {

View File

@@ -9,15 +9,11 @@ exports.convertSelectOptionValues = convertSelectOptionValues;
exports.determineScreenshotType = determineScreenshotType;
var _frame = require("./frame");
var _jsHandle = require("./jsHandle");
var _fs = _interopRequireDefault(require("fs"));
var _utilsBundle = require("../utilsBundle");
var _path = _interopRequireDefault(require("path"));
var _utils = require("../utils");
var _fileUtils = require("../utils/fileUtils");
var _assert = require("../utils/isomorphic/assert");
var _fileUtils = require("./fileUtils");
var _rtti = require("../utils/isomorphic/rtti");
var _writableStream = require("./writableStream");
var _stream = require("stream");
var _util = require("util");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _mimeType = require("../utils/isomorphic/mimeType");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -34,7 +30,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
* limitations under the License.
*/
const pipelineAsync = (0, _util.promisify)(_stream.pipeline);
class ElementHandle extends _jsHandle.JSHandle {
static from(handle) {
return handle._object;
@@ -56,6 +51,10 @@ class ElementHandle extends _jsHandle.JSHandle {
async contentFrame() {
return _frame.Frame.fromNullable((await this._elementChannel.contentFrame()).frame);
}
async _generateLocatorString() {
const value = (await this._elementChannel.generateLocatorString()).value;
return value === undefined ? null : value;
}
async getAttribute(name) {
const value = (await this._elementChannel.getAttribute({
name
@@ -133,7 +132,7 @@ class ElementHandle extends _jsHandle.JSHandle {
async setInputFiles(files, options = {}) {
const frame = await this.ownerFrame();
if (!frame) throw new Error('Cannot set input files to detached element');
const converted = await convertInputFiles(files, frame.page().context());
const converted = await convertInputFiles(this._platform, files, frame.page().context());
await this._elementChannel.setInputFiles({
...converted,
...options
@@ -168,21 +167,22 @@ class ElementHandle extends _jsHandle.JSHandle {
return value === undefined ? null : value;
}
async screenshot(options = {}) {
const mask = options.mask;
const copy = {
...options,
mask: undefined
};
if (!copy.type) copy.type = determineScreenshotType(options);
if (options.mask) {
copy.mask = options.mask.map(locator => ({
if (mask) {
copy.mask = mask.map(locator => ({
frame: locator._frame._channel,
selector: locator._selector
}));
}
const result = await this._elementChannel.screenshot(copy);
if (options.path) {
await (0, _fileUtils.mkdirIfNeeded)(options.path);
await _fs.default.promises.writeFile(options.path, result.binary);
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
await this._platform.fs().promises.writeFile(options.path, result.binary);
}
return result.binary;
}
@@ -234,11 +234,11 @@ function convertSelectOptionValues(values) {
if (values === null) return {};
if (!Array.isArray(values)) values = [values];
if (!values.length) return {};
for (let i = 0; i < values.length; i++) (0, _utils.assert)(values[i] !== null, `options[${i}]: expected object, got null`);
for (let i = 0; i < values.length; i++) (0, _assert.assert)(values[i] !== null, `options[${i}]: expected object, got null`);
if (values[0] instanceof ElementHandle) return {
elements: values.map(v => v._elementChannel)
};
if ((0, _utils.isString)(values[0])) return {
if ((0, _rtti.isString)(values[0])) return {
options: values.map(valueOrLabel => ({
valueOrLabel
}))
@@ -250,50 +250,49 @@ function convertSelectOptionValues(values) {
function filePayloadExceedsSizeLimit(payloads) {
return payloads.reduce((size, item) => size + (item.buffer ? item.buffer.byteLength : 0), 0) >= _fileUtils.fileUploadSizeLimit;
}
async function resolvePathsAndDirectoryForInputFiles(items) {
var _localPaths2;
async function resolvePathsAndDirectoryForInputFiles(platform, items) {
var _localPaths;
let localPaths;
let localDirectory;
for (const item of items) {
const stat = await _fs.default.promises.stat(item);
const stat = await platform.fs().promises.stat(item);
if (stat.isDirectory()) {
if (localDirectory) throw new Error('Multiple directories are not supported');
localDirectory = _path.default.resolve(item);
localDirectory = platform.path().resolve(item);
} else {
var _localPaths;
(_localPaths = localPaths) !== null && _localPaths !== void 0 ? _localPaths : localPaths = [];
localPaths.push(_path.default.resolve(item));
localPaths !== null && localPaths !== void 0 ? localPaths : localPaths = [];
localPaths.push(platform.path().resolve(item));
}
}
if ((_localPaths2 = localPaths) !== null && _localPaths2 !== void 0 && _localPaths2.length && localDirectory) throw new Error('File paths must be all files or a single directory');
if ((_localPaths = localPaths) !== null && _localPaths !== void 0 && _localPaths.length && localDirectory) throw new Error('File paths must be all files or a single directory');
return [localPaths, localDirectory];
}
async function convertInputFiles(files, context) {
async function convertInputFiles(platform, files, context) {
const items = Array.isArray(files) ? files.slice() : [files];
if (items.some(item => typeof item === 'string')) {
if (!items.every(item => typeof item === 'string')) throw new Error('File paths cannot be mixed with buffers');
const [localPaths, localDirectory] = await resolvePathsAndDirectoryForInputFiles(items);
const [localPaths, localDirectory] = await resolvePathsAndDirectoryForInputFiles(platform, items);
if (context._connection.isRemote()) {
const files = localDirectory ? (await _fs.default.promises.readdir(localDirectory, {
const files = localDirectory ? (await platform.fs().promises.readdir(localDirectory, {
withFileTypes: true,
recursive: true
})).filter(f => f.isFile()).map(f => _path.default.join(f.path, f.name)) : localPaths;
})).filter(f => f.isFile()).map(f => platform.path().join(f.path, f.name)) : localPaths;
const {
writableStreams,
rootDir
} = await context._wrapApiCall(async () => context._channel.createTempFiles({
rootDirName: localDirectory ? _path.default.basename(localDirectory) : undefined,
rootDirName: localDirectory ? platform.path().basename(localDirectory) : undefined,
items: await Promise.all(files.map(async file => {
const lastModifiedMs = (await _fs.default.promises.stat(file)).mtimeMs;
const lastModifiedMs = (await platform.fs().promises.stat(file)).mtimeMs;
return {
name: localDirectory ? _path.default.relative(localDirectory, file) : _path.default.basename(file),
name: localDirectory ? platform.path().relative(localDirectory, file) : platform.path().basename(file),
lastModifiedMs
};
}))
}), true);
for (let i = 0; i < files.length; i++) {
const writable = _writableStream.WritableStream.from(writableStreams[i]);
await pipelineAsync(_fs.default.createReadStream(files[i]), writable.stream());
await platform.streamFile(files[i], writable.stream());
}
return {
directoryStream: rootDir,
@@ -313,7 +312,7 @@ async function convertInputFiles(files, context) {
}
function determineScreenshotType(options) {
if (options.path) {
const mimeType = _utilsBundle.mime.getType(options.path);
const mimeType = (0, _mimeType.getMimeTypeForPath)(options.path);
if (mimeType === 'image/png') return 'png';else if (mimeType === 'image/jpeg') return 'jpeg';
throw new Error(`path: unsupported mime type "${mimeType}"`);
}

View File

@@ -7,8 +7,8 @@ exports.TimeoutError = exports.TargetClosedError = void 0;
exports.isTargetClosedError = isTargetClosedError;
exports.parseError = parseError;
exports.serializeError = serializeError;
var _utils = require("../utils");
var _serializers = require("../protocol/serializers");
var _rtti = require("../utils/isomorphic/rtti");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -42,7 +42,7 @@ function isTargetClosedError(error) {
return error instanceof TargetClosedError;
}
function serializeError(e) {
if ((0, _utils.isError)(e)) return {
if ((0, _rtti.isError)(e)) return {
error: {
message: e.message,
stack: e.stack,

View File

@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.EventEmitter = void 0;
var _events = require("events");
var _utils = require("../utils");
/**
* Copyright Joyent, Inc. and other Node contributors.
* Modifications copyright (c) Microsoft Corporation.
@@ -31,12 +29,14 @@ var _utils = require("../utils");
*/
class EventEmitter {
constructor() {
constructor(platform) {
this._events = undefined;
this._eventsCount = 0;
this._maxListeners = undefined;
this._pendingHandlers = new Map();
this._rejectionHandler = void 0;
this._platform = void 0;
this._platform = platform;
if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) {
this._events = Object.create(null);
this._eventsCount = 0;
@@ -51,7 +51,7 @@ class EventEmitter {
return this;
}
getMaxListeners() {
return this._maxListeners === undefined ? _events.EventEmitter.defaultMaxListeners : this._maxListeners;
return this._maxListeners === undefined ? this._platform.defaultMaxListeners() : this._maxListeners;
}
emit(type, ...args) {
const events = this._events;
@@ -130,7 +130,7 @@ class EventEmitter {
w.emitter = this;
w.type = type;
w.count = existing.length;
if (!(0, _utils.isUnderTest)()) {
if (!this._platform.isUnderTest()) {
// eslint-disable-next-line no-console
console.warn(w);
}
@@ -191,14 +191,11 @@ class EventEmitter {
if (options.behavior === 'wait') {
const errors = [];
this._rejectionHandler = error => errors.push(error);
// eslint-disable-next-line internal-playwright/await-promise-in-class-returns
return this._waitFor(type).then(() => {
if (errors.length) throw errors[0];
});
}
if (options.behavior === 'ignoreErrors') this._rejectionHandler = () => {};
// eslint-disable-next-line internal-playwright/await-promise-in-class-returns
return Promise.resolve();
}
_removeAllListeners(type) {

View File

@@ -4,17 +4,15 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.APIResponse = exports.APIRequestContext = exports.APIRequest = void 0;
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var util = _interopRequireWildcard(require("util"));
var _utils = require("../utils");
var _fileUtils = require("../utils/fileUtils");
var _browserContext = require("./browserContext");
var _channelOwner = require("./channelOwner");
var _errors = require("./errors");
var _network = require("./network");
var _tracing = require("./tracing");
var _errors = require("./errors");
var _browserContext = require("./browserContext");
let _Symbol$asyncDispose, _Symbol$asyncDispose2, _util$inspect$custom;
var _assert = require("../utils/isomorphic/assert");
var _fileUtils = require("./fileUtils");
var _headers = require("../utils/isomorphic/headers");
var _rtti = require("../utils/isomorphic/rtti");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -30,42 +28,37 @@ let _Symbol$asyncDispose, _Symbol$asyncDispose2, _util$inspect$custom;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class APIRequest {
constructor(playwright) {
this._playwright = void 0;
this._contexts = new Set();
// Instrumentation.
this._defaultContextOptions = void 0;
this._playwright = playwright;
}
async newContext(options = {}) {
var _this$_defaultContext;
var _this$_playwright$_de, _this$_playwright$_de2;
options = {
...this._defaultContextOptions,
...this._playwright._defaultContextOptions,
timeout: this._playwright._defaultContextTimeout,
...options
};
const storageState = typeof options.storageState === 'string' ? JSON.parse(await _fs.default.promises.readFile(options.storageState, 'utf8')) : options.storageState;
// We do not expose tracesDir in the API, so do not allow options to accidentally override it.
const tracesDir = (_this$_defaultContext = this._defaultContextOptions) === null || _this$_defaultContext === void 0 ? void 0 : _this$_defaultContext.tracesDir;
const storageState = typeof options.storageState === 'string' ? JSON.parse(await this._playwright._platform.fs().promises.readFile(options.storageState, 'utf8')) : options.storageState;
const context = APIRequestContext.from((await this._playwright._channel.newRequest({
...options,
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _utils.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _headers.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
storageState,
tracesDir,
clientCertificates: await (0, _browserContext.toClientCertificatesProtocol)(options.clientCertificates)
tracesDir: (_this$_playwright$_de = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de === void 0 ? void 0 : _this$_playwright$_de.tracesDir,
// We do not expose tracesDir in the API, so do not allow options to accidentally override it.
clientCertificates: await (0, _browserContext.toClientCertificatesProtocol)(this._playwright._platform, options.clientCertificates)
})).request);
this._contexts.add(context);
context._request = this;
context._tracing._tracesDir = tracesDir;
context._tracing._tracesDir = (_this$_playwright$_de2 = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de2 === void 0 ? void 0 : _this$_playwright$_de2.tracesDir;
await context._instrumentation.runAfterCreateRequestContext(context);
return context;
}
}
exports.APIRequest = APIRequest;
_Symbol$asyncDispose = Symbol.asyncDispose;
class APIRequestContext extends _channelOwner.ChannelOwner {
static from(channel) {
return channel._object;
@@ -77,7 +70,7 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
this._closeReason = void 0;
this._tracing = _tracing.Tracing.from(initializer.tracing);
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.dispose();
}
async dispose(options = {}) {
@@ -130,8 +123,8 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
});
}
async fetch(urlOrRequest, options = {}) {
const url = (0, _utils.isString)(urlOrRequest) ? urlOrRequest : undefined;
const request = (0, _utils.isString)(urlOrRequest) ? undefined : urlOrRequest;
const url = (0, _rtti.isString)(urlOrRequest) ? urlOrRequest : undefined;
const request = (0, _rtti.isString)(urlOrRequest) ? undefined : urlOrRequest;
return await this._innerFetch({
url,
request,
@@ -142,23 +135,23 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
return await this._wrapApiCall(async () => {
var _options$request, _options$request2, _options$request3;
if (this._closeReason) throw new _errors.TargetClosedError(this._closeReason);
(0, _utils.assert)(options.request || typeof options.url === 'string', 'First argument must be either URL string or Request');
(0, _utils.assert)((options.data === undefined ? 0 : 1) + (options.form === undefined ? 0 : 1) + (options.multipart === undefined ? 0 : 1) <= 1, `Only one of 'data', 'form' or 'multipart' can be specified`);
(0, _utils.assert)(options.maxRedirects === undefined || options.maxRedirects >= 0, `'maxRedirects' must be greater than or equal to '0'`);
(0, _utils.assert)(options.maxRetries === undefined || options.maxRetries >= 0, `'maxRetries' must be greater than or equal to '0'`);
(0, _assert.assert)(options.request || typeof options.url === 'string', 'First argument must be either URL string or Request');
(0, _assert.assert)((options.data === undefined ? 0 : 1) + (options.form === undefined ? 0 : 1) + (options.multipart === undefined ? 0 : 1) <= 1, `Only one of 'data', 'form' or 'multipart' can be specified`);
(0, _assert.assert)(options.maxRedirects === undefined || options.maxRedirects >= 0, `'maxRedirects' must be greater than or equal to '0'`);
(0, _assert.assert)(options.maxRetries === undefined || options.maxRetries >= 0, `'maxRetries' must be greater than or equal to '0'`);
const url = options.url !== undefined ? options.url : options.request.url();
const method = options.method || ((_options$request = options.request) === null || _options$request === void 0 ? void 0 : _options$request.method());
let encodedParams = undefined;
if (typeof options.params === 'string') encodedParams = options.params;else if (options.params instanceof URLSearchParams) encodedParams = options.params.toString();
// Cannot call allHeaders() here as the request may be paused inside route handler.
const headersObj = options.headers || ((_options$request2 = options.request) === null || _options$request2 === void 0 ? void 0 : _options$request2.headers());
const headers = headersObj ? (0, _utils.headersObjectToArray)(headersObj) : undefined;
const headers = headersObj ? (0, _headers.headersObjectToArray)(headersObj) : undefined;
let jsonData;
let formData;
let multipartData;
let postDataBuffer;
if (options.data !== undefined) {
if ((0, _utils.isString)(options.data)) {
if ((0, _rtti.isString)(options.data)) {
if (isJsonContentType(headers)) jsonData = isJsonParsable(options.data) ? options.data : JSON.stringify(options.data);else postDataBuffer = Buffer.from(options.data, 'utf8');
} else if (Buffer.isBuffer(options.data)) {
postDataBuffer = options.data;
@@ -185,7 +178,7 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
if (globalThis.FormData && options.multipart instanceof FormData) {
const form = options.multipart;
for (const [name, value] of form.entries()) {
if ((0, _utils.isString)(value)) {
if ((0, _rtti.isString)(value)) {
multipartData.push({
name,
value
@@ -204,7 +197,7 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
}
} else {
// Convert file-like values to ServerFilePayload structs.
for (const [name, value] of Object.entries(options.multipart)) multipartData.push(await toFormField(name, value));
for (const [name, value] of Object.entries(options.multipart)) multipartData.push(await toFormField(this._platform, name, value));
}
}
if (postDataBuffer === undefined && jsonData === undefined && formData === undefined && multipartData === undefined) postDataBuffer = ((_options$request3 = options.request) === null || _options$request3 === void 0 ? void 0 : _options$request3.postDataBuffer()) || undefined;
@@ -232,16 +225,19 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
});
}
async storageState(options = {}) {
const state = await this._channel.storageState();
const state = await this._channel.storageState({
indexedDB: options.indexedDB
});
if (options.path) {
await (0, _fileUtils.mkdirIfNeeded)(options.path);
await _fs.default.promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
await this._platform.fs().promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
}
return state;
}
}
exports.APIRequestContext = APIRequestContext;
async function toFormField(name, value) {
async function toFormField(platform, name, value) {
const typeOfValue = typeof value;
if (isFilePayload(value)) {
const payload = value;
if (!Buffer.isBuffer(payload.buffer)) throw new Error(`Unexpected buffer type of 'data.${name}'`);
@@ -249,15 +245,15 @@ async function toFormField(name, value) {
name,
file: filePayloadToJson(payload)
};
} else if (value instanceof _fs.default.ReadStream) {
} else if (typeOfValue === 'string' || typeOfValue === 'number' || typeOfValue === 'boolean') {
return {
name,
file: await readStreamToJson(value)
value: String(value)
};
} else {
return {
name,
value: String(value)
file: await readStreamToJson(platform, value)
};
}
}
@@ -270,8 +266,6 @@ function isJsonParsable(value) {
if (e instanceof SyntaxError) return false;else throw e;
}
}
_Symbol$asyncDispose2 = Symbol.asyncDispose;
_util$inspect$custom = util.inspect.custom;
class APIResponse {
constructor(context, initializer) {
this._initializer = void 0;
@@ -280,6 +274,7 @@ class APIResponse {
this._request = context;
this._initializer = initializer;
this._headers = new _network.RawHeaders(this._initializer.headers);
if (context._platform.inspectCustom) this[context._platform.inspectCustom] = () => this._inspect();
}
ok() {
return this._initializer.status >= 200 && this._initializer.status <= 299;
@@ -300,16 +295,18 @@ class APIResponse {
return this._headers.headersArray();
}
async body() {
try {
const result = await this._request._channel.fetchResponseBody({
fetchUid: this._fetchUid()
});
if (result.binary === undefined) throw new Error('Response has been disposed');
return result.binary;
} catch (e) {
if ((0, _errors.isTargetClosedError)(e)) throw new Error('Response has been disposed');
throw e;
}
return await this._request._wrapApiCall(async () => {
try {
const result = await this._request._channel.fetchResponseBody({
fetchUid: this._fetchUid()
});
if (result.binary === undefined) throw new Error('Response has been disposed');
return result.binary;
} catch (e) {
if ((0, _errors.isTargetClosedError)(e)) throw new Error('Response has been disposed');
throw e;
}
}, true);
}
async text() {
const content = await this.body();
@@ -319,7 +316,7 @@ class APIResponse {
const content = await this.text();
return JSON.parse(content);
}
async [_Symbol$asyncDispose2]() {
async [Symbol.asyncDispose]() {
await this.dispose();
}
async dispose() {
@@ -327,7 +324,7 @@ class APIResponse {
fetchUid: this._fetchUid()
});
}
[_util$inspect$custom]() {
_inspect() {
const headers = this.headersArray().map(({
name,
value
@@ -354,7 +351,7 @@ function filePayloadToJson(payload) {
buffer: payload.buffer
};
}
async function readStreamToJson(stream) {
async function readStreamToJson(platform, stream) {
const buffer = await new Promise((resolve, reject) => {
const chunks = [];
stream.on('data', chunk => chunks.push(chunk));
@@ -363,7 +360,7 @@ async function readStreamToJson(stream) {
});
const streamPath = Buffer.isBuffer(stream.path) ? stream.path.toString('utf8') : stream.path;
return {
name: _path.default.basename(streamPath),
name: platform.path().basename(streamPath),
buffer
};
}
@@ -380,10 +377,12 @@ function isJsonContentType(headers) {
function objectToArray(map) {
if (!map) return undefined;
const result = [];
for (const [name, value] of Object.entries(map)) result.push({
name,
value: String(value)
});
for (const [name, value] of Object.entries(map)) {
if (value !== undefined) result.push({
name,
value: String(value)
});
}
return result;
}
function isFilePayload(value) {

View File

@@ -5,22 +5,21 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Frame = void 0;
exports.verifyLoadState = verifyLoadState;
var _utils = require("../utils");
var _eventEmitter = require("./eventEmitter");
var _channelOwner = require("./channelOwner");
var _locator = require("./locator");
var _locatorUtils = require("../utils/isomorphic/locatorUtils");
var _elementHandle = require("./elementHandle");
var _jsHandle = require("./jsHandle");
var _fs = _interopRequireDefault(require("fs"));
var network = _interopRequireWildcard(require("./network"));
var _events = require("events");
var _waiter = require("./waiter");
var _events2 = require("./events");
var _types = require("./types");
var _clientHelper = require("./clientHelper");
var _elementHandle = require("./elementHandle");
var _events = require("./events");
var _jsHandle = require("./jsHandle");
var _locator = require("./locator");
var network = _interopRequireWildcard(require("./network"));
var _types = require("./types");
var _waiter = require("./waiter");
var _assert = require("../utils/isomorphic/assert");
var _locatorUtils = require("../utils/isomorphic/locatorUtils");
var _urlMatch = require("../utils/isomorphic/urlMatch");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
/**
* Copyright 2017 Google Inc. All rights reserved.
* Modifications copyright (c) Microsoft Corporation.
@@ -55,7 +54,7 @@ class Frame extends _channelOwner.ChannelOwner {
this._detached = false;
this._childFrames = new Set();
this._page = void 0;
this._eventEmitter = new _events.EventEmitter();
this._eventEmitter = new _eventEmitter.EventEmitter(parent._platform);
this._eventEmitter.setMaxListeners(0);
this._parentFrame = Frame.fromNullable(initializer.parentFrame);
if (this._parentFrame) this._parentFrame._childFrames.add(this);
@@ -68,14 +67,14 @@ class Frame extends _channelOwner.ChannelOwner {
this._eventEmitter.emit('loadstate', event.add);
}
if (event.remove) this._loadStates.delete(event.remove);
if (!this._parentFrame && event.add === 'load' && this._page) this._page.emit(_events2.Events.Page.Load, this._page);
if (!this._parentFrame && event.add === 'domcontentloaded' && this._page) this._page.emit(_events2.Events.Page.DOMContentLoaded, this._page);
if (!this._parentFrame && event.add === 'load' && this._page) this._page.emit(_events.Events.Page.Load, this._page);
if (!this._parentFrame && event.add === 'domcontentloaded' && this._page) this._page.emit(_events.Events.Page.DOMContentLoaded, this._page);
});
this._channel.on('navigated', event => {
this._url = event.url;
this._name = event.name;
this._eventEmitter.emit('navigated', event);
if (!event.error && this._page) this._page.emit(_events2.Events.Page.FrameNavigated, this);
if (!event.error && this._page) this._page.emit(_events.Events.Page.FrameNavigated, this);
});
}
page() {
@@ -92,9 +91,9 @@ class Frame extends _channelOwner.ChannelOwner {
_setupNavigationWaiter(options) {
const waiter = new _waiter.Waiter(this._page, '');
if (this._page.isClosed()) waiter.rejectImmediately(this._page._closeErrorWithReason());
waiter.rejectOnEvent(this._page, _events2.Events.Page.Close, () => this._page._closeErrorWithReason());
waiter.rejectOnEvent(this._page, _events2.Events.Page.Crash, new Error('Navigation failed because page crashed!'));
waiter.rejectOnEvent(this._page, _events2.Events.Page.FrameDetached, new Error('Navigating frame was detached!'), frame => frame === this);
waiter.rejectOnEvent(this._page, _events.Events.Page.Close, () => this._page._closeErrorWithReason());
waiter.rejectOnEvent(this._page, _events.Events.Page.Crash, new Error('Navigation failed because page crashed!'));
waiter.rejectOnEvent(this._page, _events.Events.Page.FrameDetached, new Error('Navigating frame was detached!'), frame => frame === this);
const timeout = this._page._timeoutSettings.navigationTimeout(options);
waiter.rejectOnTimeout(timeout, `Timeout ${timeout}ms exceeded.`);
return waiter;
@@ -110,7 +109,7 @@ class Frame extends _channelOwner.ChannelOwner {
// Any failed navigation results in a rejection.
if (event.error) return true;
waiter.log(` navigated to "${event.url}"`);
return (0, _utils.urlMatches)((_this$_page = this._page) === null || _this$_page === void 0 ? void 0 : _this$_page.context()._options.baseURL, event.url, options.url);
return (0, _urlMatch.urlMatches)((_this$_page = this._page) === null || _this$_page === void 0 ? void 0 : _this$_page.context()._options.baseURL, event.url, options.url);
});
if (navigatedEvent.error) {
const e = new Error(navigatedEvent.error);
@@ -146,7 +145,7 @@ class Frame extends _channelOwner.ChannelOwner {
}
async waitForURL(url, options = {}) {
var _this$_page2;
if ((0, _utils.urlMatches)((_this$_page2 = this._page) === null || _this$_page2 === void 0 ? void 0 : _this$_page2.context()._options.baseURL, this.url(), url)) return await this.waitForLoadState(options.waitUntil, options);
if ((0, _urlMatch.urlMatches)((_this$_page2 = this._page) === null || _this$_page2 === void 0 ? void 0 : _this$_page2.context()._options.baseURL, this.url(), url)) return await this.waitForLoadState(options.waitUntil, options);
await this.waitForNavigation({
url,
...options
@@ -268,7 +267,7 @@ class Frame extends _channelOwner.ChannelOwner {
...options
};
if (copy.path) {
copy.content = (await _fs.default.promises.readFile(copy.path)).toString();
copy.content = (await this._platform.fs().promises.readFile(copy.path)).toString();
copy.content = (0, _clientHelper.addSourceUrlToScript)(copy.content, copy.path);
}
return _elementHandle.ElementHandle.from((await this._channel.addScriptTag({
@@ -280,7 +279,7 @@ class Frame extends _channelOwner.ChannelOwner {
...options
};
if (copy.path) {
copy.content = (await _fs.default.promises.readFile(copy.path)).toString();
copy.content = (await this._platform.fs().promises.readFile(copy.path)).toString();
copy.content += '/*# sourceURL=' + copy.path.replace(/\n/g, '') + '*/';
}
return _elementHandle.ElementHandle.from((await this._channel.addStyleTag({
@@ -440,7 +439,7 @@ class Frame extends _channelOwner.ChannelOwner {
})).values;
}
async setInputFiles(selector, files, options = {}) {
const converted = await (0, _elementHandle.convertInputFiles)(files, this.page().context());
const converted = await (0, _elementHandle.convertInputFiles)(this._platform, files, this.page().context());
await this._channel.setInputFiles({
selector,
...converted,
@@ -482,7 +481,7 @@ class Frame extends _channelOwner.ChannelOwner {
});
}
async waitForFunction(pageFunction, arg, options = {}) {
if (typeof options.polling === 'string') (0, _utils.assert)(options.polling === 'raf', 'Unknown polling option: ' + options.polling);
if (typeof options.polling === 'string') (0, _assert.assert)(options.polling === 'raf', 'Unknown polling option: ' + options.polling);
const result = await this._channel.waitForFunction({
...options,
pollingInterval: options.polling === 'raf' ? undefined : options.polling,

View File

@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.HarRouter = void 0;
var _debugLogger = require("../utils/debugLogger");
let _Symbol$asyncDispose;
/**
* Copyright (c) Microsoft Corporation.
*
@@ -21,13 +19,13 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
_Symbol$asyncDispose = Symbol.asyncDispose;
class HarRouter {
static async create(localUtils, file, notFoundAction, options) {
const {
harId,
error
} = await localUtils._channel.harOpen({
} = await localUtils.harOpen({
file
});
if (error) throw new Error(error);
@@ -45,7 +43,7 @@ class HarRouter {
}
async _handle(route) {
const request = route.request();
const response = await this._localUtils._channel.harLookup({
const response = await this._localUtils.harLookup({
harId: this._harId,
url: request.url(),
method: request.method(),
@@ -54,7 +52,7 @@ class HarRouter {
isNavigationRequest: request.isNavigationRequest()
});
if (response.action === 'redirect') {
_debugLogger.debugLogger.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);
route._platform.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);
await route._redirectNavigationRequest(response.redirectURL);
return;
}
@@ -72,7 +70,7 @@ class HarRouter {
});
return;
}
if (response.action === 'error') _debugLogger.debugLogger.log('api', 'HAR: ' + response.message);
if (response.action === 'error') route._platform.log('api', 'HAR: ' + response.message);
// Report the error, but fall through to the default handler.
if (this._notFoundAction === 'abort') {
@@ -87,11 +85,11 @@ class HarRouter {
async addPageRoute(page) {
await page.route(this._options.urlMatch || '**/*', route => this._handle(route));
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.dispose();
}
dispose() {
this._localUtils._channel.harClose({
this._localUtils.harClose({
harId: this._harId
}).catch(() => {});
}

View File

@@ -8,9 +8,8 @@ exports.assertMaxArguments = assertMaxArguments;
exports.parseResult = parseResult;
exports.serializeArgument = serializeArgument;
var _channelOwner = require("./channelOwner");
var _serializers = require("../protocol/serializers");
var _errors = require("./errors");
let _Symbol$asyncDispose;
var _serializers = require("../protocol/serializers");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -26,7 +25,7 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
_Symbol$asyncDispose = Symbol.asyncDispose;
class JSHandle extends _channelOwner.ChannelOwner {
static from(handle) {
return handle._object;
@@ -75,7 +74,7 @@ class JSHandle extends _channelOwner.ChannelOwner {
asElement() {
return null;
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.dispose();
}
async dispose() {

View File

@@ -32,5 +32,29 @@ class LocalUtils extends _channelOwner.ChannelOwner {
descriptor
} of initializer.deviceDescriptors) this.devices[name] = descriptor;
}
async zip(params) {
return await this._channel.zip(params);
}
async harOpen(params) {
return await this._channel.harOpen(params);
}
async harLookup(params) {
return await this._channel.harLookup(params);
}
async harClose(params) {
return await this._channel.harClose(params);
}
async harUnzip(params) {
return await this._channel.harUnzip(params);
}
async tracingStarted(params) {
return await this._channel.tracingStarted(params);
}
async traceDiscarded(params) {
return await this._channel.traceDiscarded(params);
}
async addStackToTracingNoReply(params) {
return await this._channel.addStackToTracingNoReply(params);
}
}
exports.LocalUtils = LocalUtils;

View File

@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
exports.Locator = exports.FrameLocator = void 0;
exports.setTestIdAttribute = setTestIdAttribute;
exports.testIdAttributeName = testIdAttributeName;
var util = _interopRequireWildcard(require("util"));
var _utils = require("../utils");
var _elementHandle = require("./elementHandle");
var _jsHandle = require("./jsHandle");
var _stringUtils = require("../utils/isomorphic/stringUtils");
var _locatorGenerators = require("../utils/isomorphic/locatorGenerators");
var _locatorUtils = require("../utils/isomorphic/locatorUtils");
let _util$inspect$custom;
var _stringUtils = require("../utils/isomorphic/stringUtils");
var _rtti = require("../utils/isomorphic/rtti");
var _time = require("../utils/isomorphic/time");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -28,9 +28,7 @@ let _util$inspect$custom;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
_util$inspect$custom = util.inspect.custom;
class Locator {
constructor(frame, selector, options) {
this._frame = void 0;
@@ -49,12 +47,14 @@ class Locator {
if (locator._frame !== frame) throw new Error(`Inner "hasNot" locator must belong to the same frame.`);
this._selector += ` >> internal:has-not=` + JSON.stringify(locator._selector);
}
if ((options === null || options === void 0 ? void 0 : options.visible) !== undefined) this._selector += ` >> visible=${options.visible ? 'true' : 'false'}`;
if (this._frame._platform.inspectCustom) this[this._frame._platform.inspectCustom] = () => this._inspect();
}
async _withElement(task, timeout) {
timeout = this._frame.page()._timeoutSettings.timeout({
timeout
});
const deadline = timeout ? (0, _utils.monotonicTime)() + timeout : 0;
const deadline = timeout ? (0, _time.monotonicTime)() + timeout : 0;
return await this._frame._wrapApiCall(async () => {
const result = await this._frame._channel.waitForSelector({
selector: this._selector,
@@ -65,7 +65,7 @@ class Locator {
const handle = _elementHandle.ElementHandle.fromNullable(result.element);
if (!handle) throw new Error(`Could not resolve ${this._selector} to DOM Element`);
try {
return await task(handle, deadline ? deadline - (0, _utils.monotonicTime)() : 0);
return await task(handle, deadline ? deadline - (0, _time.monotonicTime)() : 0);
} finally {
await handle.dispose();
}
@@ -136,7 +136,7 @@ class Locator {
return await this._frame._highlight(this._selector);
}
locator(selectorOrLocator, options) {
if ((0, _utils.isString)(selectorOrLocator)) return new Locator(this._frame, this._selector + ' >> ' + selectorOrLocator, options);
if ((0, _rtti.isString)(selectorOrLocator)) return new Locator(this._frame, this._selector + ' >> ' + selectorOrLocator, options);
if (selectorOrLocator._frame !== this._frame) throw new Error(`Locators must belong to the same frame.`);
return new Locator(this._frame, this._selector + ' >> internal:chain=' + JSON.stringify(selectorOrLocator._selector), options);
}
@@ -213,6 +213,9 @@ class Locator {
async count() {
return await this._frame._queryCount(this._selector);
}
async _generateLocatorString() {
return await this._withElement(h => h._generateLocatorString());
}
async getAttribute(name, options) {
return await this._frame.getAttribute(this._selector, name, {
strict: true,
@@ -286,14 +289,18 @@ class Locator {
});
}
async screenshot(options = {}) {
const mask = options.mask;
return await this._withElement((h, timeout) => h.screenshot({
...options,
mask,
timeout
}), options.timeout);
}
async ariaSnapshot(options) {
const result = await this._frame._channel.ariaSnapshot({
...options,
id: options === null || options === void 0 ? void 0 : options._id,
mode: options === null || options === void 0 ? void 0 : options._mode,
selector: this._selector
});
return result.snapshot;
@@ -381,11 +388,11 @@ class Locator {
if (result.received !== undefined) result.received = (0, _jsHandle.parseResult)(result.received);
return result;
}
[_util$inspect$custom]() {
_inspect() {
return this.toString();
}
toString() {
return (0, _utils.asLocator)('javascript', this._selector);
return (0, _locatorGenerators.asLocator)('javascript', this._selector);
}
}
exports.Locator = Locator;
@@ -397,7 +404,7 @@ class FrameLocator {
this._frameSelector = selector;
}
locator(selectorOrLocator, options) {
if ((0, _utils.isString)(selectorOrLocator)) return new Locator(this._frame, this._frameSelector + ' >> internal:control=enter-frame >> ' + selectorOrLocator, options);
if ((0, _rtti.isString)(selectorOrLocator)) return new Locator(this._frame, this._frameSelector + ' >> internal:control=enter-frame >> ' + selectorOrLocator, options);
if (selectorOrLocator._frame !== this._frame) throw new Error(`Locators must belong to the same frame.`);
return new Locator(this._frame, this._frameSelector + ' >> internal:control=enter-frame >> ' + selectorOrLocator._selector, options);
}

View File

@@ -5,19 +5,21 @@ Object.defineProperty(exports, "__esModule", {
});
exports.WebSocketRouteHandler = exports.WebSocketRoute = exports.WebSocket = exports.RouteHandler = exports.Route = exports.Response = exports.Request = exports.RawHeaders = void 0;
exports.validateHeaders = validateHeaders;
var _url = require("url");
var _channelOwner = require("./channelOwner");
var _frame = require("./frame");
var _worker = require("./worker");
var _fs = _interopRequireDefault(require("fs"));
var _utilsBundle = require("../utilsBundle");
var _utils = require("../utils");
var _manualPromise = require("../utils/manualPromise");
var _events = require("./events");
var _waiter = require("./waiter");
var _fetch = require("./fetch");
var _errors = require("./errors");
let _Symbol$asyncDispose;
var _events = require("./events");
var _fetch = require("./fetch");
var _frame = require("./frame");
var _waiter = require("./waiter");
var _worker = require("./worker");
var _assert = require("../utils/isomorphic/assert");
var _headers = require("../utils/isomorphic/headers");
var _urlMatch = require("../utils/isomorphic/urlMatch");
var _manualPromise = require("../utils/isomorphic/manualPromise");
var _multimap = require("../utils/isomorphic/multimap");
var _rtti = require("../utils/isomorphic/rtti");
var _stackTrace = require("../utils/isomorphic/stackTrace");
var _mimeType = require("../utils/isomorphic/mimeType");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -33,7 +35,7 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Request extends _channelOwner.ChannelOwner {
static from(request) {
return request._object;
@@ -88,7 +90,7 @@ class Request extends _channelOwner.ChannelOwner {
const contentType = this.headers()['content-type'];
if (contentType !== null && contentType !== void 0 && contentType.includes('application/x-www-form-urlencoded')) {
const entries = {};
const parsed = new _url.URLSearchParams(postData);
const parsed = new URLSearchParams(postData);
for (const [k, v] of parsed.entries()) entries[k] = v;
return entries;
}
@@ -134,7 +136,7 @@ class Request extends _channelOwner.ChannelOwner {
}
frame() {
if (!this._initializer.frame) {
(0, _utils.assert)(this.serviceWorker());
(0, _assert.assert)(this.serviceWorker());
throw new Error('Service Worker requests do not have an associated frame.');
}
const frame = _frame.Frame.from(this._initializer.frame);
@@ -184,7 +186,7 @@ class Request extends _channelOwner.ChannelOwner {
if (overrides.url) this._fallbackOverrides.url = overrides.url;
if (overrides.method) this._fallbackOverrides.method = overrides.method;
if (overrides.headers) this._fallbackOverrides.headers = overrides.headers;
if ((0, _utils.isString)(overrides.postData)) this._fallbackOverrides.postDataBuffer = Buffer.from(overrides.postData, 'utf-8');else if (overrides.postData instanceof Buffer) this._fallbackOverrides.postDataBuffer = overrides.postData;else if (overrides.postData) this._fallbackOverrides.postDataBuffer = Buffer.from(JSON.stringify(overrides.postData), 'utf-8');
if ((0, _rtti.isString)(overrides.postData)) this._fallbackOverrides.postDataBuffer = Buffer.from(overrides.postData, 'utf-8');else if (overrides.postData instanceof Buffer) this._fallbackOverrides.postDataBuffer = overrides.postData;else if (overrides.postData) this._fallbackOverrides.postDataBuffer = Buffer.from(JSON.stringify(overrides.postData), 'utf-8');
}
_fallbackOverridesForContinue() {
return this._fallbackOverrides;
@@ -272,13 +274,12 @@ class Route extends _channelOwner.ChannelOwner {
body
} = options;
if (options.json !== undefined) {
(0, _utils.assert)(options.body === undefined, 'Can specify either body or json parameters');
(0, _assert.assert)(options.body === undefined, 'Can specify either body or json parameters');
body = JSON.stringify(options.json);
}
if (options.response instanceof _fetch.APIResponse) {
var _statusOption, _headersOption;
(_statusOption = statusOption) !== null && _statusOption !== void 0 ? _statusOption : statusOption = options.response.status();
(_headersOption = headersOption) !== null && _headersOption !== void 0 ? _headersOption : headersOption = options.response.headers();
statusOption !== null && statusOption !== void 0 ? statusOption : statusOption = options.response.status();
headersOption !== null && headersOption !== void 0 ? headersOption : headersOption = options.response.headers();
if (body === undefined && options.path === undefined) {
if (options.response._request._connection === this._connection) fetchResponseUid = options.response._fetchUid();else body = await options.response.body();
}
@@ -286,11 +287,11 @@ class Route extends _channelOwner.ChannelOwner {
let isBase64 = false;
let length = 0;
if (options.path) {
const buffer = await _fs.default.promises.readFile(options.path);
const buffer = await this._platform.fs().promises.readFile(options.path);
body = buffer.toString('base64');
isBase64 = true;
length = buffer.length;
} else if ((0, _utils.isString)(body)) {
} else if ((0, _rtti.isString)(body)) {
isBase64 = false;
length = Buffer.byteLength(body);
} else if (body) {
@@ -300,11 +301,11 @@ class Route extends _channelOwner.ChannelOwner {
}
const headers = {};
for (const header of Object.keys(headersOption || {})) headers[header.toLowerCase()] = String(headersOption[header]);
if (options.contentType) headers['content-type'] = String(options.contentType);else if (options.json) headers['content-type'] = 'application/json';else if (options.path) headers['content-type'] = _utilsBundle.mime.getType(options.path) || 'application/octet-stream';
if (options.contentType) headers['content-type'] = String(options.contentType);else if (options.json) headers['content-type'] = 'application/json';else if (options.path) headers['content-type'] = (0, _mimeType.getMimeTypeForPath)(options.path) || 'application/octet-stream';
if (length && !('content-length' in headers)) headers['content-length'] = String(length);
await this._raceWithTargetClose(this._channel.fulfill({
status: statusOption || 200,
headers: (0, _utils.headersObjectToArray)(headers),
headers: (0, _headers.headersObjectToArray)(headers),
body,
isBase64,
fetchResponseUid
@@ -329,14 +330,13 @@ class Route extends _channelOwner.ChannelOwner {
return await this._raceWithTargetClose(this._channel.continue({
url: options.url,
method: options.method,
headers: options.headers ? (0, _utils.headersObjectToArray)(options.headers) : undefined,
headers: options.headers ? (0, _headers.headersObjectToArray)(options.headers) : undefined,
postData: options.postDataBuffer,
isFallback
}));
}
}
exports.Route = Route;
_Symbol$asyncDispose = Symbol.asyncDispose;
class WebSocketRoute extends _channelOwner.ChannelOwner {
static from(route) {
return route._object;
@@ -370,7 +370,7 @@ class WebSocketRoute extends _channelOwner.ChannelOwner {
}).catch(() => {});
},
send: message => {
if ((0, _utils.isString)(message)) this._channel.sendToServer({
if ((0, _rtti.isString)(message)) this._channel.sendToServer({
message,
isBase64: false
}).catch(() => {});else this._channel.sendToServer({
@@ -439,7 +439,7 @@ class WebSocketRoute extends _channelOwner.ChannelOwner {
return this._server;
}
send(message) {
if ((0, _utils.isString)(message)) this._channel.sendToPage({
if ((0, _rtti.isString)(message)) this._channel.sendToPage({
message,
isBase64: false
}).catch(() => {});else this._channel.sendToPage({
@@ -453,7 +453,7 @@ class WebSocketRoute extends _channelOwner.ChannelOwner {
onClose(handler) {
this._onPageClose = handler;
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.close();
}
async _afterHandle() {
@@ -476,9 +476,9 @@ class WebSocketRouteHandler {
const patterns = [];
let all = false;
for (const handler of handlers) {
if ((0, _utils.isString)(handler.url)) patterns.push({
if ((0, _rtti.isString)(handler.url)) patterns.push({
glob: handler.url
});else if ((0, _utils.isRegExp)(handler.url)) patterns.push({
});else if ((0, _rtti.isRegExp)(handler.url)) patterns.push({
regexSource: handler.url.source,
regexFlags: handler.url.flags
});else all = true;
@@ -489,7 +489,7 @@ class WebSocketRouteHandler {
return patterns;
}
matches(wsURL) {
return (0, _utils.urlMatches)(this._baseURL, wsURL, this.url);
return (0, _urlMatch.urlMatches)(this._baseURL, wsURL, this.url);
}
async handle(webSocketRoute) {
const handler = this.handler;
@@ -644,11 +644,11 @@ exports.WebSocket = WebSocket;
function validateHeaders(headers) {
for (const key of Object.keys(headers)) {
const value = headers[key];
if (!Object.is(value, undefined) && !(0, _utils.isString)(value)) throw new Error(`Expected value of header "${key}" to be String, but "${typeof value}" is found.`);
if (!Object.is(value, undefined) && !(0, _rtti.isString)(value)) throw new Error(`Expected value of header "${key}" to be String, but "${typeof value}" is found.`);
}
}
class RouteHandler {
constructor(baseURL, url, handler, times = Number.MAX_SAFE_INTEGER) {
constructor(platform, baseURL, url, handler, times = Number.MAX_SAFE_INTEGER) {
this.handledCount = 0;
this._baseURL = void 0;
this._times = void 0;
@@ -656,20 +656,20 @@ class RouteHandler {
this.handler = void 0;
this._ignoreException = false;
this._activeInvocations = new Set();
this._svedZone = void 0;
this._savedZone = void 0;
this._baseURL = baseURL;
this._times = times;
this.url = url;
this.handler = handler;
this._svedZone = _utils.zones.current().without('apiZone');
this._savedZone = platform.zones.current().pop();
}
static prepareInterceptionPatterns(handlers) {
const patterns = [];
let all = false;
for (const handler of handlers) {
if ((0, _utils.isString)(handler.url)) patterns.push({
if ((0, _rtti.isString)(handler.url)) patterns.push({
glob: handler.url
});else if ((0, _utils.isRegExp)(handler.url)) patterns.push({
});else if ((0, _rtti.isRegExp)(handler.url)) patterns.push({
regexSource: handler.url.source,
regexFlags: handler.url.flags
});else all = true;
@@ -680,10 +680,10 @@ class RouteHandler {
return patterns;
}
matches(requestURL) {
return (0, _utils.urlMatches)(this._baseURL, requestURL, this.url);
return (0, _urlMatch.urlMatches)(this._baseURL, requestURL, this.url);
}
async handle(route) {
return await this._svedZone.run(async () => this._handleImpl(route));
return await this._savedZone.run(async () => this._handleImpl(route));
}
async _handleImpl(route) {
const handlerInvocation = {
@@ -699,7 +699,7 @@ class RouteHandler {
if ((0, _errors.isTargetClosedError)(e)) {
// We are failing in the handler because the target close closed.
// Give user a hint!
(0, _utils.rewriteErrorMessage)(e, `"${e.message}" while running route callback.\nConsider awaiting \`await page.unrouteAll({ behavior: 'ignoreErrors' })\`\nbefore the end of the test to ignore remaining routes in flight.`);
(0, _stackTrace.rewriteErrorMessage)(e, `"${e.message}" while running route callback.\nConsider awaiting \`await page.unrouteAll({ behavior: 'ignoreErrors' })\`\nbefore the end of the test to ignore remaining routes in flight.`);
}
throw e;
} finally {
@@ -745,7 +745,7 @@ class RawHeaders {
}
constructor(headers) {
this._headersArray = void 0;
this._headersMap = new _utils.MultiMap();
this._headersMap = new _multimap.MultiMap();
this._headersArray = headers;
for (const header of headers) this._headersMap.set(header.name.toLowerCase(), header.value);
}

View File

@@ -4,11 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Page = exports.BindingCall = void 0;
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var _errors = require("./errors");
var _timeoutSettings = require("../common/timeoutSettings");
var _utils = require("../utils");
var _accessibility = require("./accessibility");
var _artifact = require("./artifact");
var _channelOwner = require("./channelOwner");
@@ -16,17 +11,25 @@ var _clientHelper = require("./clientHelper");
var _coverage = require("./coverage");
var _download = require("./download");
var _elementHandle = require("./elementHandle");
var _errors = require("./errors");
var _events = require("./events");
var _fileChooser = require("./fileChooser");
var _frame = require("./frame");
var _harRouter = require("./harRouter");
var _input = require("./input");
var _jsHandle = require("./jsHandle");
var _network = require("./network");
var _video = require("./video");
var _waiter = require("./waiter");
var _worker = require("./worker");
var _harRouter = require("./harRouter");
let _Symbol$asyncDispose;
var _timeoutSettings = require("./timeoutSettings");
var _assert = require("../utils/isomorphic/assert");
var _fileUtils = require("./fileUtils");
var _headers = require("../utils/isomorphic/headers");
var _stringUtils = require("../utils/isomorphic/stringUtils");
var _urlMatch = require("../utils/isomorphic/urlMatch");
var _manualPromise = require("../utils/isomorphic/manualPromise");
var _rtti = require("../utils/isomorphic/rtti");
/**
* Copyright 2017 Google Inc. All rights reserved.
* Modifications copyright (c) Microsoft Corporation.
@@ -43,8 +46,7 @@ let _Symbol$asyncDispose;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Symbol$asyncDispose = Symbol.asyncDispose;
class Page extends _channelOwner.ChannelOwner {
static from(page) {
return page._object;
@@ -60,7 +62,7 @@ class Page extends _channelOwner.ChannelOwner {
this._frames = new Set();
this._workers = new Set();
this._closed = false;
this._closedOrCrashedScope = new _utils.LongStandingScope();
this._closedOrCrashedScope = new _manualPromise.LongStandingScope();
this._viewportSize = void 0;
this._routes = [];
this._webSocketRoutes = [];
@@ -80,7 +82,7 @@ class Page extends _channelOwner.ChannelOwner {
this._harRouters = [];
this._locatorHandlers = new Map();
this._browserContext = parent;
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._browserContext._timeoutSettings);
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform, this._browserContext._timeoutSettings);
this.accessibility = new _accessibility.Accessibility(this._channel);
this.keyboard = new _input.Keyboard(this);
this.mouse = new _input.Mouse(this);
@@ -208,12 +210,12 @@ class Page extends _channelOwner.ChannelOwner {
return this._mainFrame;
}
frame(frameSelector) {
const name = (0, _utils.isString)(frameSelector) ? frameSelector : frameSelector.name;
const url = (0, _utils.isObject)(frameSelector) ? frameSelector.url : undefined;
(0, _utils.assert)(name || url, 'Either name or url matcher should be specified');
const name = (0, _rtti.isString)(frameSelector) ? frameSelector : frameSelector.name;
const url = (0, _rtti.isObject)(frameSelector) ? frameSelector.url : undefined;
(0, _assert.assert)(name || url, 'Either name or url matcher should be specified');
return this.frames().find(f => {
if (name) return f.name() === name;
return (0, _utils.urlMatches)(this._browserContext._options.baseURL, f.url(), url);
return (0, _urlMatch.urlMatches)(this._browserContext._options.baseURL, f.url(), url);
}) || null;
}
frames() {
@@ -222,18 +224,18 @@ class Page extends _channelOwner.ChannelOwner {
setDefaultNavigationTimeout(timeout) {
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
this._wrapApiCall(async () => {
this._channel.setDefaultNavigationTimeoutNoReply({
await this._channel.setDefaultNavigationTimeoutNoReply({
timeout
}).catch(() => {});
}, true);
});
}, true).catch(() => {});
}
setDefaultTimeout(timeout) {
this._timeoutSettings.setDefaultTimeout(timeout);
this._wrapApiCall(async () => {
this._channel.setDefaultTimeoutNoReply({
await this._channel.setDefaultTimeoutNoReply({
timeout
}).catch(() => {});
}, true);
});
}, true).catch(() => {});
}
_forceVideo() {
if (!this._video) this._video = new _video.Video(this, this._connection);
@@ -293,7 +295,7 @@ class Page extends _channelOwner.ChannelOwner {
async setExtraHTTPHeaders(headers) {
(0, _network.validateHeaders)(headers);
await this._channel.setExtraHTTPHeaders({
headers: (0, _utils.headersObjectToArray)(headers)
headers: (0, _headers.headersObjectToArray)(headers)
});
}
url() {
@@ -368,7 +370,7 @@ class Page extends _channelOwner.ChannelOwner {
}
async waitForRequest(urlOrPredicate, options = {}) {
const predicate = async request => {
if ((0, _utils.isString)(urlOrPredicate) || (0, _utils.isRegExp)(urlOrPredicate)) return (0, _utils.urlMatches)(this._browserContext._options.baseURL, request.url(), urlOrPredicate);
if ((0, _rtti.isString)(urlOrPredicate) || (0, _rtti.isRegExp)(urlOrPredicate)) return (0, _urlMatch.urlMatches)(this._browserContext._options.baseURL, request.url(), urlOrPredicate);
return await urlOrPredicate(request);
};
const trimmedUrl = trimUrl(urlOrPredicate);
@@ -380,7 +382,7 @@ class Page extends _channelOwner.ChannelOwner {
}
async waitForResponse(urlOrPredicate, options = {}) {
const predicate = async response => {
if ((0, _utils.isString)(urlOrPredicate) || (0, _utils.isRegExp)(urlOrPredicate)) return (0, _utils.urlMatches)(this._browserContext._options.baseURL, response.url(), urlOrPredicate);
if ((0, _rtti.isString)(urlOrPredicate) || (0, _rtti.isRegExp)(urlOrPredicate)) return (0, _urlMatch.urlMatches)(this._browserContext._options.baseURL, response.url(), urlOrPredicate);
return await urlOrPredicate(response);
};
const trimmedUrl = trimUrl(urlOrPredicate);
@@ -432,7 +434,8 @@ class Page extends _channelOwner.ChannelOwner {
media: options.media === null ? 'no-override' : options.media,
colorScheme: options.colorScheme === null ? 'no-override' : options.colorScheme,
reducedMotion: options.reducedMotion === null ? 'no-override' : options.reducedMotion,
forcedColors: options.forcedColors === null ? 'no-override' : options.forcedColors
forcedColors: options.forcedColors === null ? 'no-override' : options.forcedColors,
contrast: options.contrast === null ? 'no-override' : options.contrast
});
}
async setViewportSize(viewportSize) {
@@ -449,21 +452,23 @@ class Page extends _channelOwner.ChannelOwner {
return await this._mainFrame.evaluate(pageFunction, arg);
}
async addInitScript(script, arg) {
const source = await (0, _clientHelper.evaluationScript)(script, arg);
const source = await (0, _clientHelper.evaluationScript)(this._platform, script, arg);
await this._channel.addInitScript({
source
});
}
async route(url, handler, options = {}) {
this._routes.unshift(new _network.RouteHandler(this._browserContext._options.baseURL, url, handler, options.times));
this._routes.unshift(new _network.RouteHandler(this._platform, this._browserContext._options.baseURL, url, handler, options.times));
await this._updateInterceptionPatterns();
}
async routeFromHAR(har, options = {}) {
const localUtils = this._connection.localUtils();
if (!localUtils) throw new Error('Route from har is not supported in thin clients');
if (options.update) {
await this._browserContext._recordIntoHAR(har, this, options);
return;
}
const harRouter = await _harRouter.HarRouter.create(this._connection.localUtils(), har, options.notFound || 'abort', {
const harRouter = await _harRouter.HarRouter.create(localUtils, har, options.notFound || 'abort', {
urlMatch: options.url
});
this._harRouters.push(harRouter);
@@ -485,7 +490,7 @@ class Page extends _channelOwner.ChannelOwner {
const removed = [];
const remaining = [];
for (const route of this._routes) {
if ((0, _utils.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
if ((0, _urlMatch.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
}
await this._unrouteInternal(removed, remaining, 'default');
}
@@ -509,21 +514,22 @@ class Page extends _channelOwner.ChannelOwner {
});
}
async screenshot(options = {}) {
const mask = options.mask;
const copy = {
...options,
mask: undefined
};
if (!copy.type) copy.type = (0, _elementHandle.determineScreenshotType)(options);
if (options.mask) {
copy.mask = options.mask.map(locator => ({
if (mask) {
copy.mask = mask.map(locator => ({
frame: locator._frame._channel,
selector: locator._selector
}));
}
const result = await this._channel.screenshot(copy);
if (options.path) {
await (0, _utils.mkdirIfNeeded)(options.path);
await _fs.default.promises.writeFile(options.path, result.binary);
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
await this._platform.fs().promises.writeFile(options.path, result.binary);
}
return result.binary;
}
@@ -549,7 +555,7 @@ class Page extends _channelOwner.ChannelOwner {
async bringToFront() {
await this._channel.bringToFront();
}
async [_Symbol$asyncDispose]() {
async [Symbol.asyncDispose]() {
await this.close();
}
async close(options = {}) {
@@ -678,7 +684,7 @@ class Page extends _channelOwner.ChannelOwner {
}
async pause(_options) {
var _this$_instrumentatio;
if (require('inspector').url()) return;
if (this._platform.isJSDebuggerAttached()) return;
const defaultNavigationTimeout = this._browserContext._timeoutSettings.defaultNavigationTimeout();
const defaultTimeout = this._browserContext._timeoutSettings.defaultTimeout();
this._browserContext.setDefaultNavigationTimeout(0);
@@ -705,10 +711,11 @@ class Page extends _channelOwner.ChannelOwner {
}
const result = await this._channel.pdf(transportOptions);
if (options.path) {
await _fs.default.promises.mkdir(_path.default.dirname(options.path), {
const platform = this._platform;
await platform.fs().promises.mkdir(platform.path().dirname(options.path), {
recursive: true
});
await _fs.default.promises.writeFile(options.path, result.pdf);
await platform.fs().promises.writeFile(options.path, result.pdf);
}
return result.pdf;
}
@@ -743,6 +750,6 @@ class BindingCall extends _channelOwner.ChannelOwner {
}
exports.BindingCall = BindingCall;
function trimUrl(param) {
if ((0, _utils.isRegExp)(param)) return `/${(0, _utils.trimStringWithEllipsis)(param.source, 50)}/${param.flags}`;
if ((0, _utils.isString)(param)) return `"${(0, _utils.trimStringWithEllipsis)(param, 50)}"`;
if ((0, _rtti.isRegExp)(param)) return `/${(0, _stringUtils.trimStringWithEllipsis)(param.source, 50)}/${param.flags}`;
if ((0, _rtti.isString)(param)) return `"${(0, _stringUtils.trimStringWithEllipsis)(param, 50)}"`;
}

View File

@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Playwright = void 0;
var _errors = require("./errors");
var _android = require("./android");
var _browser = require("./browser");
var _browserType = require("./browserType");
var _channelOwner = require("./channelOwner");
var _electron = require("./electron");
var _errors = require("./errors");
var _fetch = require("./fetch");
var _selectors = require("./selectors");
/**
@@ -42,6 +43,11 @@ class Playwright extends _channelOwner.ChannelOwner {
this.selectors = void 0;
this.request = void 0;
this.errors = void 0;
// Instrumentation.
this._defaultLaunchOptions = void 0;
this._defaultContextOptions = void 0;
this._defaultContextTimeout = void 0;
this._defaultContextNavigationTimeout = void 0;
this.request = new _fetch.APIRequest(this);
this.chromium = _browserType.BrowserType.from(initializer.chromium);
this.chromium._playwright = this;
@@ -76,5 +82,19 @@ class Playwright extends _channelOwner.ChannelOwner {
static from(channel) {
return channel._object;
}
_browserTypes() {
return [this.chromium, this.firefox, this.webkit, this._bidiChromium, this._bidiFirefox];
}
_preLaunchedBrowser() {
const browser = _browser.Browser.from(this._initializer.preLaunchedBrowser);
browser._browserType = this[browser._name];
return browser;
}
_allContexts() {
return this._browserTypes().flatMap(type => [...type._contexts]);
}
_allPages() {
return this._allContexts().flatMap(context => context.pages());
}
}
exports.Playwright = Playwright;

View File

@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SelectorsOwner = exports.Selectors = void 0;
var _clientHelper = require("./clientHelper");
exports.setPlatformForSelectors = setPlatformForSelectors;
var _channelOwner = require("./channelOwner");
var _clientHelper = require("./clientHelper");
var _locator = require("./locator");
var _platform = require("./platform");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -23,13 +25,17 @@ var _locator = require("./locator");
* limitations under the License.
*/
let platform = _platform.emptyPlatform;
function setPlatformForSelectors(p) {
platform = p;
}
class Selectors {
constructor() {
this._channels = new Set();
this._registrations = [];
}
async register(name, script, options = {}) {
const source = await (0, _clientHelper.evaluationScript)(script, undefined, false);
const source = await (0, _clientHelper.evaluationScript)(platform, script, undefined, false);
const params = {
...options,
name,

View File

@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Stream = void 0;
var _stream = require("stream");
var _channelOwner = require("./channelOwner");
/**
* Copyright (c) Microsoft Corporation.
@@ -30,25 +29,7 @@ class Stream extends _channelOwner.ChannelOwner {
super(parent, type, guid, initializer);
}
stream() {
return new StreamImpl(this._channel);
return this._platform.streamReadable(this._channel);
}
}
exports.Stream = Stream;
class StreamImpl extends _stream.Readable {
constructor(channel) {
super();
this._channel = void 0;
this._channel = channel;
}
async _read() {
const result = await this._channel.read({
size: 1024 * 1024
});
if (result.binary.byteLength) this.push(result.binary);else this.push(null);
}
_destroy(error, callback) {
// Stream might be destroyed after the connection was closed.
this._channel.close().catch(e => null);
super._destroy(error, callback);
}
}
exports.Stream = Stream;

View File

@@ -70,15 +70,16 @@ class Tracing extends _channelOwner.ChannelOwner {
}, false);
}
async _startCollectingStacks(traceName) {
var _this$_connection$loc;
if (!this._isTracing) {
this._isTracing = true;
this._connection.setIsTracing(true);
}
const result = await this._connection.localUtils()._channel.tracingStarted({
const result = await ((_this$_connection$loc = this._connection.localUtils()) === null || _this$_connection$loc === void 0 ? void 0 : _this$_connection$loc.tracingStarted({
tracesDir: this._tracesDir,
traceName
});
this._stacksId = result.stacksId;
}));
this._stacksId = result === null || result === void 0 ? void 0 : result.stacksId;
}
async stopChunk(options = {}) {
await this._doStopChunk(options.path);
@@ -94,17 +95,19 @@ class Tracing extends _channelOwner.ChannelOwner {
await this._channel.tracingStopChunk({
mode: 'discard'
});
if (this._stacksId) await this._connection.localUtils()._channel.traceDiscarded({
if (this._stacksId) await this._connection.localUtils().traceDiscarded({
stacksId: this._stacksId
});
return;
}
const localUtils = this._connection.localUtils();
if (!localUtils) throw new Error('Cannot save trace in thin clients');
const isLocal = !this._connection.isRemote();
if (isLocal) {
const result = await this._channel.tracingStopChunk({
mode: 'entries'
});
await this._connection.localUtils()._channel.zip({
await localUtils.zip({
zipFile: filePath,
entries: result.entries,
mode: 'write',
@@ -119,7 +122,7 @@ class Tracing extends _channelOwner.ChannelOwner {
// The artifact may be missing if the browser closed while stopping tracing.
if (!result.artifact) {
if (this._stacksId) await this._connection.localUtils()._channel.traceDiscarded({
if (this._stacksId) await localUtils.traceDiscarded({
stacksId: this._stacksId
});
return;
@@ -129,7 +132,7 @@ class Tracing extends _channelOwner.ChannelOwner {
const artifact = _artifact.Artifact.from(result.artifact);
await artifact.saveAs(filePath);
await artifact.delete();
await this._connection.localUtils()._channel.zip({
await localUtils.zip({
zipFile: filePath,
entries: [],
mode: 'append',

View File

@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Video = void 0;
var _utils = require("../utils");
var _manualPromise = require("../utils/isomorphic/manualPromise");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -24,7 +24,7 @@ var _utils = require("../utils");
class Video {
constructor(page, connection) {
this._artifact = null;
this._artifactReadyPromise = new _utils.ManualPromise();
this._artifactReadyPromise = new _manualPromise.ManualPromise();
this._isRemote = false;
this._isRemote = connection.isRemote();
this._artifact = page._closedOrCrashedScope.safeRace(this._artifactReadyPromise);

View File

@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Waiter = void 0;
var _stackTrace = require("../utils/stackTrace");
var _errors = require("./errors");
var _utils = require("../utils");
var _stackTrace = require("../utils/isomorphic/stackTrace");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -33,9 +32,9 @@ class Waiter {
this._waitId = void 0;
this._error = void 0;
this._savedZone = void 0;
this._waitId = (0, _utils.createGuid)();
this._waitId = channelOwner._platform.createGuid();
this._channelOwner = channelOwner;
this._savedZone = _utils.zones.current().without('apiZone');
this._savedZone = channelOwner._platform.zones.current().pop();
this._channelOwner._channel.waitForEventInfo({
info: {
waitId: this._waitId,
@@ -111,8 +110,8 @@ class Waiter {
phase: 'log',
message: s
}
}).catch(() => {});
}, true);
});
}, true).catch(() => {});
}
_rejectOn(promise, dispose) {
this._failures.push(promise);

View File

@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Worker = void 0;
var _events = require("./events");
var _channelOwner = require("./channelOwner");
var _jsHandle = require("./jsHandle");
var _utils = require("../utils");
var _errors = require("./errors");
var _events = require("./events");
var _jsHandle = require("./jsHandle");
var _manualPromise = require("../utils/isomorphic/manualPromise");
/**
* Copyright (c) Microsoft Corporation.
*
@@ -35,7 +35,7 @@ class Worker extends _channelOwner.ChannelOwner {
// Set for web workers.
this._context = void 0;
// Set for service workers.
this._closedScope = new _utils.LongStandingScope();
this._closedScope = new _manualPromise.LongStandingScope();
this._channel.on('close', () => {
if (this._page) this._page._workers.delete(this);
if (this._context) this._context._serviceWorkers.delete(this);

View File

@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.WritableStream = void 0;
var _stream = require("stream");
var _channelOwner = require("./channelOwner");
/**
* Copyright (c) Microsoft Corporation.
@@ -30,25 +29,7 @@ class WritableStream extends _channelOwner.ChannelOwner {
super(parent, type, guid, initializer);
}
stream() {
return new WritableStreamImpl(this._channel);
return this._platform.streamWritable(this._channel);
}
}
exports.WritableStream = WritableStream;
class WritableStreamImpl extends _stream.Writable {
constructor(channel) {
super();
this._channel = void 0;
this._channel = channel;
}
async _write(chunk, encoding, callback) {
const error = await this._channel.write({
binary: typeof chunk === 'string' ? Buffer.from(chunk) : chunk
}).catch(e => e);
callback(error || null);
}
async _final(callback) {
// Stream might be destroyed after the connection was closed.
const error = await this._channel.close().catch(e => e);
callback(error || null);
}
}
exports.WritableStream = WritableStream;

View File

@@ -1,569 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SocksProxyHandler = exports.SocksProxy = void 0;
exports.parsePattern = parsePattern;
var _events = _interopRequireDefault(require("events"));
var _net = _interopRequireDefault(require("net"));
var _debugLogger = require("../utils/debugLogger");
var _happyEyeballs = require("../utils/happy-eyeballs");
var _utils = require("../utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) Microsoft Corporation.
*
* 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.
*/
// https://tools.ietf.org/html/rfc1928
var SocksAuth = /*#__PURE__*/function (SocksAuth) {
SocksAuth[SocksAuth["NO_AUTHENTICATION_REQUIRED"] = 0] = "NO_AUTHENTICATION_REQUIRED";
SocksAuth[SocksAuth["GSSAPI"] = 1] = "GSSAPI";
SocksAuth[SocksAuth["USERNAME_PASSWORD"] = 2] = "USERNAME_PASSWORD";
SocksAuth[SocksAuth["NO_ACCEPTABLE_METHODS"] = 255] = "NO_ACCEPTABLE_METHODS";
return SocksAuth;
}(SocksAuth || {});
var SocksAddressType = /*#__PURE__*/function (SocksAddressType) {
SocksAddressType[SocksAddressType["IPv4"] = 1] = "IPv4";
SocksAddressType[SocksAddressType["FqName"] = 3] = "FqName";
SocksAddressType[SocksAddressType["IPv6"] = 4] = "IPv6";
return SocksAddressType;
}(SocksAddressType || {});
var SocksCommand = /*#__PURE__*/function (SocksCommand) {
SocksCommand[SocksCommand["CONNECT"] = 1] = "CONNECT";
SocksCommand[SocksCommand["BIND"] = 2] = "BIND";
SocksCommand[SocksCommand["UDP_ASSOCIATE"] = 3] = "UDP_ASSOCIATE";
return SocksCommand;
}(SocksCommand || {});
var SocksReply = /*#__PURE__*/function (SocksReply) {
SocksReply[SocksReply["Succeeded"] = 0] = "Succeeded";
SocksReply[SocksReply["GeneralServerFailure"] = 1] = "GeneralServerFailure";
SocksReply[SocksReply["NotAllowedByRuleSet"] = 2] = "NotAllowedByRuleSet";
SocksReply[SocksReply["NetworkUnreachable"] = 3] = "NetworkUnreachable";
SocksReply[SocksReply["HostUnreachable"] = 4] = "HostUnreachable";
SocksReply[SocksReply["ConnectionRefused"] = 5] = "ConnectionRefused";
SocksReply[SocksReply["TtlExpired"] = 6] = "TtlExpired";
SocksReply[SocksReply["CommandNotSupported"] = 7] = "CommandNotSupported";
SocksReply[SocksReply["AddressTypeNotSupported"] = 8] = "AddressTypeNotSupported";
return SocksReply;
}(SocksReply || {});
class SocksConnection {
constructor(uid, socket, client) {
this._buffer = Buffer.from([]);
this._offset = 0;
this._fence = 0;
this._fenceCallback = void 0;
this._socket = void 0;
this._boundOnData = void 0;
this._uid = void 0;
this._client = void 0;
this._uid = uid;
this._socket = socket;
this._client = client;
this._boundOnData = this._onData.bind(this);
socket.on('data', this._boundOnData);
socket.on('close', () => this._onClose());
socket.on('end', () => this._onClose());
socket.on('error', () => this._onClose());
this._run().catch(() => this._socket.end());
}
async _run() {
(0, _utils.assert)(await this._authenticate());
const {
command,
host,
port
} = await this._parseRequest();
if (command !== SocksCommand.CONNECT) {
this._writeBytes(Buffer.from([0x05, SocksReply.CommandNotSupported, 0x00,
// RSV
0x01,
// IPv4
0x00, 0x00, 0x00, 0x00,
// Address
0x00, 0x00 // Port
]));
return;
}
this._socket.off('data', this._boundOnData);
this._client.onSocketRequested({
uid: this._uid,
host,
port
});
}
async _authenticate() {
// Request:
// +----+----------+----------+
// |VER | NMETHODS | METHODS |
// +----+----------+----------+
// | 1 | 1 | 1 to 255 |
// +----+----------+----------+
// Response:
// +----+--------+
// |VER | METHOD |
// +----+--------+
// | 1 | 1 |
// +----+--------+
const version = await this._readByte();
(0, _utils.assert)(version === 0x05, 'The VER field must be set to x05 for this version of the protocol, was ' + version);
const nMethods = await this._readByte();
(0, _utils.assert)(nMethods, 'No authentication methods specified');
const methods = await this._readBytes(nMethods);
for (const method of methods) {
if (method === 0) {
this._writeBytes(Buffer.from([version, method]));
return true;
}
}
this._writeBytes(Buffer.from([version, SocksAuth.NO_ACCEPTABLE_METHODS]));
return false;
}
async _parseRequest() {
// Request.
// +----+-----+-------+------+----------+----------+
// |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |
// +----+-----+-------+------+----------+----------+
// | 1 | 1 | X'00' | 1 | Variable | 2 |
// +----+-----+-------+------+----------+----------+
// Response.
// +----+-----+-------+------+----------+----------+
// |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT |
// +----+-----+-------+------+----------+----------+
// | 1 | 1 | X'00' | 1 | Variable | 2 |
// +----+-----+-------+------+----------+----------+
const version = await this._readByte();
(0, _utils.assert)(version === 0x05, 'The VER field must be set to x05 for this version of the protocol, was ' + version);
const command = await this._readByte();
await this._readByte(); // skip reserved.
const addressType = await this._readByte();
let host = '';
switch (addressType) {
case SocksAddressType.IPv4:
host = (await this._readBytes(4)).join('.');
break;
case SocksAddressType.FqName:
const length = await this._readByte();
host = (await this._readBytes(length)).toString();
break;
case SocksAddressType.IPv6:
const bytes = await this._readBytes(16);
const tokens = [];
for (let i = 0; i < 8; ++i) tokens.push(bytes.readUInt16BE(i * 2).toString(16));
host = tokens.join(':');
break;
}
const port = (await this._readBytes(2)).readUInt16BE(0);
this._buffer = Buffer.from([]);
this._offset = 0;
this._fence = 0;
return {
command,
host,
port
};
}
async _readByte() {
const buffer = await this._readBytes(1);
return buffer[0];
}
async _readBytes(length) {
this._fence = this._offset + length;
if (!this._buffer || this._buffer.length < this._fence) await new Promise(f => this._fenceCallback = f);
this._offset += length;
return this._buffer.slice(this._offset - length, this._offset);
}
_writeBytes(buffer) {
if (this._socket.writable) this._socket.write(buffer);
}
_onClose() {
this._client.onSocketClosed({
uid: this._uid
});
}
_onData(buffer) {
this._buffer = Buffer.concat([this._buffer, buffer]);
if (this._fenceCallback && this._buffer.length >= this._fence) {
const callback = this._fenceCallback;
this._fenceCallback = undefined;
callback();
}
}
socketConnected(host, port) {
this._writeBytes(Buffer.from([0x05, SocksReply.Succeeded, 0x00,
// RSV
...ipToSocksAddress(host),
// ATYP, Address
port >> 8, port & 0xFF // Port
]));
this._socket.on('data', data => this._client.onSocketData({
uid: this._uid,
data
}));
}
socketFailed(errorCode) {
const buffer = Buffer.from([0x05, 0, 0x00,
// RSV
...ipToSocksAddress('0.0.0.0'),
// ATYP, Address
0, 0 // Port
]);
switch (errorCode) {
case 'ENOENT':
case 'ENOTFOUND':
case 'ETIMEDOUT':
case 'EHOSTUNREACH':
buffer[1] = SocksReply.HostUnreachable;
break;
case 'ENETUNREACH':
buffer[1] = SocksReply.NetworkUnreachable;
break;
case 'ECONNREFUSED':
buffer[1] = SocksReply.ConnectionRefused;
break;
case 'ERULESET':
buffer[1] = SocksReply.NotAllowedByRuleSet;
break;
}
this._writeBytes(buffer);
this._socket.end();
}
sendData(data) {
this._socket.write(data);
}
end() {
this._socket.end();
}
error(error) {
this._socket.destroy(new Error(error));
}
}
function hexToNumber(hex) {
// Note: parseInt has a few issues including ignoring trailing characters and allowing leading 0x.
return [...hex].reduce((value, digit) => {
const code = digit.charCodeAt(0);
if (code >= 48 && code <= 57)
// 0..9
return value + code;
if (code >= 97 && code <= 102)
// a..f
return value + (code - 97) + 10;
if (code >= 65 && code <= 70)
// A..F
return value + (code - 65) + 10;
throw new Error('Invalid IPv6 token ' + hex);
}, 0);
}
function ipToSocksAddress(address) {
if (_net.default.isIPv4(address)) {
return [0x01,
// IPv4
...address.split('.', 4).map(t => +t & 0xFF) // Address
];
}
if (_net.default.isIPv6(address)) {
const result = [0x04]; // IPv6
const tokens = address.split(':', 8);
while (tokens.length < 8) tokens.unshift('');
for (const token of tokens) {
const value = hexToNumber(token);
result.push(value >> 8 & 0xFF, value & 0xFF); // Big-endian
}
return result;
}
throw new Error('Only IPv4 and IPv6 addresses are supported');
}
function starMatchToRegex(pattern) {
const source = pattern.split('*').map(s => {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}).join('.*');
return new RegExp('^' + source + '$');
}
// This follows "Proxy bypass rules" syntax without implicit and negative rules.
// https://source.chromium.org/chromium/chromium/src/+/main:net/docs/proxy.md;l=331
function parsePattern(pattern) {
if (!pattern) return () => false;
const matchers = pattern.split(',').map(token => {
const match = token.match(/^(.*?)(?::(\d+))?$/);
if (!match) throw new Error(`Unsupported token "${token}" in pattern "${pattern}"`);
const tokenPort = match[2] ? +match[2] : undefined;
const portMatches = port => tokenPort === undefined || tokenPort === port;
let tokenHost = match[1];
if (tokenHost === '<loopback>') {
return (host, port) => {
if (!portMatches(port)) return false;
return host === 'localhost' || host.endsWith('.localhost') || host === '127.0.0.1' || host === '[::1]';
};
}
if (tokenHost === '*') return (host, port) => portMatches(port);
if (_net.default.isIPv4(tokenHost) || _net.default.isIPv6(tokenHost)) return (host, port) => host === tokenHost && portMatches(port);
if (tokenHost[0] === '.') tokenHost = '*' + tokenHost;
const tokenRegex = starMatchToRegex(tokenHost);
return (host, port) => {
if (!portMatches(port)) return false;
if (_net.default.isIPv4(host) || _net.default.isIPv6(host)) return false;
return !!host.match(tokenRegex);
};
});
return (host, port) => matchers.some(matcher => matcher(host, port));
}
class SocksProxy extends _events.default {
constructor() {
super();
this._server = void 0;
this._connections = new Map();
this._sockets = new Set();
this._closed = false;
this._port = void 0;
this._patternMatcher = () => false;
this._directSockets = new Map();
this._server = new _net.default.Server(socket => {
const uid = (0, _utils.createGuid)();
const connection = new SocksConnection(uid, socket, this);
this._connections.set(uid, connection);
});
this._server.on('connection', socket => {
if (this._closed) {
socket.destroy();
return;
}
this._sockets.add(socket);
socket.once('close', () => this._sockets.delete(socket));
});
}
setPattern(pattern) {
try {
this._patternMatcher = parsePattern(pattern);
} catch (e) {
this._patternMatcher = () => false;
}
}
async _handleDirect(request) {
try {
var _this$_connections$ge4;
const socket = await (0, _happyEyeballs.createSocket)(request.host, request.port);
socket.on('data', data => {
var _this$_connections$ge;
return (_this$_connections$ge = this._connections.get(request.uid)) === null || _this$_connections$ge === void 0 ? void 0 : _this$_connections$ge.sendData(data);
});
socket.on('error', error => {
var _this$_connections$ge2;
(_this$_connections$ge2 = this._connections.get(request.uid)) === null || _this$_connections$ge2 === void 0 || _this$_connections$ge2.error(error.message);
this._directSockets.delete(request.uid);
});
socket.on('end', () => {
var _this$_connections$ge3;
(_this$_connections$ge3 = this._connections.get(request.uid)) === null || _this$_connections$ge3 === void 0 || _this$_connections$ge3.end();
this._directSockets.delete(request.uid);
});
const localAddress = socket.localAddress;
const localPort = socket.localPort;
this._directSockets.set(request.uid, socket);
(_this$_connections$ge4 = this._connections.get(request.uid)) === null || _this$_connections$ge4 === void 0 || _this$_connections$ge4.socketConnected(localAddress, localPort);
} catch (error) {
var _this$_connections$ge5;
(_this$_connections$ge5 = this._connections.get(request.uid)) === null || _this$_connections$ge5 === void 0 || _this$_connections$ge5.socketFailed(error.code);
}
}
port() {
return this._port;
}
async listen(port, hostname) {
return new Promise(f => {
this._server.listen(port, hostname, () => {
const port = this._server.address().port;
this._port = port;
f(port);
});
});
}
async close() {
if (this._closed) return;
this._closed = true;
for (const socket of this._sockets) socket.destroy();
this._sockets.clear();
await new Promise(f => this._server.close(f));
}
onSocketRequested(payload) {
if (!this._patternMatcher(payload.host, payload.port)) {
this._handleDirect(payload);
return;
}
this.emit(SocksProxy.Events.SocksRequested, payload);
}
onSocketData(payload) {
const direct = this._directSockets.get(payload.uid);
if (direct) {
direct.write(payload.data);
return;
}
this.emit(SocksProxy.Events.SocksData, payload);
}
onSocketClosed(payload) {
const direct = this._directSockets.get(payload.uid);
if (direct) {
direct.destroy();
this._directSockets.delete(payload.uid);
return;
}
this.emit(SocksProxy.Events.SocksClosed, payload);
}
socketConnected({
uid,
host,
port
}) {
var _this$_connections$ge6;
(_this$_connections$ge6 = this._connections.get(uid)) === null || _this$_connections$ge6 === void 0 || _this$_connections$ge6.socketConnected(host, port);
}
socketFailed({
uid,
errorCode
}) {
var _this$_connections$ge7;
(_this$_connections$ge7 = this._connections.get(uid)) === null || _this$_connections$ge7 === void 0 || _this$_connections$ge7.socketFailed(errorCode);
}
sendSocketData({
uid,
data
}) {
var _this$_connections$ge8;
(_this$_connections$ge8 = this._connections.get(uid)) === null || _this$_connections$ge8 === void 0 || _this$_connections$ge8.sendData(data);
}
sendSocketEnd({
uid
}) {
var _this$_connections$ge9;
(_this$_connections$ge9 = this._connections.get(uid)) === null || _this$_connections$ge9 === void 0 || _this$_connections$ge9.end();
}
sendSocketError({
uid,
error
}) {
var _this$_connections$ge10;
(_this$_connections$ge10 = this._connections.get(uid)) === null || _this$_connections$ge10 === void 0 || _this$_connections$ge10.error(error);
}
}
exports.SocksProxy = SocksProxy;
SocksProxy.Events = {
SocksRequested: 'socksRequested',
SocksData: 'socksData',
SocksClosed: 'socksClosed'
};
class SocksProxyHandler extends _events.default {
constructor(pattern, redirectPortForTest) {
super();
this._sockets = new Map();
this._patternMatcher = () => false;
this._redirectPortForTest = void 0;
this._patternMatcher = parsePattern(pattern);
this._redirectPortForTest = redirectPortForTest;
}
cleanup() {
for (const uid of this._sockets.keys()) this.socketClosed({
uid
});
}
async socketRequested({
uid,
host,
port
}) {
_debugLogger.debugLogger.log('socks', `[${uid}] => request ${host}:${port}`);
if (!this._patternMatcher(host, port)) {
const payload = {
uid,
errorCode: 'ERULESET'
};
_debugLogger.debugLogger.log('socks', `[${uid}] <= pattern error ${payload.errorCode}`);
this.emit(SocksProxyHandler.Events.SocksFailed, payload);
return;
}
if (host === 'local.playwright') host = 'localhost';
try {
if (this._redirectPortForTest) port = this._redirectPortForTest;
const socket = await (0, _happyEyeballs.createSocket)(host, port);
socket.on('data', data => {
const payload = {
uid,
data
};
this.emit(SocksProxyHandler.Events.SocksData, payload);
});
socket.on('error', error => {
const payload = {
uid,
error: error.message
};
_debugLogger.debugLogger.log('socks', `[${uid}] <= network socket error ${payload.error}`);
this.emit(SocksProxyHandler.Events.SocksError, payload);
this._sockets.delete(uid);
});
socket.on('end', () => {
const payload = {
uid
};
_debugLogger.debugLogger.log('socks', `[${uid}] <= network socket closed`);
this.emit(SocksProxyHandler.Events.SocksEnd, payload);
this._sockets.delete(uid);
});
const localAddress = socket.localAddress;
const localPort = socket.localPort;
this._sockets.set(uid, socket);
const payload = {
uid,
host: localAddress,
port: localPort
};
_debugLogger.debugLogger.log('socks', `[${uid}] <= connected to network ${payload.host}:${payload.port}`);
this.emit(SocksProxyHandler.Events.SocksConnected, payload);
} catch (error) {
const payload = {
uid,
errorCode: error.code
};
_debugLogger.debugLogger.log('socks', `[${uid}] <= connect error ${payload.errorCode}`);
this.emit(SocksProxyHandler.Events.SocksFailed, payload);
}
}
sendSocketData({
uid,
data
}) {
var _this$_sockets$get;
(_this$_sockets$get = this._sockets.get(uid)) === null || _this$_sockets$get === void 0 || _this$_sockets$get.write(data);
}
socketClosed({
uid
}) {
var _this$_sockets$get2;
_debugLogger.debugLogger.log('socks', `[${uid}] <= browser socket closed`);
(_this$_sockets$get2 = this._sockets.get(uid)) === null || _this$_sockets$get2 === void 0 || _this$_sockets$get2.destroy();
this._sockets.delete(uid);
}
}
exports.SocksProxyHandler = SocksProxyHandler;
SocksProxyHandler.Events = {
SocksConnected: 'socksConnected',
SocksData: 'socksData',
SocksError: 'socksError',
SocksFailed: 'socksFailed',
SocksEnd: 'socksEnd'
};

View File

@@ -1,73 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TimeoutSettings = exports.DEFAULT_TIMEOUT = exports.DEFAULT_LAUNCH_TIMEOUT = void 0;
var _utils = require("../utils");
/**
* Copyright 2019 Google Inc. All rights reserved.
* Modifications copyright (c) Microsoft Corporation.
*
* 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.
*/
const DEFAULT_TIMEOUT = exports.DEFAULT_TIMEOUT = 30000;
const DEFAULT_LAUNCH_TIMEOUT = exports.DEFAULT_LAUNCH_TIMEOUT = 3 * 60 * 1000; // 3 minutes
class TimeoutSettings {
constructor(parent) {
this._parent = void 0;
this._defaultTimeout = void 0;
this._defaultNavigationTimeout = void 0;
this._parent = parent;
}
setDefaultTimeout(timeout) {
this._defaultTimeout = timeout;
}
setDefaultNavigationTimeout(timeout) {
this._defaultNavigationTimeout = timeout;
}
defaultNavigationTimeout() {
return this._defaultNavigationTimeout;
}
defaultTimeout() {
return this._defaultTimeout;
}
navigationTimeout(options) {
if (typeof options.timeout === 'number') return options.timeout;
if (this._defaultNavigationTimeout !== undefined) return this._defaultNavigationTimeout;
if ((0, _utils.debugMode)()) return 0;
if (this._defaultTimeout !== undefined) return this._defaultTimeout;
if (this._parent) return this._parent.navigationTimeout(options);
return DEFAULT_TIMEOUT;
}
timeout(options) {
if (typeof options.timeout === 'number') return options.timeout;
if ((0, _utils.debugMode)()) return 0;
if (this._defaultTimeout !== undefined) return this._defaultTimeout;
if (this._parent) return this._parent.timeout(options);
return DEFAULT_TIMEOUT;
}
static timeout(options) {
if (typeof options.timeout === 'number') return options.timeout;
if ((0, _utils.debugMode)()) return 0;
return DEFAULT_TIMEOUT;
}
static launchTimeout(options) {
if (typeof options.timeout === 'number') return options.timeout;
if ((0, _utils.debugMode)()) return 0;
return DEFAULT_LAUNCH_TIMEOUT;
}
}
exports.TimeoutSettings = TimeoutSettings;

View File

@@ -1,5 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,98 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.blendWithWhite = blendWithWhite;
exports.colorDeltaE94 = colorDeltaE94;
exports.rgb2gray = rgb2gray;
exports.srgb2xyz = srgb2xyz;
exports.xyz2lab = xyz2lab;
/**
* Copyright (c) Microsoft Corporation.
*
* 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.
*/
function blendWithWhite(c, a) {
return 255 + (c - 255) * a;
}
function rgb2gray(r, g, b) {
// NOTE: this is the exact integer formula from SSIM.js.
// See https://github.com/obartra/ssim/blob/ca8e3c6a6ff5f4f2e232239e0c3d91806f3c97d5/src/matlab/rgb2gray.ts#L56
return 77 * r + 150 * g + 29 * b + 128 >> 8;
}
// Perceived color difference defined by CIE94.
// See https://en.wikipedia.org/wiki/Color_difference#CIE94
//
// The result of 1.0 is a "just-noticeable difference".
//
// Other results interpretation (taken from http://zschuessler.github.io/DeltaE/learn/):
// < 1.0 Not perceptible by human eyes.
// 1-2 Perceptible through close observation.
// 2-10 Perceptible at a glance.
// 11-49 Colors are more similar than opposite
// 100 Colors are exact opposite
function colorDeltaE94(rgb1, rgb2) {
const [l1, a1, b1] = xyz2lab(srgb2xyz(rgb1));
const [l2, a2, b2] = xyz2lab(srgb2xyz(rgb2));
const deltaL = l1 - l2;
const deltaA = a1 - a2;
const deltaB = b1 - b2;
const c1 = Math.sqrt(a1 ** 2 + b1 ** 2);
const c2 = Math.sqrt(a2 ** 2 + b2 ** 2);
const deltaC = c1 - c2;
let deltaH = deltaA ** 2 + deltaB ** 2 - deltaC ** 2;
deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);
// The k1, k2, kL, kC, kH values for "graphic arts" applications.
// See https://en.wikipedia.org/wiki/Color_difference#CIE94
const k1 = 0.045;
const k2 = 0.015;
const kL = 1;
const kC = 1;
const kH = 1;
const sC = 1.0 + k1 * c1;
const sH = 1.0 + k2 * c1;
const sL = 1;
return Math.sqrt((deltaL / sL / kL) ** 2 + (deltaC / sC / kC) ** 2 + (deltaH / sH / kH) ** 2);
}
// sRGB -> 1-normalized XYZ (i.e. Y ∈ [0, 1]) with D65 illuminant
// See https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ
function srgb2xyz(rgb) {
let r = rgb[0] / 255;
let g = rgb[1] / 255;
let b = rgb[2] / 255;
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
return [r * 0.4124 + g * 0.3576 + b * 0.1805, r * 0.2126 + g * 0.7152 + b * 0.0722, r * 0.0193 + g * 0.1192 + b * 0.9505];
}
const sigma_pow2 = 6 * 6 / 29 / 29;
const sigma_pow3 = 6 * 6 * 6 / 29 / 29 / 29;
// 1-normalized CIE XYZ with D65 to L*a*b*
// See https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB
function xyz2lab(xyz) {
const x = xyz[0] / 0.950489;
const y = xyz[1];
const z = xyz[2] / 1.088840;
const fx = x > sigma_pow3 ? x ** (1 / 3) : x / 3 / sigma_pow2 + 4 / 29;
const fy = y > sigma_pow3 ? y ** (1 / 3) : y / 3 / sigma_pow2 + 4 / 29;
const fz = z > sigma_pow3 ? z ** (1 / 3) : z / 3 / sigma_pow2 + 4 / 29;
const l = 116 * fy - 16;
const a = 500 * (fx - fy);
const b = 200 * (fy - fz);
return [l, a, b];
}

View File

@@ -1,108 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.compare = compare;
var _colorUtils = require("./colorUtils");
var _imageChannel = require("./imageChannel");
var _stats = require("./stats");
/**
* Copyright (c) Microsoft Corporation.
*
* 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.
*/
const SSIM_WINDOW_RADIUS = 15;
const VARIANCE_WINDOW_RADIUS = 1;
function drawPixel(width, data, x, y, r, g, b) {
const idx = (y * width + x) * 4;
data[idx + 0] = r;
data[idx + 1] = g;
data[idx + 2] = b;
data[idx + 3] = 255;
}
function compare(actual, expected, diff, width, height, options = {}) {
const {
maxColorDeltaE94 = 1.0
} = options;
const paddingSize = Math.max(VARIANCE_WINDOW_RADIUS, SSIM_WINDOW_RADIUS);
const paddingColorEven = [255, 0, 255];
const paddingColorOdd = [0, 255, 0];
const [r1, g1, b1] = _imageChannel.ImageChannel.intoRGB(width, height, expected, {
paddingSize,
paddingColorEven,
paddingColorOdd
});
const [r2, g2, b2] = _imageChannel.ImageChannel.intoRGB(width, height, actual, {
paddingSize,
paddingColorEven,
paddingColorOdd
});
const noop = (x, y) => {};
const drawRedPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 0, 0) : noop;
const drawYellowPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 255, 0) : noop;
const drawGrayPixel = diff ? (x, y) => {
const gray = (0, _colorUtils.rgb2gray)(r1.get(x, y), g1.get(x, y), b1.get(x, y));
const value = (0, _colorUtils.blendWithWhite)(gray, 0.1);
drawPixel(width, diff, x - paddingSize, y - paddingSize, value, value, value);
} : noop;
let fastR, fastG, fastB;
let diffCount = 0;
for (let y = paddingSize; y < r1.height - paddingSize; ++y) {
for (let x = paddingSize; x < r1.width - paddingSize; ++x) {
// Fast-path: equal pixels.
if (r1.get(x, y) === r2.get(x, y) && g1.get(x, y) === g2.get(x, y) && b1.get(x, y) === b2.get(x, y)) {
drawGrayPixel(x, y);
continue;
}
// Compare pixel colors using the dE94 color difference formulae.
// The dE94 is normalized so that the value of 1.0 is the "just-noticeable-difference".
// Color difference below 1.0 is not noticeable to a human eye, so we can disregard it.
// See https://en.wikipedia.org/wiki/Color_difference
const delta = (0, _colorUtils.colorDeltaE94)([r1.get(x, y), g1.get(x, y), b1.get(x, y)], [r2.get(x, y), g2.get(x, y), b2.get(x, y)]);
if (delta <= maxColorDeltaE94) {
drawGrayPixel(x, y);
continue;
}
if (!fastR || !fastG || !fastB) {
fastR = new _stats.FastStats(r1, r2);
fastG = new _stats.FastStats(g1, g2);
fastB = new _stats.FastStats(b1, b2);
}
const [varX1, varY1] = r1.boundXY(x - VARIANCE_WINDOW_RADIUS, y - VARIANCE_WINDOW_RADIUS);
const [varX2, varY2] = r1.boundXY(x + VARIANCE_WINDOW_RADIUS, y + VARIANCE_WINDOW_RADIUS);
const var1 = fastR.varianceC1(varX1, varY1, varX2, varY2) + fastG.varianceC1(varX1, varY1, varX2, varY2) + fastB.varianceC1(varX1, varY1, varX2, varY2);
const var2 = fastR.varianceC2(varX1, varY1, varX2, varY2) + fastG.varianceC2(varX1, varY1, varX2, varY2) + fastB.varianceC2(varX1, varY1, varX2, varY2);
// if this pixel is a part of a flood fill of a 3x3 square of either of the images, then it cannot be
// anti-aliasing pixel so it must be a pixel difference.
if (var1 === 0 || var2 === 0) {
drawRedPixel(x, y);
++diffCount;
continue;
}
const [ssimX1, ssimY1] = r1.boundXY(x - SSIM_WINDOW_RADIUS, y - SSIM_WINDOW_RADIUS);
const [ssimX2, ssimY2] = r1.boundXY(x + SSIM_WINDOW_RADIUS, y + SSIM_WINDOW_RADIUS);
const ssimRGB = ((0, _stats.ssim)(fastR, ssimX1, ssimY1, ssimX2, ssimY2) + (0, _stats.ssim)(fastG, ssimX1, ssimY1, ssimX2, ssimY2) + (0, _stats.ssim)(fastB, ssimX1, ssimY1, ssimX2, ssimY2)) / 3.0;
const isAntialiased = ssimRGB >= 0.99;
if (isAntialiased) {
drawYellowPixel(x, y);
} else {
drawRedPixel(x, y);
++diffCount;
}
}
}
return diffCount;
}

View File

@@ -1,70 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ImageChannel = void 0;
var _colorUtils = require("./colorUtils");
/**
* Copyright (c) Microsoft Corporation.
*
* 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.
*/
class ImageChannel {
static intoRGB(width, height, data, options = {}) {
const {
paddingSize = 0,
paddingColorOdd = [255, 0, 255],
paddingColorEven = [0, 255, 0]
} = options;
const newWidth = width + 2 * paddingSize;
const newHeight = height + 2 * paddingSize;
const r = new Uint8Array(newWidth * newHeight);
const g = new Uint8Array(newWidth * newHeight);
const b = new Uint8Array(newWidth * newHeight);
for (let y = 0; y < newHeight; ++y) {
for (let x = 0; x < newWidth; ++x) {
const index = y * newWidth + x;
if (y >= paddingSize && y < newHeight - paddingSize && x >= paddingSize && x < newWidth - paddingSize) {
const offset = ((y - paddingSize) * width + (x - paddingSize)) * 4;
const alpha = data[offset + 3] === 255 ? 1 : data[offset + 3] / 255;
r[index] = (0, _colorUtils.blendWithWhite)(data[offset], alpha);
g[index] = (0, _colorUtils.blendWithWhite)(data[offset + 1], alpha);
b[index] = (0, _colorUtils.blendWithWhite)(data[offset + 2], alpha);
} else {
const color = (y + x) % 2 === 0 ? paddingColorEven : paddingColorOdd;
r[index] = color[0];
g[index] = color[1];
b[index] = color[2];
}
}
}
return [new ImageChannel(newWidth, newHeight, r), new ImageChannel(newWidth, newHeight, g), new ImageChannel(newWidth, newHeight, b)];
}
constructor(width, height, data) {
this.data = void 0;
this.width = void 0;
this.height = void 0;
this.data = data;
this.width = width;
this.height = height;
}
get(x, y) {
return this.data[y * this.width + x];
}
boundXY(x, y) {
return [Math.min(Math.max(x, 0), this.width - 1), Math.min(Math.max(y, 0), this.height - 1)];
}
}
exports.ImageChannel = ImageChannel;

View File

@@ -1,102 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FastStats = void 0;
exports.ssim = ssim;
/**
* Copyright (c) Microsoft Corporation.
*
* 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.
*/
// Image channel has a 8-bit depth.
const DYNAMIC_RANGE = 2 ** 8 - 1;
function ssim(stats, x1, y1, x2, y2) {
const mean1 = stats.meanC1(x1, y1, x2, y2);
const mean2 = stats.meanC2(x1, y1, x2, y2);
const var1 = stats.varianceC1(x1, y1, x2, y2);
const var2 = stats.varianceC2(x1, y1, x2, y2);
const cov = stats.covariance(x1, y1, x2, y2);
const c1 = (0.01 * DYNAMIC_RANGE) ** 2;
const c2 = (0.03 * DYNAMIC_RANGE) ** 2;
return (2 * mean1 * mean2 + c1) * (2 * cov + c2) / (mean1 ** 2 + mean2 ** 2 + c1) / (var1 + var2 + c2);
}
class FastStats {
constructor(c1, c2) {
this.c1 = void 0;
this.c2 = void 0;
this._partialSumC1 = void 0;
this._partialSumC2 = void 0;
this._partialSumMult = void 0;
this._partialSumSq1 = void 0;
this._partialSumSq2 = void 0;
this.c1 = c1;
this.c2 = c2;
const {
width,
height
} = c1;
this._partialSumC1 = new Array(width * height);
this._partialSumC2 = new Array(width * height);
this._partialSumSq1 = new Array(width * height);
this._partialSumSq2 = new Array(width * height);
this._partialSumMult = new Array(width * height);
const recalc = (mx, idx, initial, x, y) => {
mx[idx] = initial;
if (y > 0) mx[idx] += mx[(y - 1) * width + x];
if (x > 0) mx[idx] += mx[y * width + x - 1];
if (x > 0 && y > 0) mx[idx] -= mx[(y - 1) * width + x - 1];
};
for (let y = 0; y < height; ++y) {
for (let x = 0; x < width; ++x) {
const idx = y * width + x;
recalc(this._partialSumC1, idx, this.c1.data[idx], x, y);
recalc(this._partialSumC2, idx, this.c2.data[idx], x, y);
recalc(this._partialSumSq1, idx, this.c1.data[idx] * this.c1.data[idx], x, y);
recalc(this._partialSumSq2, idx, this.c2.data[idx] * this.c2.data[idx], x, y);
recalc(this._partialSumMult, idx, this.c1.data[idx] * this.c2.data[idx], x, y);
}
}
}
_sum(partialSum, x1, y1, x2, y2) {
const width = this.c1.width;
let result = partialSum[y2 * width + x2];
if (y1 > 0) result -= partialSum[(y1 - 1) * width + x2];
if (x1 > 0) result -= partialSum[y2 * width + x1 - 1];
if (x1 > 0 && y1 > 0) result += partialSum[(y1 - 1) * width + x1 - 1];
return result;
}
meanC1(x1, y1, x2, y2) {
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
return this._sum(this._partialSumC1, x1, y1, x2, y2) / N;
}
meanC2(x1, y1, x2, y2) {
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
return this._sum(this._partialSumC2, x1, y1, x2, y2) / N;
}
varianceC1(x1, y1, x2, y2) {
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
return (this._sum(this._partialSumSq1, x1, y1, x2, y2) - this._sum(this._partialSumC1, x1, y1, x2, y2) ** 2 / N) / N;
}
varianceC2(x1, y1, x2, y2) {
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
return (this._sum(this._partialSumSq2, x1, y1, x2, y2) - this._sum(this._partialSumC2, x1, y1, x2, y2) ** 2 / N) / N;
}
covariance(x1, y1, x2, y2) {
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
return (this._sum(this._partialSumMult, x1, y1, x2, y2) - this._sum(this._partialSumC1, x1, y1, x2, y2) * this._sum(this._partialSumC2, x1, y1, x2, y2) / N) / N;
}
}
exports.FastStats = FastStats;

Some files were not shown because too many files have changed in this diff Show More