--- /dev/null
+<?xml version='1.0' encoding='utf-8'?>
+<widget id="com.cordova.react" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <name>HelloCordova</name>
+ <description>
+ A sample Apache Cordova application that responds to the deviceready event.
+ </description>
+ <author email="dev@cordova.apache.org" href="http://cordova.io">
+ Apache Cordova Team
+ </author>
+ <content src="index.html" />
+ <access origin="*" />
+ <allow-navigation href="*" />
+ <allow-intent href="http://*/*" />
+ <allow-intent href="https://*/*" />
+ <allow-intent href="tel:*" />
+ <allow-intent href="sms:*" />
+ <allow-intent href="mailto:*" />
+ <allow-intent href="geo:*" />
+ <platform name="android">
+ <allow-intent href="market:*" />
+ <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
+ <application android:usesCleartextTraffic="true" />
+ </edit-config>
+ </platform>
+ <platform name="ios">
+ <allow-intent href="itms:*" />
+ <allow-intent href="itms-apps:*" />
+ </platform>
+</widget>
--- /dev/null
+#!/bin/python
+
+import http.server
+import socketserver
+from http import HTTPStatus
+import requests
+import argparse
+import os
+
+UPSTREAM = 'https://marnanel.org'
+PORT = 6888
+
+class GatewayHandler(http.server.BaseHTTPRequestHandler):
+
+ server_version = 'fake-dw/0.0.1'
+
+ keep_headers = [
+ 'content-type',
+ 'content-length',
+ ]
+
+ def do_HEAD(self):
+ r = requests.get(
+ self.request_url(),
+ )
+
+ self.transfer_status_and_headers(r)
+
+ def do_OPTIONS(self):
+ r = requests.get(
+ self.request_url(),
+ )
+
+ self.transfer_status_and_headers(r)
+
+ def do_GET(self):
+ r = requests.get(
+ self.request_url(),
+ stream = True,
+ )
+
+ self.transfer_status_and_headers(r)
+
+ try:
+ for chunk in r.iter_content(chunk_size=1024):
+ self.wfile.write(chunk)
+ except ConnectionError as e:
+ print(e)
+
+ def request_url(self):
+ result = f'{self.server.upstream}{self.path}'
+ print(result)
+ return result
+
+ def transfer_status_and_headers(self, r):
+
+ print('Received: ',r.status_code)
+
+ self.send_response(r.status_code)
+
+ self.send_header(
+ 'Access-Control-Allow-Origin',
+ '*',
+ )
+
+ for f,v in r.headers.items():
+ if f.lower() in self.keep_headers:
+ print(f, v)
+ self.send_header(f, v)
+ else:
+ print(f, v, '-- dropped')
+
+ self.end_headers()
+
+class ErsatzHandler(http.server.BaseHTTPRequestHandler):
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+
+ self.template_dir = os.path.join(
+ os.path.dirname(__file__),
+ 'templates',
+ )
+
+ print(self.template_dir)
+
+class TCPServerWithSettings(socketserver.TCPServer):
+
+ def __init__(
+ self,
+ *args,
+ **kwargs,
+ ):
+
+ self.settings = kwargs['settings']
+ del kwargs['settings']
+
+ super().__init__(*args, **kwargs)
+
+def main():
+
+ parser = argparse.ArgumentParser(
+ description="act as a server for testing dwim",
+ )
+ parser.add_argument('-g', '--gateway',
+ action='store_const',
+ dest='handler',
+ const=GatewayHandler,
+ help='Forward requests to the real Dreamwidth.',
+ )
+ parser.add_argument('-e', '--ersatz',
+ action='store_const',
+ dest='handler',
+ const=ErsatzHandler,
+ help='Pretend to be Dreamwidth.',
+ )
+ parser.add_argument('-p', '--port',
+ type=int,
+ default=6887,
+ help='Port to listen on. Defaults to 6887.',
+ )
+ parser.add_argument('-u', '--upstream',
+ type=str,
+ default='https://dreamwidth.org',
+ help='URL of upstream server, for gateway mode',
+ )
+ args = parser.parse_args()
+
+ if not args.handler:
+ parser.print_usage()
+ return
+
+ with TCPServerWithSettings(
+ ("", args.port),
+ args.handler,
+ settings = args,
+ ) as httpd:
+
+ httpd.allow_reuse_address = True
+ print(f"Now serving {args.handler} at port {args.port}.")
+
+ httpd.serve_forever()
+
+if __name__=='__main__':
+ main()
+
--- /dev/null
+ HTTP/1.1 200 OK
+ Date: Wed, 24 Nov 2021 19:18:56 GMT
+ Content-Type: text/html; charset=utf-8
+ Transfer-Encoding: chunked
+ Connection: keep-alive
+ CF-Ray: 6b34fc6adb96777a-LHR
+ Cache-Control: private, proxy-revalidate
+ Content-Language: en
+ ETag: W/"1bc66171be1d3ac34df7fdb81376235a-gzip"
+ Expires: Wed, 24 Nov 2021 19:18:56 GMT
+ Set-Cookie: ljuniq=09Z5PuIllU4vZho%3A1637781536; domain=.dreamwidth.org; path=/; expires=Sun, 23-Jan-2022 19:18:56 GMT; secure
+ Vary: Accept-Encoding
+ CF-Cache-Status: DYNAMIC
+ Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
+ Pragma: no-cache
+ Server: cloudflare
+Length: unspecified [text/html]
+
+
+
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>Log in</title>
+
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+
+ <script type="text/javascript">
+ var Site;
+ if (!Site)
+ Site = {};
+
+ var site_p = {"user_domain": "dreamwidth.org",
+"ctx_popup": 1,
+"imgprefix": "https://www.dreamwidth.org/img",
+"cmax_comment": 16000,
+"media_embed_enabled": 1,
+"ctx_popup_icons": 1,
+"currentJournalBase": "",
+"inbox_update_poll": 1,
+"siteroot": "https://www.dreamwidth.org",
+"iconprefix": "https://v.dreamwidth.org",
+"esn_async": 1,
+"ctx_popup_userhead": 1,
+"has_remote": 0,
+"currentJournal": "",
+"statprefix": "https://www.dreamwidth.org/stc"};
+ var site_k = ["user_domain", "ctx_popup", "imgprefix", "cmax_comment", "media_embed_enabled", "ctx_popup_icons", "currentJournalBase", "inbox_update_poll", "siteroot", "iconprefix", "esn_async", "ctx_popup_userhead", "has_remote", "currentJournal", "statprefix"];
+ for (var i = 0; site_k.length > i; i++) {
+ Site[site_k[i]] = site_p[site_k[i]];
+ }
+ </script>
+ <link rel="stylesheet" type="text/css" href="https://www.dreamwidth.org/stc/??lj_base.css,esn.css,contextualhover.css,jquery/jquery.ui.theme.smoothness.css,lj_base-app.css,base-colors-light.css,reset.css,tropo/tropo-base.css,tropo/tropo-red.css?v=1593299549" />
+<link rel="stylesheet" type="text/css" href="https://www.dreamwidth.org/stc/??widgets/login.css?v=1587938565" />
+<script type="text/javascript" src="//www.dreamwidth.org/js/??6alib/core.js,6alib/dom.js,6alib/httpreq.js,livejournal.js,esn.js,6alib/ippu.js,lj_ippu.js,6alib/hourglass.js,contextualhover.js,nav.js?v=1595720038"></script>
+
+
+
+ <script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-4595135-1']);
+ _gaq.push(['_trackPageview']);</script>
+
+ <!--[if lte IE 8]>
+ <script src="//www.dreamwidth.org/js/html5.js" type="text/javascript"></script>
+ <![endif]-->
+</head>
+ <body >
+ <div id="canvas">
+ <div id="page">
+<div id="skip">
+ <a href="#content" tabindex="1">Skip to Main Content</a>
+</div>
+
+ <div id="masthead" role="banner">
+ <span id="logo">
+ <a href="https://www.dreamwidth.org/"><img alt="Dreamwidth Studios" src='https://www.dreamwidth.org/img/tropo-red/dw_logo.png' /></a>
+ </span>
+ </div>
+
+ <div id="content" role="main" > <h1>Log in</h1>
+ <table summary='' cellpadding='0' cellspacing='0'><tr><td style='padding-right:20px; vertical-align: top'><div class='columns-2-r300 pkg'>
+<div class='columns-2-left'>
+<div class='appwidget appwidget-login' id='LJWidget_24'>
+<form action='https://www.dreamwidth.org/login' method='post' class='lj_login_form pkg'>
+<input type='hidden' name="lj_form_auth" value="c0:1637780400:1136:86400:5Asn7kYkEd-0-09Z5PuIllU4vZho:f738ddb050a4c83e380ac95c665689ac" /><h2>Welcome to Dreamwidth!</h2>
+<fieldset class='pkg nostyle'>
+<label for='user' class='left'>Account name:</label>
+<input type='text' value='' name='user' id='user' class='text' size='18' maxlength='27' style='' tabindex='11' />
+</fieldset>
+<fieldset class='pkg nostyle'>
+<label for='lj_loginwidget_password' class='left'>Password</label>
+<input type='password' id='lj_loginwidget_password' name='password' class='lj_login_password text' size='20' maxlength='72' tabindex='12' /><a href='https://www.dreamwidth.org/lostinfo' class='small-link' tabindex='16'>Forgot your password?</a>
+</fieldset>
+<p><input type='checkbox' name='remember_me' id='remember_me' value='1' tabindex='13' /> <label for='remember_me'>Remember me</label></p><p><input name='action:login' type='submit' value='Log in' tabindex='14' /> <a href='https://www.dreamwidth.org/openid/' class='small-link' tabindex='15'>Log in with OpenID</a></p></form>
+</div><!-- end .appwidget-login -->
+<div class='login-create-account'>
+<hr class='hr' />
+<h4>Not a Dreamwidth Studios member?</h4>
+<form action='/create' method='get'><input type='submit' value='Create an Account' class='submit' /></form>
+<ul>
+<li>Read filtered entries that you have access to.</li><li>Leave comments in any journal or community.</li><li>Post entries in your own journal.</li><li>Add any journal or community to your Reading Page.</li><li>Use features that are only visible when you're logged in.</li></ul>
+</div><!-- end .login-create-account -->
+</div><!-- end .columns-2-left -->
+</td></tr></table>
+ </div>
+
+
+<div id="account-links" role="navigation" aria-label="Account Links"> <form action='https://www.dreamwidth.org/login?ret=1' method='post' class='lj_login_form'><input type="hidden" name="returnto" value="" /><input type='hidden' name='chal' class='lj_login_chal' value='c0:1637780400:1136:300:vDj8O3s4LdBsZAZiYqFI:2056608643f72ae24a1bdac9f9990ad6' />
+ <input type='hidden' name='response' class='lj_login_response' value='' />
+ <table summary='' id='login-table'><tr><td><label for='login_user'>Account name:</label></td><td class='input-cell' colspan='2'><input name="user" id="login_user" size="20" maxlength="27" tabindex="1" aria-required="true" /> <a href='https://www.dreamwidth.org/openid/' tabindex=5>Log in with OpenID?</a></td></tr><tr><td><label for='login_password'>Password:</label></td><td class='input-cell' colspan='2'><input type="password" name="password" id="login_password" size="20" tabindex="2" aria-required="true" class="lj_login_password"> <a href='https://www.dreamwidth.org/lostinfo' tabindex=6>Forget your password?</a></td></tr><tr><td> </td><td class='remember-me-cell'><input type="checkbox" name="remember_me" id="login_remember_me" value="1" tabindex="3" /> <label for='login_remember_me'>Remember me</label></td><td><input type="submit" name="login" value="Log in" tabindex="4"/></td></tr></table></form>
+</div>
+
+ <nav role="navigation" aria-label="Site Navigation">
+ <ul class="left"><li id='create_topnav' class='topnav has-dropdown'><a href='https://www.dreamwidth.org/nav/create'>Create</a>
+<ul id='create_subnav' class='subnav_container dropdown'>
+ <li class='subnav'><a href='https://www.dreamwidth.org/create'>Create Account</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/manage/settings/?cat=display'>Display Preferences</a></li>
+</ul>
+</li><li id='explore_topnav' class='topnav has-dropdown'><a href='https://www.dreamwidth.org/nav/explore'>Explore</a>
+<ul id='explore_subnav' class='subnav_container dropdown'>
+ <li class='subnav'><a href='https://www.dreamwidth.org/interests'>Interests</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/directorysearch'>Directory Search</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/search'>Site and Journal Search</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/latest'>Latest Things</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/random'>Random Journal</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/community/random'>Random Community</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/support/faq'>FAQ</a></li>
+</ul>
+</li><li id='shop_topnav' class='topnav has-dropdown'><a href='https://www.dreamwidth.org/nav/shop'>Shop</a>
+<ul id='shop_subnav' class='subnav_container dropdown'>
+ <li class='subnav'><a href='https://www.dreamwidth.org/shop'>Buy Dreamwidth Services</a></li>
+ <li class='subnav'><a href='https://www.dreamwidth.org/shop/randomgift'>Gift a Random User</a></li>
+ <li class='subnav'><a href='https://www.zazzle.com/dreamwidth*'>DW Merchandise</a></li>
+</ul>
+</li>
+</ul>
+ <div role="search">
+ <div class='appwidget appwidget-search' id='LJWidget_25'>
+<form action='https://www.dreamwidth.org/multisearch' method='post'>
+<input type="text" title="Search" name="q" class="text" id="search" size="20" /> <select name="type" class="select">
+<option value="int" selected='selected'>Interest</option>
+<option value="region">Region</option>
+<option value="nav_and_user">Site and Account</option>
+<option value="faq">FAQ</option>
+<option value="email">Email</option>
+<option value="im">IM Info</option>
+</select> <input type='submit' value="Go" /></form></div><!-- end .appwidget-search -->
+
+ </div>
+ </nav>
+ <footer role="contentinfo">
+ <ul>
+ <li><a href="https://www.dreamwidth.org/legal/privacy">Privacy Policy</a> • </li>
+ <li><a href="https://www.dreamwidth.org/legal/tos">Terms of Service</a> • </li>
+ <li><a href="https://www.dreamwidth.org/legal/diversity">Diversity Statement</a> • </li>
+ <li><a href="https://www.dreamwidth.org/legal/principles">Guiding Principles</a> • </li>
+ <li><a href="https://www.dreamwidth.org/site/">Site Map</a> • </li>
+ <li><a href="https://www.dreamwidth.org/site/suggest">Make a Suggestion</a> • </li>
+ <li><a href="https://www.dreamwidth.org/site/opensource">Open Source</a> • </li>
+ <li><a href="https://www.dreamwidth.org/support">Help/Support</a></li>
+</ul>
+<p>Copyright © 2009-2021 Dreamwidth Studios, LLC. <a href="//www.dreamwidth.org/site/opensource">Some</a> rights reserved.</p>
+ </footer>
+ </div>
+ </div>
+ <div id='statistics' style='text-align: left; font-size:0; line-height:0; height:0; overflow:hidden;'><script type="text/javascript">
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+</div>
+ <div id="shim-alpha"> </div>
+ </body>
+</html>
+
--- /dev/null
+{
+ "name": "com.cordova.react",
+ "displayName": "HelloCordova",
+ "version": "1.0.0",
+ "description": "A sample Apache Cordova application that responds to the deviceready event.",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "ecosystem:cordova"
+ ],
+ "author": "Apache Cordova Team",
+ "license": "Apache-2.0",
+ "devDependencies": {
+ "@babel/core": "^7.16.0",
+ "@babel/preset-env": "^7.16.4",
+ "@babel/preset-react": "^7.16.0",
+ "babel-loader": "^8.2.3",
+ "cordova-android": "^9.1.0",
+ "cordova-browser": "^6.0.0",
+ "cordova-plugin-advanced-http": "^3.2.2",
+ "cordova-plugin-file": "^6.0.2",
+ "cordova-plugin-webpack": "^1.0.5",
+ "cordova-plugin-whitelist": "^1.3.4",
+ "webpack": "^4.46.0",
+ "webpack-cli": "^3.3.12",
+ "webpack-dev-server": "^3.11.3"
+ },
+ "cordova": {
+ "plugins": {
+ "cordova-plugin-whitelist": {},
+ "cordova-plugin-webpack": {},
+ "cordova-plugin-advanced-http": {
+ "ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
+ }
+ },
+ "platforms": [
+ "browser",
+ "android"
+ ]
+ },
+ "dependencies": {
+ "jssoup": "^0.0.15",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2"
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+
+// Wait for the deviceready event before using any of Cordova's device APIs.
+// See https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready
+document.addEventListener('deviceready', onDeviceReady, false);
+
+function onDeviceReady() {
+ // Cordova is now initialized. Have fun!
+
+ console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
+ var JSSoup = require('jssoup').default;
+ var soup = new JSSoup('<html><head>hello</head></html>');
+ var tag = soup.find('head');
+ tag.name = 'span'
+ console.log(tag)
+
+ cordova.plugin.http.get('http://127.0.0.1:6888/',
+ {},
+ {},
+ function(response) {
+ console.log(response.status);
+ console.log(response.data);
+ },
+ function(response) {
+ console.error(response.error);
+ });
+}
--- /dev/null
+const path = require('path')
+
+module.exports = {
+ mode: 'development',
+ entry: './src/index.js',
+ output: {
+ path: path.resolve(__dirname, 'www'),
+ filename: 'index.bundle.js'
+ },
+ devtool: 'inline-source-map',
+ module: {
+ rules: [
+ {
+ test: /\.(js|jsx)$/,
+ exclude: /node_modules/,
+ use: {
+ loader: 'babel-loader'
+ }
+ }
+ ]
+ }
+}
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="Content-Security-Policy" content="default-src *;">
+ <meta name="format-detection" content="telephone=no">
+ <meta name="msapplication-tap-highlight" content="no">
+ <meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
+ <link rel="stylesheet" href="css/index.css">
+ <title>dwim</title>
+ </head>
+ <body>
+ <div class="app" id="app">
+ <h1>Hello world.</h1>
+ </div>
+ <script src="cordova.js"></script>
+ <script src="index.bundle.js"></script>
+ </body>
+</html>