Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Playground #67

Merged
merged 24 commits into from
Dec 11, 2023
Merged

feat: Playground #67

merged 24 commits into from
Dec 11, 2023

Conversation

joncrangle
Copy link
Contributor

@joncrangle joncrangle commented Dec 8, 2023

Migrating prior work over to utilize the new api/modifiers endpoint and codegen structs.

Outstanding todos

  • Testing

Complete

  • Link to playground from form.html

Export yaml button

  • Parse JSON to YAML - used js-yaml package
  • Download YAML file

Injection scripts modal

  • Javascript syntax highlighting within textarea layout, styling and event listeners - overlap code and textarea tags - used prism.js
  • Textarea handlers and logic for javascript (e.g. tab, newline)

Potential future improvements

  • Group related modifiers in Ninja Keys under a parent - empty function for parent, use function Comments to specify children; specify parent in children?
  • Untoggle related items that may be toggled (e.g. should only have one masquerade as bot toggled) - use function Comments to specify items that should be untoggled?

@joncrangle joncrangle marked this pull request as ready for review December 10, 2023 06:25
@ladddder
Copy link
Contributor

I'll have a closer look today.

@ladddder
Copy link
Contributor

I tried this Article : https://www.nytimes.com/2023/12/10/us/harvard-president-claudine-gay.html
And did not manage to get a result as on the default route. I assume the default does not apply on the playground.

image

@joncrangle
Copy link
Contributor Author

The proxy route applies some modifications by default:

SetRequestModifications(
	rx.AddCacheBusterQuery(),
	rx.MasqueradeAsGoogleBot(),
	rx.ForwardRequestHeaders(),
	rx.DeleteOutgoingCookies(),
	rx.SpoofReferrerFromRedditPost(),
).
AddResponseModifications(
	tx.ForwardResponseHeaders(),
	tx.BlockThirdPartyScripts(),
	tx.DeleteIncomingCookies(),
	tx.DeleteLocalStorageData(),
	tx.DeleteSessionStorageData(),
	tx.BypassCORS(),
	tx.BypassContentSecurityPolicy(),
	tx.RewriteHTMLResourceURLs(),
	tx.PatchDynamicResourceURLs(),
	tx.PatchTrackerScripts(),
)

Currently, the playground is completely blank - no modifications applied unless the user selects them, but we could very easily apply some sensible defaults if that makes more sense by adding them within playground.go:

return proxychain.
	NewProxyChain().
	SetFiberCtx(c).
	WithAPIPath(path).
	AddResponseModifications(
		// sensible defaults
	).
	AddResponseModifications(
		// sensible defaults
	).
	AddOnceRequestModifications(modificationData.RequestModifications...).
	AddOnceResponseModifications(modificationData.ResponseModifications...).
	Execute()

@deoxykev deoxykev merged commit 0940bbb into everywall:origin/proxy_v2 Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants