#!/bin/bash ######################################################################## # # A bash script for setting up a WolfreeAlpha instance locally without # using Docker. This script requires wget to be available and will install # WolfreeAlpha to the /srv/wolfree/ directory by default. # # The user running this script must have write access to the destination # directory. The script will create the directory if it does not exist. # # The script does *not* install a web server. You will need to configure # the web server of your choice to serve the destination directory. # # This file was developed as part of the Private.coffee project. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Upstream Repository: https://try.gitea.io/wolfree/wolfree-dockerfile/ # Latest commit: 2b238370683abafae2bdd6b89651e104c7dc9989 # ######################################################################## DESTINATION = /srv/wolfree/ # Get files from WolframAlpha rm -rf /tmp/wolfree mkdir /tmp/wolfree wget --recursive --level=1 --adjust-extension --span-hosts \ --convert-links --page-requisites --no-parent -P /tmp/wolfree \ https://www.wolframalpha.com/input/index.html sed ' s/.*js...static.chunks........../https:\/\/www.wolframalpha.com\/_next\/static\/chunks\// ; s/".......js.....miniCssF.*/.js\n/ ; s/:"/./g ; s/",/.js\nhttps:\/\/www.wolframalpha.com\/_next\/static\/chunks\//g ; ' /tmp/wolfree/www.wolframalpha.com/_next/static/chunks/webpack* | wget --page-requisites --convert-links --input-file - sed ' s/.*return.static.css..../https:\/\/www.wolframalpha.com\/_next\/static\/css\// ; s/........css.......function.*/.css\n/ ; s/[0-9]*:"//g ; s/",/.css\nhttps:\/\/www.wolframalpha.com\/_next\/static\/css\//g ; ' /tmp/wolfree/www.wolframalpha.com/_next/static/chunks/webpack* | wget --page-requisites --convert-links --input-file - # Move files to destination directory rm -rf $DESTINATION/* mkdir -p $DESTINATION mv /tmp/wolfree/www.wolframalpha.com/* $DESTINATION true | tee $DESTINATION/_next/static/images/* mkdir -p $DESTINATION/users/me/ echo >$DESTINATION/users/me/account mkdir -p $DESTINATION/n/v1/api/ echo >$DESTINATION/n/v1/api/randomizer mkdir -p $DESTINATION/n/v1/api/sourcer/ echo >$DESTINATION/n/v1/api/sourcer/index.html echo >$DESTINATION/n/v1/api/sourcer/dataSources mkdir -p $DESTINATION/n/v1/api/samplefiles/fileinput/ echo >$DESTINATION/n/v1/api/samplefiles/fileinput/examples mkdir -p $DESTINATION/n/v1/api/autocomplete/ echo >$DESTINATION/n/v1/api/autocomplete/index.html # Get dependencies of WolfreeAlpha wget -P $DESTINATION/input/ https://raw.githubusercontent.com/cure53/DOMPurify/main/dist/purify.min.js wget -P $DESTINATION/input/ https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js wget -P $DESTINATION https://unpkg.com/chota@0.8.1/dist/chota.min.css # Patching files from WolframAlpha echo ' ' >>$DESTINATION/input/index.html needle="try\{[^;]*?utils2D\.generateEncodedJSONFromValue.*?\{}" m=$(grep -oP -m1 "$needle" $DESTINATION/_next/static/chunks/*.js | grep -oP -m1 '(?<=try\{)\w+(?=\.\w+\?)') sed -i ' s/'"$needle"'/ \ '"$m"'.value = new URLSearchParams(location.search).get`i` || `mathematics`; \ '"$m"'.i2d = new URLSearchParams(location.search).get`i2d` == `true`; \ & \ wolfree.i2d = '"$m"'.i2d; \ wolfree.input = '"$m"'.value; \ setTimeout(wolfree.main); \ / ' $DESTINATION/_next/static/chunks/*.js sed -i ' s/webSocket=new WebSocket/ \ webSocket = new WebSocket(`wss:\/\/www.wolframalpha.com\/n\/v1\/api\/fetcher\/results`), \ / ' $DESTINATION/_next/static/chunks/pages/*.js # Writing WolfreeAlpha Files cat >$DESTINATION/input/wolfree.js <<'EOT' // SPDX-License-Identifier: AGPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. 'use strict' const wolfree = { main: async () => { // To generate a new AppID: // 1. Open Tor Browser and go to: https://products.wolframalpha.com/api/ // 2. Click the orangish "Get API Access" button. You will go to: https://account.wolfram.com/login/oauth2/sign-in // 3. Click the reddish "Create one" hyperlink to create a new Wolfram ID. You will go to: https://account.wolfram.com/login/create // 4. Fill out the form using random alphanumeric characters. // 5. Click the reddish "Create Wolfram ID" button. You will go to: https://developer.wolframalpha.com/portal/myapps/index.html // 6. Click the orangish "Sign up to get your first AppID" button. // 7. Fill out the form using random alphanumeric characters. // 8. Click the orangish "Sign up" button. // 9. Click the orangish "Get an AppID" button. // 10. Fill out the form using random alphanumeric characters. // 11. Click the orangish "Get AppID" button. const appIDArray = [ 'H9V325-HTALUWHKGK', 'AKJTJT-LR5LL8WTG6', 'LKY83U-XW6ATU9URU', ] // f8RCUrgvdPqq return // hide the results of previous calculations setTimeout( () => { document.querySelectorAll`div[data-wolfree-pods]`.forEach( element => element.remove() ) } ) // show the skeleton placeholder components document.querySelector` div [class="_3Cg6"], div [class="_2UIf"] `.insertAdjacentHTML( 'afterend', `
` ) const response = await jQuery.ajax( { // https://products.wolframalpha.com/api/documentation // https://learn.jquery.com/ajax/working-with-jsonp/ // https://stackoverflow.com/questions/30008144/jquery-ajax-data-object-with-multiple-values-for-the-same-key // https://stackoverflow.com/questions/11704267/in-javascript-how-to-conditionally-add-a-member-to-an-object url: 'https://api.wolframalpha.com/v2/query', dataType: 'jsonp', traditional: true, data: { output: 'json', reinterpret: true, podtimeout: 30, scantimeout: 30, parsetimeout: 30, totaltimeout: 30, formattimeout: 30, appid: appIDArray[ // https://stackoverflow.com/questions/41437492/how-to-use-window-crypto-getrandomvalues-to-get-random-values-in-a-specific-rang crypto.getRandomValues(new Uint32Array(1)) % appIDArray.length ], podstate: [ 'Step-by-step solution', 'Step-by-step', 'Show all steps', wolfree.podstate, ], ... wolfree.i2d && {i2d: wolfree.i2d}, input: wolfree.input, }, } ) // hide the skeleton placeholder components setTimeout( () => { document.querySelectorAll`div[data-wolfree-placeholder]`.forEach( element => element.remove() ) } ) document.querySelector` div [class="_3Cg6"], div [class="_2UIf"] `.insertAdjacentHTML( 'afterend', // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Safely_inserting_external_content_into_a_page#working_with_html_content // https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#html-sanitization DOMPurify.sanitize( // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#nesting_templates `
${ response.queryresult.pods?.map( pod => `
${ `

${pod.title}

${ pod.states?.map( state => state.states ? ` ` : '' ).join('') || '' }
${ pod.subpods.map( subpod => `
${subpod.plaintext}

` ).join`` } ` }
` ).join('') || '' }

Wolfree diagnostics


If something goes wrong,
you can report the error
to the Wolfree community
on the Fediverse.

When using the Fediverse
to report an error, send
the following diagnostic
info to help investigate
the causes of the error.

${
                                                            JSON.stringify(
                                                                {
                                                                    wolfree,
                                                                    document,
                                                                    userAgent: navigator?.userAgent,
                                                                    Date: Date(),
                                                                    DateTimeFormat: Intl?.DateTimeFormat()?.resolvedOptions(),
                                                                    response,
                                                                },
                                                                null,
                                                                4
                                                            )
                                                        }

`, // https://github.com/cure53/DOMPurify#can-i-configure-dompurify {ADD_ATTR: ['contenteditable']} ) ) setTimeout( // Use the drop down menu for different problem-solving strategies () => { // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event document.querySelectorAll`select`.forEach( element => element.addEventListener( 'change', event => { wolfree.podstate = event.target.value setTimeout(wolfree.main) window.scroll(0,0) } ) ) } ) }, customize: () => { [ {selector: 'header', includes: 'UPGRADE TO PRO'}, {selector: 'a[href="https://www.wolframalpha.com/pro/pricing/students"]', includes: ''}, {selector: 'a[href="https://www.wolframalpha.com/"]', includes: ''}, {selector: 'div[role="tooltip"]', includes: 'to directly enter textbook math notation'}, {selector: 'a[href="https://www.wolframalpha.com/examples"]', includes: ''}, {selector: 'main section section ul li button', includes: 'Step-by-step solution'}, {selector: 'img[alt="OUTPUT_ZOOM_HEADER"]', includes: ''}, {selector: 'img[alt="DATA_DOWNLOAD_HEADER"]', includes: ''}, {selector: 'img[alt="CUSTOMIZE_HEADER"]', includes: ''}, {selector: 'img[alt="PLAIN_TEXT_HEADER"]', includes: ''}, {selector: 'img[alt="SOURCES"]', includes: ''}, // /input/?i=California {selector: 'img[alt="Zoom in to see an enlarged view of any input."]', includes: ''}, {selector: 'img[alt="Tables & Spreadsheets icon"]', includes: ''}, {selector: 'img[alt="Tables & Spreadsheets color icon"]', includes: ''}, {selector: 'img[alt="Math Typesetting icon"]', includes: ''}, {selector: 'img[alt="Math Typesetting color icon"]', includes: ''}, {selector: 'img[alt="Raster Graphics icon"]', includes: ''}, {selector: 'img[alt="Raster Graphics color icon"]', includes: ''}, {selector: 'img[alt="Vector Graphics icon"]', includes: ''}, {selector: 'img[alt="Vector Graphics color icon"]', includes: ''}, {selector: 'img[alt="Web Format icon"]', includes: ''}, {selector: 'img[alt="Web Format color icon"]', includes: ''}, {selector: 'img[alt="Wolfram Formats icon"]', includes: ''}, {selector: 'img[alt="Wolfram Formats color icon"', includes: ''}, {selector: 'img[alt="Choose Color Scheme:"]', includes: ''}, {selector: 'a[href="/pro/pricing/"]', includes: ''}, {selector: 'a[href="https://www.wolframalpha.com/pro/"]', includes: ''}, {selector: 'main span', includes: 'Already have Pro?'}, {selector: 'main button[type="button"]', includes: 'Sign in'}, {selector: 'main span', includes: 'Download your full results as a single interactive or static document for offline use.'}, {selector: 'main section', includes: 'Try again with Pro computation time'}, // Derivative[21][y][x] == y[x] {selector: 'a[href="/pro-premium-expert-support"]', includes: ''}, {selector: 'a[href="/feedback"]', includes: ''}, {selector: 'footer', includes: 'Pro'}, // Upload {selector: 'main h2 span', includes: '(PRO)'}, {selector: 'main span', includes: 'Enter an image as an input to Wolfram|Alpha for analysis or processing.'}, {selector: 'main span', includes: 'Feed numeric and tabular data into Wolfram|Alpha for analysis'}, {selector: 'main span', includes: 'Run analyses and computations on 60+ types of data and other files.'}, {selector: 'main span', includes: 'Try these sample images and see what Wolfram|Alpha Pro can do.'}, {selector: 'main span', includes: 'Try this sample data and see what Wolfram|Alpha Pro can do'}, {selector: 'main button[type="button"]', includes: 'Sample Images'}, {selector: 'main button[type="button"]', includes: 'Sample Data'}, {selector: 'main button[type="button"]', includes: 'Supported formats and sample files'}, {selector: 'a[href="https://www.wolframalpha.com/input/pro/uploadexamples/"]', includes: ''}, {selector: 'a[href="https://www.wolframalpha.com/termsofuse/"]', includes: ''}, {selector: 'a[href="https://www.wolfram.com/legal/privacy/wolfram/index.html"]', includes: ''}, {selector: 'main button[type="button"]', includes: 'Upload a file'}, // Enlarge {selector: 'main span', includes: 'Wolfram|Alpha Output Zoom'}, {selector: 'main span', includes: 'Zoom in to see an enlarged view of any input.'}, // Data {selector: 'main span', includes: 'Not for commercial distribution.'}, {selector: 'main span', includes: 'Download raw data generated by Wolfram|Alpha for your use.'}, {selector: 'a[href="https://www.wolframalpha.com/input/pro/downloadexamples/"]', includes: ''}, {selector: 'a[href="https://www.wolframalpha.com/termsofuse"]', includes: ''}, // Customize {selector: 'main span', includes: 'Save your customized Wolfram|Alpha results.'}, ].forEach( data => Array.from( document.querySelectorAll(data.selector) ).filter( element => element.innerHTML.includes(data.includes) ).forEach( element => element.style.display = 'none' ) ) setTimeout( // insert the wolfree navbar () => document.querySelector` [data-wolfree-navbar] ` || document.querySelector` body `.insertAdjacentHTML( 'afterbegin', ` ` ) ) document.title = document.title.replace( '- Wolfram|Alpha', '- Free Wolfram Alpha Step-by-step Solution - Wolfree' ) }, } addEventListener( // https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event 'load', async () => { while (document.activeElement != document.querySelector`input`) { // focus on the orangish input box document.querySelector`input`.focus() // https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep await new Promise(resolve => setTimeout(resolve, 1000)) } } ) addEventListener( // https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event 'click', () => setTimeout(wolfree.customize) ) setInterval(wolfree.customize, 1000) EOT cat >$DESTINATION/instances.json <<'EOT' { "wolfree": { "clearnet": [ "https://wolfree.chickenkiller.com/", "https://wolfree.crabdance.com/", "https://wolfree.gitlab.io/", "https://wolfree.glitch.me/", "https://wolfree.ignorelist.com/", "https://wolfree.jumpingcrab.com/", "https://wolfree.mooo.com/", "https://wolfree.my.to/", "https://wolfree.netlify.app/", "https://wolfree.on.fleek.co/", "https://wolfree.onrender.com/", "https://wolfree.pages.dev/", "https://wolfree.privatedns.org/", "https://wolfree.strangled.net/", "https://wolfree.twilightparadox.com/", "https://wolfree.uk.to/", "https://wolfree.us.to/", "https://wolfreealpha.chickenkiller.com/", "https://wolfreealpha.crabdance.com/", "https://wolfreealpha.gitlab.io/", "https://wolfreealpha.glitch.me/", "https://wolfreealpha.ignorelist.com/", "https://wolfreealpha.jumpingcrab.com/", "https://wolfreealpha.mooo.com/", "https://wolfreealpha.my.to/", "https://wolfreealpha.netlify.app/", "https://wolfreealpha.on.fleek.co/", "https://wolfreealpha.onrender.com/", "https://wolfreealpha.pages.dev/", "https://wolfreealpha.privatedns.org/", "https://wolfreealpha.strangled.net/", "https://wolfreealpha.twilightparadox.com/", "https://wolfreealpha.uk.to/", "https://wolfreealpha.us.to/" ], "tor": [], "i2p": [], "loki": [] } } EOT mkdir $DESTINATION/mirror cat >$DESTINATION/mirror/index.html <<'EOT' Mirror - Wolfree

Mirror

Bookmark the following mirror sites so you can try other mirrors when the Internet service providers have broken the Internet connection to this site. Machine-readable data: instances.json

  1. https://wolfree.chickenkiller.com/
  2. https://wolfree.crabdance.com/
  3. https://wolfree.gitlab.io/
  4. https://wolfree.glitch.me/
  5. https://wolfree.ignorelist.com/
  6. https://wolfree.jumpingcrab.com/
  7. https://wolfree.mooo.com/
  8. https://wolfree.my.to/
  9. https://wolfree.netlify.app/
  10. https://wolfree.on.fleek.co/
  11. https://wolfree.onrender.com/
  12. https://wolfree.pages.dev/
  13. https://wolfree.privatedns.org/
  14. https://wolfree.strangled.net/
  15. https://wolfree.twilightparadox.com/
  16. https://wolfree.uk.to/
  17. https://wolfree.us.to/
  18. https://wolfreealpha.chickenkiller.com/
  19. https://wolfreealpha.crabdance.com/
  20. https://wolfreealpha.gitlab.io/
  21. https://wolfreealpha.glitch.me/
  22. https://wolfreealpha.ignorelist.com/
  23. https://wolfreealpha.jumpingcrab.com/
  24. https://wolfreealpha.mooo.com/
  25. https://wolfreealpha.my.to/
  26. https://wolfreealpha.netlify.app/
  27. https://wolfreealpha.on.fleek.co/
  28. https://wolfreealpha.onrender.com/
  29. https://wolfreealpha.pages.dev/
  30. https://wolfreealpha.privatedns.org/
  31. https://wolfreealpha.strangled.net/
  32. https://wolfreealpha.twilightparadox.com/
  33. https://wolfreealpha.uk.to/
  34. https://wolfreealpha.us.to/

Acknowledgment

See the acknowledgment page for details.

EOT mkdir $DESTINATION/dmca cat >$DESTINATION/dmca/index.html <<'EOT' DMCA - Wolfree

DMCA

Copyright owners may sue infringers, which can be expensive and time-consuming. The DMCA "notice and takedown" process is much cheaper and takes less time.

DMCA takedown notice

Here are some DMCA takedown notices from Wolfram Alpha LLC.

The math output from scientific calculators on the Wolfree mirror sites may be objectionable. If you believe someone is using your copyrighted content unauthorizedly on Microsoft GitHub, fill out the form hyperlinked below to submit a DMCA takedown notice to request that the content be changed or removed.

As with all legal matters, it is always best to consult a professional about your questions or situation. The Wolfree community strongly encourages you to do so before taking action that might impact your rights. All content on this site is not legal advice.

Acknowledgment

See the acknowledgment page for details.

EOT mkdir $DESTINATION/acknowledgment cat >$DESTINATION/acknowledgment/index.html <<'EOT' Acknowledgment - Wolfree

Acknowledgment

The following communities are not directly involved in the Wolfree community but have contributed conceptual inspiration or criticism. They may create Web services that indirectly benefit the Wolfree community on the Fediverse.

The Fediverse

The Fediverse is a federated social network consisting of independently hosted servers. There are autonomous servers for blogging, photo sharing, and video sharing, and they are all interconnected seamlessly. So you only need one account to follow anyone on any compatible social media platform.

Thanks to the people on the Fediverse, the website operators of the Wolfree mirror sites and the programmers of the Wolfree Dockerfile can collaborate freely.

Gitea

Gitea is a community-managed code hosting solution. Thanks to the people on Gitea, the programmers of the Wolfree Dockerfile can distribute the source code on the Fediverse freely.

Copyleft

Copyleft says that anyone who redistributes the software, with or without changes, must pass along the freedom to copy and change it further.

Internet Archive

The Internet Archive is a non-profit library that lends digital copies of books. Penguin Random House, HarperCollins, Hachette, and Wiley claim that the Internet Archive infringes copyright by lending digital books.

Sci-Hub

Sci-Hub is a shadow library website that provides free access to millions of research papers and books.

Library Genesis

Library Genesis (Libgen) is a shadow library website for scholarly journal articles, academic and general-interest books, audiobooks, and magazines.

Censorship circumvention

Learn how to circumvent censorship on the Internet safely.

The Internet Infrastructure

The big-I Internet is falling apart and becoming many little-i internets. The Internet can be much healthier and more vibrant if we eliminate the artificial restrictions imposed by third parties. How do we preserve the Internet for future generations?

EOT cat >$DESTINATION/index.html <<'EOT' Free Wolfram Alpha Step-by-step Solution - Wolfree

Free Wolfram Alpha
Step-by-step Solution

Wolfree bypasses paywalls and shares step-by-step solutions. (It's like Sci-Hub, but Sci-Hub shares scholarly literature.) Wolfree is free and open-source.

 Learn More 

How to use

For example, if y'=y is the math problem,

  1. Type y'=y in the text box above.
  2. Click the blue "Show Steps" button.
  3. Read the step-by-step solutions.

If something goes wrong, try other mirror sites.

Mirror

See the list of mirrors for details. Try other mirrors when the Internet service providers have broken the Internet connection to this site.

Fediverse

The Wolfree community on the Fediverse may post Web addresses of new mirror sites. Try the new mirrors when the Internet service providers have broken the Internet connection to the older mirrors.

If your Internet service providers have broken the Internet connection to the Fediverse, install Tor Browser to circumvent censorship.

Source

Microsoft GitHub is unreliable due to the DMCA. Internet hosting services compatible with the Fediverse, such as ForgeFed and Gitea, are much more reliable than Microsoft GitHub. You can find the source code on the following Gitea servers.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

DMCA

See some DMCA takedown notices from Wolfram Alpha LLC.

How it works

Internet service providers, Web hosting service providers, the website operators of the Wolfree mirror sites, and the programmers of the Wolfree Dockerfile can help you get Wolfram Alpha Pro step-by-step solutions for free. Here's how:

  1. The programmers of the Wolfree Dockerfile distribute the source code on the Fediverse, such as ForgeFed and Gitea.
  2. The website operators of the Wolfree mirror sites download the Wolfree Dockerfile from the Fediverse.
  3. Docker Engine reads the Wolfree Dockerfile and automatically configures the Web servers.
  4. Some Web hosting service providers run many Web servers and deploy the Wolfree mirror sites.
  5. Enough Internet service providers cooperate, so your Web browser can connect to the Wolfree mirror sites.
  6. You successfully read Wolfram Alpha Pro step-by-step solutions for free.

Intention

Get step-by-step answers and hints for your math homework problems. Learn the basics, check your work, and gain insight into ways to solve problems.

Use step-by-step calculators for chemistry, calculus, algebra, trigonometry, and equation solving. Gain more understanding of your homework with steps and hints guiding you from problems to answers.

The Wolfree mirror sites not only give you the answers you're looking for but also help you learn how to solve problems. The Wolfree mirror sites leverage the Wolfram Language to allow free-form linguistic input of computations and programs.

The Wolfree mirror sites bring extensive data and computation capabilities derived from the Wolfram knowledgebase and curated data. The Wolfree mirror sites integrate interactive and programmatic access to the full power of the Wolfram Alpha computational knowledge engine.

Acknowledgment

See the acknowledgment page for details.

EOT # Clean up the temporary directory. rm -rf /tmp/wolfree