Commit Graph

78 Commits

Author SHA1 Message Date
Nathan Adams 3447b8bfdd chore: npm run format 2023-07-20 14:00:04 +02:00
nosamu 99ed30f6e7 web: Set isExtension var using current script URL 2023-06-23 09:05:37 +03:00
nosamu 202fe2f1bb core: Add options to set and force the stage alignment 2023-06-14 16:04:14 +02:00
Toad06 7830a8232b
web: Allow extra MIME types in the polyfill 2023-05-30 06:35:29 +00:00
Toad06 0ff4f26db9 extension: Add a button to reset settings 2023-05-21 00:03:19 +02:00
Toad06 4092e70bf4 extension: Remove "tabs" permission 2023-05-19 01:03:28 +02:00
nosamu 77f2875898 extension: Set charset attribute of script tag instead of escaping characters 2023-05-18 22:39:06 +02:00
Toad06 b9abc463d6 web: Minor improvements to the extension player page 2023-05-18 03:34:19 +03:00
Toad06 55c7a4b895 extension: Don't say that Ruffle cannot load on "player.html" 2023-05-15 16:22:29 +03:00
Toad06 58d786b869 extension: Localize more strings 2023-05-05 00:28:11 +03:00
nosamu 36710f87d9 extension: Add an Automatic option for preferred renderer 2023-05-03 09:44:01 +03:00
iwannabethedev 1f956ffe55 web: Add extension option for setting 'playerVersion'.
Basic input validation UI and logic is also added and improved.
2023-04-29 01:09:09 +03:00
iwannabethedev e211f57f81 extension: Fix popup setting changed reload detection.
The problem seems to have been the inclusion of setting values
that the previous equality function did not handle correctly.
This function broadens the kinds of setting values that can
be handled correctly.
2023-04-28 11:06:52 +03:00
iwannabethedev b01e797e99
extension: Add option for setting max. exec. time
Add an option to the 'options' menu for the extension
for setting the maximum execution time for Actionscript
code.
2023-04-27 09:47:56 +00:00
iwannabethedev eaee14c7de web: Use default configuration in extension. 2023-04-26 23:24:53 +02:00
Toad06 f3a0652aea extension: Close `popup.html` when opening/reloading a window 2023-04-26 22:08:12 +03:00
nosamu 569e822044 extension: Reduce code duplication 2023-04-25 08:48:59 +03:00
relrelb 940a8c6658 extension: Make `Options` extend `BaseLoadOptions`
Omit config values from `DEFAULT_OPTIONS`, which are already
part of `DEFAULT_CONFIG` in `ruffle-core`. Also use spread syntax
to avoid naming each config that should pass to `ruffle-core`.
2023-04-24 22:33:59 +03:00
Daniel Jacobs ddb45f2cc2 extension: Add autostart to toggle splashScreen/autoplay/unmuteOverlay 2023-04-14 22:08:23 +02:00
relrelb 479926cdba web: Migrate to TypeScript 5.0.0
Work around the newly introduced `--verbatimModuleSyntax` flag:
https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#verbatimmodulesyntax
2023-04-01 13:11:23 +03:00
relrelb 798588dd94 extension: Disallow content script to import `ruffle-core`
Use the `@typescript-eslint/no-restricted-imports` rule in order to
prevent #10422 from regressing. Ideally we wouldn't need to specify
each dependency of `content.ts` (i.e. `utils.ts` and `common.ts`),
but I haven't found any better way.
2023-03-30 01:08:13 +03:00
Lord-McSweeney eacb4498fb web: Fix XML document detection 2023-03-28 09:13:10 +03:00
Daniel Jacobs b7c20a6c60 extension: Give precedence to toggles over default options (fixes #5825)
Also fixes #5696
2023-03-25 22:57:57 -07:00
Daniel Jacobs 2ced2d2300 web: Don't polyfill with self-hosted Ruffle while extension is loading 2023-03-24 17:58:54 -07:00
Daniel Jacobs 5a1b43008b web: Remove Config object; it was never a correct type for the config 2023-03-15 11:45:00 +01:00
relrelb 9f8419a145 web: Change `ruffle-core` output directory to `dist`
This aligns with the other packages.
2023-02-24 12:43:01 +02:00
relrelb 52e395ecca extension: Use `@tsconfig/strictest` 2023-02-22 21:39:12 +02:00
David Wendt cc7d160d07 web: Automatically inject plugin-polyfill.ts into content.ts as a string.
The prior version of this code used a hardcoded copy of the script. Not only is this an outdated version of the code, this also caused us to fail our addons.mozilla.org audit.
2023-02-15 21:27:14 -07:00
David Wendt efc6254366 web: Build a separate plugin polyfill target file.
A future commit will add a mechanism to inject this into `content.ts` in lieu of the old copy of this file.
2023-02-15 21:27:14 -07:00
nosamu f92be1c798 web: Make RufflePluginArray iterable 2022-12-19 11:56:18 -08:00
aidanbabo d14ce5243f web: Add version number requested in #8021
Change the compile time "macros" such as `%VERSION_NUMBER%` to be
contained in only one file `build-info.ts`.

Closes #8021
2022-12-13 22:49:20 +01:00
relrelb 5f1adc2bbf extension: Avoid some non-null assertions 2022-10-14 11:56:44 +03:00
relrelb 696514862d extension: Migrate to TypeScript 4.8
Per https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#unconstrained-generics-no-longer-assignable-to,
`Object.entries()` no longer accepts nullable objects.
The suggested fix is to add a `T extends {}` constraint, but that's
disallowed by https://typescript-eslint.io/rules/ban-types/. So instead
change the parameter types from `T` to `NonNull<T>`.
2022-09-02 15:58:28 +03:00
nosamu c5c619abbd web: Correct IANA Flash MIME type 2022-08-29 02:49:23 -07:00
nosamu 4dc446825b extension: Check more thoroughly for SWF filenames and MIME types 2022-08-29 02:49:23 -07:00
relrelb e3831d2228 web: Disallow imports not used as values
Configure [`importsNotUsedAsValues`](https://www.typescriptlang.org/tsconfig#importsNotUsedAsValues)
to `error`, and switch from `import` to `import type` where needed.
Also remove the `strict` configuration, as it's inherited from
`@tsconfig/recommended`.
2022-08-26 17:27:29 -07:00
relrelb 1accf2d8f9 web: Make `SourceAPI` a singleton
As a first step towards a simpler Web API, convert `SourceAPI` from
a class to a constant object, under the assumption that `SourceAPI`
isn't a public Ruffle API and as such is safe to be changed.

As a result the different `ruffle-core` users don't need to construct
a new `SourceAPI` instance before calling `PublicAPI.negotiate()`.
2022-07-23 10:37:33 -07:00
nosamu 20d4149fe4 extension: Check for all octet-stream MIME types
When a server returns a `.swf` file with an octet-stream MIME type, Ruffle should treat it as an SWF. Right now the extension checks specifically for the `application/octet-stream` MIME type, which leaves out servers like [MaxGames](https://farm.maxgames.com/soldier-diary-13469MTU5MA==.swf) that use the `binary/octet-stream` type instead. Check if the MIME type ends with `octet-stream` to handle both cases.
2022-04-18 09:01:10 -07:00
Mike Welsh 0e26fa1191 extension: Allow loading SWFs in frames (fix #6582)
If a frame directly loaded an SWF, it would not display in Ruffle.
Add `subframe` to the types intercepted by the `onHeaderReceived`
event in the background script so that Ruffle will display the SWF
in the frame.

Fixes #6582.
2022-04-03 15:17:41 -07:00
Toad06 c14569e3d4 web: Add `refresh` method to `navigator.plugins` 2022-01-26 18:53:33 -08:00
nosamu f23c03129a
extension: URL-encode the SWF URL for the player page
When the user clicks the "Open in a new tab" button, the extension's internal `player.html` page opens, with a URL parameter `?url=[the SWF URL]`. Right now, this URL parameter is not properly encoded. This causes a problem when we get to https://github.com/ruffle-rs/ruffle/blob/master/web/packages/extension/src/player.ts#L14:
> `const swfUrl = url.searchParams.get("url");` 
Because the value "url" parameter was not properly encoded, any `&` character in the SWF URL would be interpreted as the start of a *new* parameter, instead of being part of the actual SWF URL. So anything after the first `&` symbol in the SWF URL would be chopped off.
On Itch.io Flash pages such as https://rarykos.itch.io/hug-me-im-cold, the SWF URL contains several important parameters - if they are not included, the server returns 403 Forbidden (it's a type of hotlinking protection). So when the user clicked the "Open in a new tab" button on Itch.io pages, the SWF would refuse to load in the player.
This PR fixes the problem - Itch.io SWFs load when opened in a new tab after my change is applied.
2022-01-24 19:01:11 -08:00
relrelb 479719f425 web: De-duplicate TypeScript ESLint rules
Pull them to the root config, using the `overrides` feature:
https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns
2022-01-16 11:07:00 -08:00
relrelb 3f8f117fd3 web: Convert .eslintrc files from JSON to YAML
YAML is shorter, more modern, readable, and flexible than JSON.
In other words, YAML >>> JSON.

Auto-converted using [`yq`](https://github.com/kislyuk/yq).
2022-01-12 20:10:00 -08:00
Daniel Jacobs 5127e131bd extension: Fix base for direct swf links 2021-12-15 14:00:02 -08:00
Daniel Jacobs d3a5561e8f web: Give toggleable option to download swfs in extension/selfhosted 2021-11-15 23:12:27 +02:00
relrelb f3a482a48f extension: Prefer functions over methods
TypeScript is more strict with functions. Fix 2 instances affected
by this change.
2021-10-02 08:58:31 +03:00
relrelb b250dd5ff1 extension: Fix popup reload tab button
Previously the popup page fetched only the `ruffleEnable` and `ruffleOptout`
options because only those appear in `popup.html`. So the remaining
options were always returned with their default value, making the popup
page think that all tabs need to be reloaded when these options have a
non-default value.

Remove the `keys` parameter of `getOptions`, and instead make it always
return all options. Adapt all usages of `getOptions`, which got simplified
by this change.
2021-10-02 08:58:31 +03:00
relrelb 7bb2b5918f extension: Simplify `utils.ts`
In some cases, extension API abstraction objects can be assigned directly
with the equivalent extension API namespace. This reduces much trivial
code that just duplicates all the needed functions.

Also, extract `promisifyStorageArea` to share duplicate code between
the conversions of `chrome.storage.local` and `chrome.storage.sync`
(though `local` is not currently used).
2021-10-02 08:58:31 +03:00
relrelb a3acdac0f9 extension: Rename `tabSettings` to `tabOptions`
This aligns with the rest of the code that uses the term "options"
rather than "settings".
2021-10-02 08:58:31 +03:00
relrelb d5b223c1b3 extension: Add log level option 2021-09-26 07:57:37 +03:00