@oxymoron.13/tizentube-s95b 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +51 -42
  2. package/S95B-CHANGES.txt +12 -4
  3. package/UPSTREAM-README.md +42 -0
  4. package/dist/service.js +3 -0
  5. package/dist/userScript.js +2 -2
  6. package/mods/config.js +117 -0
  7. package/mods/domrect-polyfill.js +104 -0
  8. package/mods/features/adblock.js +584 -0
  9. package/mods/features/autoFrameRate.js +42 -0
  10. package/mods/features/enableFeatures.js +19 -0
  11. package/mods/features/moreSubtitles.js +378 -0
  12. package/mods/features/pictureInPicture.js +198 -0
  13. package/mods/features/preferredVideoQuality.js +101 -0
  14. package/mods/features/s95bCodec.js +45 -0
  15. package/mods/features/s95bI18n.js +28 -0
  16. package/mods/features/s95bMenu.js +137 -0
  17. package/mods/features/s95bOptions.js +30 -0
  18. package/mods/features/s95bPlayback.js +29 -0
  19. package/mods/features/sponsorblock.js +437 -0
  20. package/mods/features/standaloneUserscript.js +107 -0
  21. package/mods/features/updater.js +119 -0
  22. package/mods/features/userAgentSpoofing.js +73 -0
  23. package/mods/features/videoQueuing.js +64 -0
  24. package/mods/package-lock.json +2321 -0
  25. package/mods/package.json +33 -0
  26. package/mods/resolveCommand.js +381 -0
  27. package/mods/rollup.config.js +41 -0
  28. package/mods/spatial-navigation-polyfill.js +1756 -0
  29. package/mods/tiny-sha256.js +99 -0
  30. package/mods/translations/i18nResources.js +11 -0
  31. package/mods/translations/index.js +18 -0
  32. package/mods/translations/language-names.js +981 -0
  33. package/mods/translations/resources/ar.json +308 -0
  34. package/mods/translations/resources/az.json +308 -0
  35. package/mods/translations/resources/bs.json +308 -0
  36. package/mods/translations/resources/cs.json +308 -0
  37. package/mods/translations/resources/de.json +308 -0
  38. package/mods/translations/resources/dk.json +308 -0
  39. package/mods/translations/resources/el.json +308 -0
  40. package/mods/translations/resources/en.json +308 -0
  41. package/mods/translations/resources/es-419.json +308 -0
  42. package/mods/translations/resources/es.json +308 -0
  43. package/mods/translations/resources/fi-FI.json +308 -0
  44. package/mods/translations/resources/fr.json +311 -0
  45. package/mods/translations/resources/hr.json +308 -0
  46. package/mods/translations/resources/hu.json +308 -0
  47. package/mods/translations/resources/id.json +308 -0
  48. package/mods/translations/resources/it.json +308 -0
  49. package/mods/translations/resources/ja.json +308 -0
  50. package/mods/translations/resources/lt.json +308 -0
  51. package/mods/translations/resources/lv.json +308 -0
  52. package/mods/translations/resources/pl.json +308 -0
  53. package/mods/translations/resources/pt-BR.json +308 -0
  54. package/mods/translations/resources/pt-PT.json +308 -0
  55. package/mods/translations/resources/ro.json +310 -0
  56. package/mods/translations/resources/ru.json +308 -0
  57. package/mods/translations/resources/sr-Cyrl.json +308 -0
  58. package/mods/translations/resources/sr-Latn.json +308 -0
  59. package/mods/translations/resources/tlh.json +308 -0
  60. package/mods/translations/resources/tr.json +308 -0
  61. package/mods/translations/resources/uk.json +308 -0
  62. package/mods/translations/resources/vi.json +309 -0
  63. package/mods/translations/resources/zh-CN.json +308 -0
  64. package/mods/translations/resources/zh-TW.json +308 -0
  65. package/mods/translations/update-translations.js +55 -0
  66. package/mods/ui/chapters.js +137 -0
  67. package/mods/ui/clock.js +71 -0
  68. package/mods/ui/customCommandExecution.js +49 -0
  69. package/mods/ui/customGuideAction.js +119 -0
  70. package/mods/ui/customUI.js +192 -0
  71. package/mods/ui/customYTSettings.js +29 -0
  72. package/mods/ui/disableWhosWatching.js +48 -0
  73. package/mods/ui/settings.js +1024 -0
  74. package/mods/ui/sidebarModification.js +179 -0
  75. package/mods/ui/speedUI.js +119 -0
  76. package/mods/ui/theme.js +26 -0
  77. package/mods/ui/ui.css +157 -0
  78. package/mods/ui/ui.js +261 -0
  79. package/mods/ui/ytUI.js +510 -0
  80. package/mods/userScript.js +28 -0
  81. package/mods/utils/ASTParser.js +67 -0
  82. package/mods/utils/innerTubeCalls.js +138 -0
  83. package/package.json +11 -5
  84. package/service/package-lock.json +4193 -0
  85. package/service/package.json +29 -0
  86. package/service/rollup.config.js +47 -0
  87. package/service/service.js +121 -0
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "service",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "service.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "description": "",
13
+ "dependencies": {
14
+ "@patrickkfkan/peer-dial": "^0.1.2",
15
+ "cors": "^2.8.5",
16
+ "express": "^4.19.2",
17
+ "uuid": "^11.1.1"
18
+ },
19
+ "devDependencies": {
20
+ "@babel/core": "^7.24.7",
21
+ "@babel/preset-env": "^7.24.7",
22
+ "@rollup/plugin-babel": "^6.0.4",
23
+ "@rollup/plugin-commonjs": "^26.0.1",
24
+ "@rollup/plugin-json": "^6.1.0",
25
+ "@rollup/plugin-node-resolve": "^15.2.3",
26
+ "@rollup/plugin-replace": "^5.0.7",
27
+ "rollup": "^4.18.1"
28
+ }
29
+ }
@@ -0,0 +1,47 @@
1
+ import resolve from '@rollup/plugin-node-resolve';
2
+ import commonjs from '@rollup/plugin-commonjs';
3
+ import babel from '@rollup/plugin-babel';
4
+ import replace from '@rollup/plugin-replace';
5
+ import json from '@rollup/plugin-json';
6
+ import fs from 'fs';
7
+
8
+ // Custom Rollup plugin to inject XML content
9
+ function injectXmlContent() {
10
+ return {
11
+ name: 'inject-xml-content',
12
+ renderChunk(code) {
13
+
14
+ const pattern = /var\s+(\w+)_TEMPLATE\s+=\s+fs\$3\.readFileSync\(__dirname\s+\+\s+'\/\.\.\/xml\/([^']+)'\s*,\s*'utf8'\);/g;
15
+
16
+ const modifiedCode = code.replace(pattern, (match, varName, fileName) => {
17
+ const xmlContent = fs.readFileSync(`node_modules/@patrickkfkan/peer-dial/xml/${fileName}`, 'utf8');
18
+ return `var ${varName}_TEMPLATE = ${JSON.stringify(xmlContent)};`;
19
+ });
20
+
21
+ return { code: modifiedCode, map: null };
22
+ }
23
+ };
24
+ }
25
+
26
+ export default {
27
+ input: 'service.js',
28
+ output: {
29
+ file: '../dist/service.js',
30
+ format: 'cjs'
31
+ },
32
+ plugins: [
33
+ injectXmlContent(),
34
+ replace({
35
+ 'Gate.prototype.await = function await(callback)': 'Gate.prototype.await = function(callback)',
36
+ 'Async.prototype.await = function await(callback)': 'Async.prototype.await = function (callback)',
37
+ delimiters: ['', ''],
38
+ }),
39
+ resolve(),
40
+ json(),
41
+ commonjs(),
42
+ babel({
43
+ babelHelpers: 'bundled',
44
+ presets: ['@babel/preset-env']
45
+ })
46
+ ]
47
+ };
@@ -0,0 +1,121 @@
1
+ const dial = require("@patrickkfkan/peer-dial");
2
+ const express = require('express');
3
+ const cors = require('cors');
4
+ const uuid = require('uuid');
5
+ const app = express();
6
+
7
+ const corsOptions = {
8
+ origin: '*',
9
+ methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
10
+ credentials: true,
11
+ optionsSuccessStatus: 204
12
+ };
13
+
14
+ app.use(cors(corsOptions));
15
+
16
+ const PORT = global.isTizenTube ? 8095 : 8085;
17
+ const apps = {
18
+ "YouTube": {
19
+ name: "YouTube",
20
+ state: "stopped",
21
+ allowStop: true,
22
+ pid: null,
23
+ additionalData: {},
24
+ launch(launchData) {
25
+ const tbPackageId = tizen.application.getAppInfo().packageId;
26
+ tizen.application.launchAppControl(
27
+ new tizen.ApplicationControl(
28
+ "http://tizen.org/appcontrol/operation/view",
29
+ null,
30
+ null,
31
+ null,
32
+ [
33
+ new tizen.ApplicationControlData("module", [JSON.stringify(
34
+ {
35
+ moduleName: '@oxymoron.13/tizentube-s95b',
36
+ moduleType: 'npm',
37
+ args: launchData
38
+ }
39
+ )])
40
+ ]
41
+ ), `${tbPackageId}.${global.isTizenTube ? 'TizenTubeStandalone' : 'TizenBrewStandalone'}`);
42
+ }
43
+ }
44
+ };
45
+
46
+ const dialServer = new dial.Server({
47
+ expressApp: app,
48
+ port: PORT,
49
+ prefix: "/dial",
50
+ manufacturer: 'Reis Can',
51
+ modelName: 'TizenBrew',
52
+ friendlyName: `TizenTube (${tizen.systeminfo.getCapability('http://tizen.org/system/model_name')})`,
53
+ uuid: uuid.v5(tizen.systeminfo.getCapability('http://tizen.org/system/tizenid'), '4bcbc514-bdd6-4163-8215-316526fd1d9b'),
54
+ delegate: {
55
+ getApp(appName) {
56
+ return apps[appName];
57
+ },
58
+ launchApp(appName, launchData, callback) {
59
+ console.log(`Got request to launch ${appName} with launch data: ${launchData}`);
60
+ const app = apps[appName];
61
+ if (app) {
62
+ const parsedData = launchData.split('&').reduce((acc, cur) => {
63
+ const parts = cur.split('=');
64
+ const key = parts[0];
65
+ const value = parts[1];
66
+
67
+ if (typeof value !== 'undefined') {
68
+ acc[key] = value;
69
+ } else {
70
+ acc[key] = '';
71
+ }
72
+
73
+ return acc;
74
+ }, {});
75
+
76
+ if (parsedData.yumi) {
77
+ app.additionalData = parsedData;
78
+ app.state = "running"
79
+ callback("");
80
+ return;
81
+ }
82
+ app.pid = "run";
83
+ app.state = "starting";
84
+ app.launch(launchData);
85
+ app.state = "running";
86
+ }
87
+ callback(app.pid);
88
+ },
89
+ stopApp(appName, pid, callback) {
90
+ console.log(`Got request to stop ${appName} with pid: ${pid}`);
91
+ const app = apps[appName];
92
+ if (app && app.pid === pid) {
93
+ app.pid = null;
94
+ app.state = "stopped";
95
+ callback(true);
96
+ } else {
97
+ callback(false);
98
+ }
99
+ }
100
+ }
101
+ });
102
+
103
+
104
+ setInterval(() => {
105
+ tizen.application.getAppsContext((appsContext) => {
106
+ const tbPackageId = tizen.application.getAppInfo().packageId;
107
+ const app = appsContext.find(app => app.appId === `${tbPackageId}.${global.isTizenTube ? 'TizenTubeStandalone' : 'TizenBrewStandalone'}`);
108
+ if (!app) {
109
+ apps["YouTube"].state = "stopped";
110
+ apps["YouTube"].pid = null;
111
+ apps["YouTube"].additionalData = {};
112
+ }
113
+ });
114
+ }, 5000);
115
+
116
+ app.listen(PORT, () => {
117
+ dialServer.start();
118
+ }).on('error', (e) => {
119
+ // S95B: without a handler, EADDRINUSE (e.g. original TizenTube running too) is an unhandled error event.
120
+ console.error('[S95B] service port ' + PORT + ' unavailable:', e && e.code);
121
+ });