[
  {
    "path": ".dockerignore",
    "content": "/.git\n/.gradle\n/build\n"
  },
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nindent_style = tab\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.yaml]\nindent_style = space\n"
  },
  {
    "path": ".github/workflows/build.yaml",
    "content": "name: build\n\non:\n  pull_request:\n  push:\n    branches:\n      - '**'\n      - '!trunk'\n\nenv:\n  GRADLE_OPTS: \"-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false\"\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v3\n\n      - name: Validate Gradle Wrapper\n        uses: gradle/wrapper-validation-action@v1\n\n      - name: Build\n        run: docker build .\n"
  },
  {
    "path": ".github/workflows/build_and_publish.yaml",
    "content": "name: build and publish\n\non:\n  push:\n    branches:\n      - trunk\n    tags:\n      - '*'\n\nenv:\n  GRADLE_OPTS: \"-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false\"\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v3\n\n      - uses: gradle/wrapper-validation-action@v1\n\n      - uses: actions/setup-java@v3\n        with:\n          distribution: 'zulu'\n          java-version: 8\n\n      - run: ./gradlew build\n\n      - uses: crazy-max/ghaction-docker-meta@v1\n        id: docker_meta\n        with:\n          images: |\n            jakewharton/dodo\n            ghcr.io/jakewharton/dodo\n          tag-semver: |\n            {{version}}\n            {{major}}\n            {{major}}.{{minor}}\n\n      - uses: docker/login-action@v2\n        with:\n          username: jakewharton\n          password: ${{ secrets.DOCKER_HUB_TOKEN }}\n\n      - run: echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin\n\n      - uses: docker/build-push-action@v4\n        with:\n          push: true\n          tags: ${{ steps.docker_meta.outputs.tags }}\n          labels: ${{ steps.docker_meta.outputs.labels }}\n\n      - name: Extract release notes\n        id: release_notes\n        if: startsWith(github.ref, 'refs/tags/')\n        uses: ffurrer2/extract-release-notes@v1\n\n      - name: Create Release\n        if: startsWith(github.ref, 'refs/tags/')\n        uses: softprops/action-gh-release@v1\n        with:\n          body: ${{ steps.release_notes.outputs.release_notes }}\n          files: build/distributions/dodo.zip\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\n      - name: Get version\n        id: get_version\n        if: startsWith(github.ref, 'refs/tags/')\n        run: echo ::set-output name=version::${GITHUB_REF/refs\\/tags\\//}\n\n      - name: Set SHA\n        id: shasum\n        if: startsWith(github.ref, 'refs/tags/')\n        run: echo ::set-output name=sha::\"$(shasum -a 256 build/distributions/dodo.zip | awk '{printf $1}')\"\n\n      - name: Bump Brew\n        if: startsWith(github.ref, 'refs/tags/')\n        env:\n          HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GH_HOMEBREW_TOKEN }}\n        run: |\n          git config --global user.email \"41898282+github-actions[bot]@users.noreply.github.com\"\n          git config --global user.name \"github-actions[bot]\"\n\n          # Update to ensure we have the latest version which supports arbitrary default branches.\n          brew update\n\n          brew tap JakeWharton/repo\n          brew bump-formula-pr -f --version=${{ steps.get_version.outputs.version }} --no-browse --no-audit \\\n            --sha256=${{ steps.shasum.outputs.sha }} \\\n            --url=\"https://github.com/JakeWharton/dodo/releases/download/${{ steps.get_version.outputs.version }}/dodo.zip\" \\\n            JakeWharton/repo/dodo\n"
  },
  {
    "path": ".gitignore",
    "content": "# Gradle\nbuild\n.gradle\n/reports\n\n# IntelliJ\n.idea\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n## [Unreleased]\n\n\n## [1.1.0]\n\nFeatures:\n\n * Persist account names at the time of tweet/retweet/quote\n\nFixed:\n\n * Display actual tweet timestamp and render with browser timezone and locale\n\n\n## [1.0.0]\n\n - Initial release\n\n\n[Unreleased]: https://github.com/JakeWharton/dodo/compare/1.1.0...HEAD\n[1.1.0]: https://github.com/JakeWharton/dodo/releases/tag/1.1.0\n[1.0.0]: https://github.com/JakeWharton/dodo/releases/tag/1.0.0\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM adoptopenjdk:8-jdk-hotspot AS build\nENV GRADLE_OPTS=\"-Dorg.gradle.daemon=false -Dkotlin.incremental=false\"\nWORKDIR /app\n\nCOPY gradlew settings.gradle ./\nCOPY gradle ./gradle\nRUN ./gradlew --version\n\nCOPY build.gradle ./\nCOPY src ./src\nRUN ./gradlew build\n\n\nFROM koalaman/shellcheck-alpine:stable AS shellcheck\nWORKDIR /overlay\nCOPY root/ ./\nRUN find . -type f | xargs shellcheck -e SC1008\n\n\nFROM mvdan/shfmt:v3-alpine AS shfmt\nWORKDIR /overlay\nCOPY root/ ./\nCOPY .editorconfig /\nRUN shfmt -d .\n\n\nFROM oznu/s6-alpine:3.11\nLABEL maintainer=\"Jake Wharton <docker@jakewharton.com>\"\n\nRUN apk add --no-cache \\\n      curl \\\n      openjdk8-jre \\\n && rm -rf /var/cache/* \\\n && mkdir /var/cache/apk\n\nENV \\\n    # Fail if cont-init scripts exit with non-zero code.\n    S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \\\n    CRON=\"\" \\\n    ACCESS_TOKEN=\"\" \\\n    ACCESS_SECRET=\"\" \\\n    API_KEY=\"\" \\\n    API_SECRET=\"\" \\\n    HEALTHCHECK_ID=\"\" \\\n    HEALTHCHECK_HOST=\"https://hc-ping.com\" \\\n    PUID=\"\" \\\n    PGID=\"\"\nCOPY root/ /\nWORKDIR /app\nCOPY --from=build /app/build/install/dodo ./\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# Dodo\n\nSynchronize your Twitter timeline to a local database for archival and search.\n\n![Screenshot of web interface](screenshot.png)\n\nAvailable as a binary and Docker container.\n\n\n## Usage\n\nDodo consumes data from Twitter and requires you register your own Twitter application for keys:\nhttps://developer.twitter.com/en/apply-for-access\n\nYou will need an OAuth access token and access secret as well as an API key and secret.\n\nFrom there, you can run Dodo in one of two ways:\n\n * [Command line](#command-line)\n * [Docker](#docker)\n\n### Command-line\n\nInstall on Mac OS with:\n```\n$ brew install JakeWharton/repo/dodo\n```\n\nFor other platforms, download ZIP from\n[latest release](https://github.com/JakeWharton/dodo/releases/latest)\nand run `bin/dodo` or `bin/dodo.bat`.\n\nDodo can run in two modes:\n - One-off syncs via `sync` subcommand, or\n - Long-running web-server with manual syncs\n\n```\n$ dodo --help\nUsage: dodo [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  -h, --help  Show this message and exit\n\nCommands:\n  sync  Perform a one-time sync of the latest tweets\n  run   Start an HTTP server for displaying tweets and performing syncs\n```\n\nThe `sync` subcommand will perform a one-off sync to the specified Sqlite database file.\nYou can run it on a cron and use `sqlite3` or any Sqlite-capable tool to consume the data.\n\n```\n$ dodo sync --help\nUsage: dodo sync [OPTIONS]\n\n  Perform a one-time sync of the latest tweets\n\nOptions:\n  --db FILE            Sqlite database file\n  --access-token KEY   OAuth access token\n  --access-secret KEY  OAuth access token secret\n  --api-key KEY        OAuth consumer API key\n  --api-secret KEY     OAuth consumer API secret\n  -h, --help           Show this message and exit\n```\n\nThe `run` subcommand will start a webserver with a search and manual sync interface. You can also\nPOST the `/sync` endpoint to trigger a sync, such as on a cron.\n\n```\n$ dodo run --help\nUsage: dodo run [OPTIONS]\n\n  Start an HTTP server for displaying tweets and performing syncs\n\nOptions:\n  --db FILE            Sqlite database file\n  --access-token KEY   OAuth access token\n  --access-secret KEY  OAuth access token secret\n  --api-key KEY        OAuth consumer API key\n  --api-secret KEY     OAuth consumer API secret\n  --port PORT          Port for the HTTP server (default 8098)\n  -h, --help           Show this message and exit\n```\n\n## Docker\n\nThe container starts the webserver on port 8098 and automatically triggers sync using cron.\n\n[![Docker Image Version](https://img.shields.io/docker/v/jakewharton/dodo?sort=semver)][hub]\n[![Docker Image Size](https://img.shields.io/docker/image-size/jakewharton/dodo)][layers]\n\n [hub]: https://hub.docker.com/r/jakewharton/dodo/\n [layers]: https://microbadger.com/images/jakewharton/dodo\n\n```\n$ docker run -it --rm \\\n    -v /path/to/data:/data \\\n    -e \"CRON=*/3 * * * *\" \\\n    -e \"ACCESS_TOKEN=...\" \\\n    -e \"ACCESS_SECRET=...\" \\\n    -e \"API_KEY=...\" \\\n    -e \"API_SECRET=...\" \\\n    jakewharton/dodo:trunk\n```\n\nTo be notified when sync is failing visit https://healthchecks.io, create a check, and specify\nthe ID to the container using the `HEALTHCHECK_ID` environment variable.\n\n### Docker Compose\n\n```yaml\nversion: '2'\nservices:\n  dodo:\n    image: jakewharton/dodo:trunk\n    restart: unless-stopped\n    volumes:\n      - /path/to/data:/data\n    environment:\n      - \"CRON=*/3 * * * *\"\n      - \"ACCESS_TOKEN=...\"\n      - \"ACCESS_SECRET=...\"\n      - \"API_KEY=...\"\n      - \"API_SECRET=...\"\n      #Optional:\n      - \"HEALTHCHECK_ID=...\"\n      - \"PUID=...\"\n      - \"PGID=...\"\n```\n\n\n## Development\n\nTo run the latest code build with `./gradlew installDist`.  This will put the application into\n`build/install/dodo/`. From there you can use the [command-line instructions](#command-line)\ninstructions to run.\n\nThe Docker containers can be built with `docker build .`, which also runs the full set of checks\nas CI would.\n\n\n# License\n\n    Copyright 2020 Jake Wharton\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n"
  },
  {
    "path": "RELEASING.md",
    "content": "# Releasing\n\n1. Update the `CHANGELOG.md`:\n   1. Change the `Unreleased` header to the release version.\n   2. Add a link URL to ensure the header link works.\n   3. Add a new `Unreleased` section to the top.\n\n2. Commit\n\n   ```\n   $ git commit -am \"Prepare version X.Y.X\"\n   ```\n\n3. Tag\n\n   ```\n   $ git tag -am \"Version X.Y.Z\" X.Y.Z\n   ```\n\n4. Push!\n\n   ```\n   $ git push && git push --tags\n   ```\n\n   This will trigger a GitHub Action workflow which will create a GitHub release, upload the\n   zip, deploy the Docker container, and send a PR to the Homebrew repo.\n\n5. Find [the Homebrew PR](https://github.com/JakeWharton/homebrew-repo/pulls) and merge it!\n"
  },
  {
    "path": "build.gradle",
    "content": "buildscript {\n\trepositories {\n\t\tmavenCentral()\n\t}\n\tdependencies {\n\t\tclasspath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20'\n\t\tclasspath 'com.squareup.sqldelight:gradle-plugin:1.5.4'\n\t}\n}\n\napply plugin: 'org.jetbrains.kotlin.jvm'\n\napply plugin: 'com.squareup.sqldelight'\nsqldelight {\n\tDatabase {\n\t\tpackageName = 'com.jakewharton.dodo.db'\n\t\tschemaOutputDirectory = file('src/main/sqldelight/databases')\n\t\tverifyMigrations = true\n\t}\n}\n\napply plugin: 'application'\nmainClassName = 'com.jakewharton.dodo.Main'\n\ndependencies {\n\timplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'\n\timplementation 'com.github.ajalt.clikt:clikt:3.5.2'\n\timplementation 'com.squareup.sqldelight:sqlite-driver:1.5.4'\n\timplementation 'org.xerial:sqlite-jdbc:3.41.2.1'\n\timplementation 'org.twitter4j:twitter4j-core:4.1.2'\n\timplementation 'ch.qos.logback:logback-classic:1.4.6'\n\n\tdef ktorVersion = '1.6.8'\n\timplementation \"io.ktor:ktor-server-core:${ktorVersion}\"\n\timplementation \"io.ktor:ktor-server-netty:${ktorVersion}\"\n\timplementation \"io.ktor:ktor-html-builder:${ktorVersion}\"\n\n\ttestImplementation 'junit:junit:4.13.2'\n\ttestImplementation 'com.google.truth:truth:1.1.3'\n}\n\nrepositories {\n\tmavenCentral()\n\t// https://github.com/Kotlin/kotlinx.html/issues/81\n\tjcenter {\n\t\tcontent {\n\t\t\tincludeModule('org.jetbrains.kotlinx', 'kotlinx-html-jvm')\n\t\t}\n\t}\n}\n\ntasks.named(\"distTar\").configure { task ->\n\ttask.enabled = false\n}\ntasks.named(\"assemble\").configure { task ->\n\ttask.dependsOn(tasks.getByName(\"installDist\"))\n}\n\ntasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile).configureEach { task ->\n\ttask.kotlinOptions {\n\t\tjvmTarget = '1.8'\n\t\tfreeCompilerArgs += [\n\t\t\t\t'-progressive',\n\t\t]\n\t}\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-8.1-bin.zip\nnetworkTimeout=10000\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradlew",
    "content": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n#\n#   Gradle start up script for POSIX generated by Gradle.\n#\n#   Important for running:\n#\n#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is\n#       noncompliant, but you have some other compliant shell such as ksh or\n#       bash, then to run this script, type that shell name before the whole\n#       command line, like:\n#\n#           ksh Gradle\n#\n#       Busybox and similar reduced shells will NOT work, because this script\n#       requires all of these POSIX shell features:\n#         * functions;\n#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,\n#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;\n#         * compound commands having a testable exit status, especially «case»;\n#         * various built-in commands including «command», «set», and «ulimit».\n#\n#   Important for patching:\n#\n#   (2) This script targets any POSIX shell, so it avoids extensions provided\n#       by Bash, Ksh, etc; in particular arrays are avoided.\n#\n#       The \"traditional\" practice of packing multiple parameters into a\n#       space-separated string is a well documented source of bugs and security\n#       problems, so this is (mostly) avoided, by progressively accumulating\n#       options in \"$@\", and eventually passing that to Java.\n#\n#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,\n#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;\n#       see the in-line comments for details.\n#\n#       There are tweaks for specific operating systems such as AIX, CygWin,\n#       Darwin, MinGW, and NonStop.\n#\n#   (3) This script is generated from the Groovy template\n#       https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt\n#       within the Gradle project.\n#\n#       You can find Gradle at https://github.com/gradle/gradle/.\n#\n##############################################################################\n\n# Attempt to set APP_HOME\n\n# Resolve links: $0 may be a link\napp_path=$0\n\n# Need this for daisy-chained symlinks.\nwhile\n    APP_HOME=${app_path%\"${app_path##*/}\"}  # leaves a trailing /; empty if no leading path\n    [ -h \"$app_path\" ]\ndo\n    ls=$( ls -ld \"$app_path\" )\n    link=${ls#*' -> '}\n    case $link in             #(\n      /*)   app_path=$link ;; #(\n      *)    app_path=$APP_HOME$link ;;\n    esac\ndone\n\n# This is normally unused\n# shellcheck disable=SC2034\nAPP_BASE_NAME=${0##*/}\nAPP_HOME=$( cd \"${APP_HOME:-./}\" && pwd -P ) || exit\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=maximum\n\nwarn () {\n    echo \"$*\"\n} >&2\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n} >&2\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"$( uname )\" in                #(\n  CYGWIN* )         cygwin=true  ;; #(\n  Darwin* )         darwin=true  ;; #(\n  MSYS* | MINGW* )  msys=true    ;; #(\n  NONSTOP* )        nonstop=true ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=$JAVA_HOME/jre/sh/java\n    else\n        JAVACMD=$JAVA_HOME/bin/java\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=java\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif ! \"$cygwin\" && ! \"$darwin\" && ! \"$nonstop\" ; then\n    case $MAX_FD in #(\n      max*)\n        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC3045\n        MAX_FD=$( ulimit -H -n ) ||\n            warn \"Could not query maximum file descriptor limit\"\n    esac\n    case $MAX_FD in  #(\n      '' | soft) :;; #(\n      *)\n        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC3045\n        ulimit -n \"$MAX_FD\" ||\n            warn \"Could not set maximum file descriptor limit to $MAX_FD\"\n    esac\nfi\n\n# Collect all arguments for the java command, stacking in reverse order:\n#   * args from the command line\n#   * the main class name\n#   * -classpath\n#   * -D...appname settings\n#   * --module-path (only if needed)\n#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif \"$cygwin\" || \"$msys\" ; then\n    APP_HOME=$( cygpath --path --mixed \"$APP_HOME\" )\n    CLASSPATH=$( cygpath --path --mixed \"$CLASSPATH\" )\n\n    JAVACMD=$( cygpath --unix \"$JAVACMD\" )\n\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    for arg do\n        if\n            case $arg in                                #(\n              -*)   false ;;                            # don't mess with options #(\n              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath\n                    [ -e \"$t\" ] ;;                      #(\n              *)    false ;;\n            esac\n        then\n            arg=$( cygpath --path --ignore --mixed \"$arg\" )\n        fi\n        # Roll the args list around exactly as many times as the number of\n        # args, so each arg winds up back in the position where it started, but\n        # possibly modified.\n        #\n        # NB: a `for` loop captures its iteration list before it begins, so\n        # changing the positional parameters here affects neither the number of\n        # iterations, nor the values presented in `arg`.\n        shift                   # remove old arg\n        set -- \"$@\" \"$arg\"      # push replacement arg\n    done\nfi\n\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Collect all arguments for the java command;\n#   * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of\n#     shell script including quotes and variable substitutions, so put them in\n#     double quotes to make sure that they get re-expanded; and\n#   * put everything else in single quotes, so that it's not re-expanded.\n\nset -- \\\n        \"-Dorg.gradle.appname=$APP_BASE_NAME\" \\\n        -classpath \"$CLASSPATH\" \\\n        org.gradle.wrapper.GradleWrapperMain \\\n        \"$@\"\n\n# Stop when \"xargs\" is not available.\nif ! command -v xargs >/dev/null 2>&1\nthen\n    die \"xargs is not available\"\nfi\n\n# Use \"xargs\" to parse quoted args.\n#\n# With -n1 it outputs one arg per line, with the quotes and backslashes removed.\n#\n# In Bash we could simply go:\n#\n#   readarray ARGS < <( xargs -n1 <<<\"$var\" ) &&\n#   set -- \"${ARGS[@]}\" \"$@\"\n#\n# but POSIX shell has neither arrays nor command substitution, so instead we\n# post-process each arg (as a line of input to sed) to backslash-escape any\n# character that might be a shell metacharacter, then use eval to reverse\n# that process (while maintaining the separation between arguments), and wrap\n# the whole thing up as a single \"set\" statement.\n#\n# This will of course break if any of these variables contains a newline or\n# an unmatched quote.\n#\n\neval \"set -- $(\n        printf '%s\\n' \"$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\" |\n        xargs -n1 |\n        sed ' s~[^-[:alnum:]+,./:=@_]~\\\\&~g; ' |\n        tr '\\n' ' '\n    )\" '\"$@\"'\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\r\n@rem you may not use this file except in compliance with the License.\r\n@rem You may obtain a copy of the License at\r\n@rem\r\n@rem      https://www.apache.org/licenses/LICENSE-2.0\r\n@rem\r\n@rem Unless required by applicable law or agreed to in writing, software\r\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\r\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n@rem See the License for the specific language governing permissions and\r\n@rem limitations under the License.\r\n@rem\r\n\r\n@if \"%DEBUG%\"==\"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\"==\"\" set DIRNAME=.\r\n@rem This is normally unused\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\r\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif %ERRORLEVEL% equ 0 goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif %ERRORLEVEL% equ 0 goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nset EXIT_CODE=%ERRORLEVEL%\r\nif %EXIT_CODE% equ 0 set EXIT_CODE=1\r\nif not \"\"==\"%GRADLE_EXIT_CONSOLE%\" exit %EXIT_CODE%\r\nexit /b %EXIT_CODE%\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n\t\"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n\t\"extends\": [\n\t\t\"config:base\"\n\t]\n}\n"
  },
  {
    "path": "root/app/sync.sh",
    "content": "#!/usr/bin/with-contenv sh\n\nif [ -n \"$HEALTHCHECK_ID\" ]; then\n\tcurl -sS -X POST -o /dev/null \"$HEALTHCHECK_HOST/$HEALTHCHECK_ID/start\"\nfi\n\n# If the sync fails we want to avoid triggering the health check.\nset -e\n\ncurl -sS -X POST --fail http://localhost/sync\n\nif [ -n \"$HEALTHCHECK_ID\" ]; then\n\tcurl -sS -X POST -o /dev/null --fail \"$HEALTHCHECK_HOST/$HEALTHCHECK_ID\"\nfi\n"
  },
  {
    "path": "root/etc/cont-init.d/10-adduser.sh",
    "content": "#!/usr/bin/with-contenv sh\n#\n# Copyright (c) 2017 Joshua Avalon\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in all\n# copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\nPUID=${PUID:-1001}\nPGID=${PGID:-1001}\n\ngroupmod -o -g \"$PGID\" abc\nusermod -o -u \"$PUID\" abc\n\necho \"\nInitializing container\n\nUser uid: $(id -u abc)\nUser gid: $(id -g abc)\n\"\n\nchown abc:abc /app\n"
  },
  {
    "path": "root/etc/cont-init.d/20-cron.sh",
    "content": "#!/usr/bin/with-contenv sh\n\nif [ -z \"$CRON\" ]; then\n\techo \"\nNot running in cron mode\n\"\n\texit 0\nfi\n\nif [ ! -d /data ]; then\n\techo \"\nERROR: '/data' directory must be mounted\n\"\n\texit 1\nfi\n\nif [ -z \"$HEALTHCHECK_ID\" ]; then\n\techo \"\nNOTE: Define HEALTHCHECK_ID with https://healthchecks.io to monitor sync job\"\nfi\n\nif [ -z \"$ACCESS_TOKEN\" ]; then\n\techo \"\nERROR: 'ACCESS_TOKEN' environment variable not set\"\n\texit 1\nfi\nif [ -z \"$ACCESS_SECRET\" ]; then\n\techo \"\nERROR: 'ACCESS_SECRET' environment variable not set\"\n\texit 1\nfi\nif [ -z \"$API_KEY\" ]; then\n\techo \"\nERROR: 'API_KEY' environment variable not set\"\n\texit 1\nfi\nif [ -z \"$API_SECRET\" ]; then\n\techo \"\nERROR: 'API_SECRET' environment variable not set\"\n\texit 1\nfi\n\n# Set up the cron schedule.\necho \"\nInitializing cron\n\n$CRON\n\"\ncrontab -u abc -d # Delete any existing crontab.\necho \"$CRON /usr/bin/flock -n /app/sync.lock /app/sync.sh\" >/tmp/crontab.tmp\ncrontab -u abc /tmp/crontab.tmp\nrm /tmp/crontab.tmp\n"
  },
  {
    "path": "root/etc/services.d/cron/run",
    "content": "#!/usr/bin/with-contenv sh\n\n# Log level 5 (and below) is noisy during periodic wakeup where nothing happens.\n/usr/sbin/crond -f -l 6\n"
  },
  {
    "path": "root/etc/services.d/dodo/run",
    "content": "#!/usr/bin/with-contenv sh\n\n/app/bin/dodo run \\\n\t--port 80 \\\n\t--db /data/dodo.db \\\n\t--access-token \"$ACCESS_TOKEN\" \\\n\t--access-secret \"$ACCESS_SECRET\" \\\n\t--api-key \"$API_KEY\" \\\n\t--api-secret \"$API_SECRET\"\n"
  },
  {
    "path": "settings.gradle",
    "content": "rootProject.name = 'dodo'\n"
  },
  {
    "path": "src/main/kotlin/com/jakewharton/dodo/app.kt",
    "content": "package com.jakewharton.dodo\n\nimport com.jakewharton.dodo.db.Search\nimport com.jakewharton.dodo.db.TweetIndexQueries\nimport com.jakewharton.dodo.db.TweetQueries\nimport java.time.ZoneOffset.UTC\nimport kotlinx.coroutines.Dispatchers.IO\nimport kotlinx.coroutines.withContext\nimport org.slf4j.LoggerFactory\nimport twitter4j.Twitter\nimport twitter4j.TwitterObjectFactory\nimport twitter4j.v1.Paging\nimport twitter4j.v1.Status\n\nclass Dodo(\n\tprivate val twitter: Twitter,\n\tprivate val tweetQueries: TweetQueries,\n\tprivate val searchQueries: TweetIndexQueries,\n) {\n\tfun sync() {\n\t\tval newestStatusId = tweetQueries.newest().executeAsOne().status_id ?: 1L\n\n\t\tval tweets = twitter.v1().timelines().getHomeTimeline(Paging.ofSinceId(newestStatusId))\n\t\tlogger.info(\"Retrieved ${tweets.size} new tweets\")\n\n\t\tfor (tweet in tweets) {\n\t\t\tval text: String\n\t\t\tval quotedStatus: Status?\n\t\t\tif (tweet.isRetweet) {\n\t\t\t\ttext = tweet.retweetedStatus.displayText\n\t\t\t\tquotedStatus = tweet.retweetedStatus.quotedStatus\n\t\t\t} else {\n\t\t\t\ttext = tweet.text\n\t\t\t\tquotedStatus = tweet.quotedStatus\n\t\t\t}\n\t\t\ttweetQueries.insert(\n\t\t\t\tstatus_id = tweet.id,\n\t\t\t\tstatus_user_id = tweet.user.id,\n\t\t\t\tstatus_user_handle = tweet.user.screenName,\n\t\t\t\tstatus_user_name = tweet.user.name,\n\t\t\t\tstatus_text = text,\n\t\t\t\tstatus_unix_time = tweet.createdAt.toEpochSecond(UTC),\n\t\t\t\tretweeted_id = tweet.retweetedStatus?.id,\n\t\t\t\tretweeted_user_id = tweet.retweetedStatus?.user?.id,\n\t\t\t\tretweeted_user_handle = tweet.retweetedStatus?.user?.screenName,\n\t\t\t\tretweeted_user_name = tweet.retweetedStatus?.user?.name,\n\t\t\t\tretweeted_unix_time = tweet.retweetedStatus?.createdAt?.toEpochSecond(UTC),\n\t\t\t\tquoted_id = quotedStatus?.id,\n\t\t\t\tquoted_user_id = quotedStatus?.user?.id,\n\t\t\t\tquoted_user_handle = quotedStatus?.user?.screenName,\n\t\t\t\tquoted_user_name = quotedStatus?.user?.name,\n\t\t\t\tquoted_text = quotedStatus?.displayText,\n\t\t\t\tquoted_unix_time = quotedStatus?.createdAt?.toEpochSecond(UTC),\n\t\t\t\tjson = TwitterObjectFactory.getRawJSON(tweet), // LMAO WTF thread local cache?!?\n\t\t\t)\n\t\t}\n\t}\n\n\tsuspend fun totalCount(): Long {\n\t\treturn withContext(IO) {\n\t\t\ttweetQueries.totalCount().executeAsOne()\n\t\t}\n\t}\n\n\tsuspend fun search(query: String): List<Search> = withContext(IO) {\n\t\tsearchQueries.search(query).executeAsList()\n\t}\n\n\tprivate companion object {\n\t\tprivate val logger = LoggerFactory.getLogger(Dodo::class.java)\n\t}\n}\n"
  },
  {
    "path": "src/main/kotlin/com/jakewharton/dodo/db.kt",
    "content": "package com.jakewharton.dodo\n\nimport com.jakewharton.dodo.db.Database\nimport com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver\n\ninline fun withDatabase(path: String, crossinline block: (db: Database) -> Unit) {\n\tJdbcSqliteDriver(\"jdbc:sqlite:$path\").use { driver ->\n\t\tmigrateIfNeeded(driver)\n\t\tblock(Database(driver))\n\t}\n}\n\nprivate const val versionPragma = \"user_version\"\n\nfun migrateIfNeeded(driver: JdbcSqliteDriver) {\n\tval oldVersion =\n\t\tdriver.executeQuery(null, \"PRAGMA $versionPragma\", 0).use { cursor ->\n\t\t\tif (cursor.next()) {\n\t\t\t\tcursor.getLong(0)?.toInt()\n\t\t\t} else {\n\t\t\t\tnull\n\t\t\t}\n\t\t} ?: 0\n\n\tval newVersion = Database.Schema.version\n\n\tif (oldVersion == 0) {\n\t\tprintln(\"Creating DB version $newVersion!\")\n\t\tDatabase.Schema.create(driver)\n\t\tdriver.execute(null, \"PRAGMA $versionPragma=$newVersion\", 0)\n\t} else if (oldVersion < newVersion) {\n\t\tprintln(\"Migrating DB from version $oldVersion to $newVersion!\")\n\t\tDatabase.Schema.migrate(driver, oldVersion, newVersion)\n\t\tdriver.execute(null, \"PRAGMA $versionPragma=$newVersion\", 0)\n\t}\n}\n"
  },
  {
    "path": "src/main/kotlin/com/jakewharton/dodo/html.kt",
    "content": "package com.jakewharton.dodo\n\nimport com.jakewharton.dodo.db.Search\nimport kotlinx.html.FlowContent\nimport kotlinx.html.FormMethod.get\nimport kotlinx.html.HTML\nimport kotlinx.html.InputType.submit\nimport kotlinx.html.InputType.text\nimport kotlinx.html.a\nimport kotlinx.html.blockQuote\nimport kotlinx.html.body\nimport kotlinx.html.div\nimport kotlinx.html.form\nimport kotlinx.html.head\nimport kotlinx.html.input\nimport kotlinx.html.link\nimport kotlinx.html.meta\nimport kotlinx.html.nav\nimport kotlinx.html.p\nimport kotlinx.html.script\nimport kotlinx.html.time\nimport kotlinx.html.title\nimport java.time.Instant\nimport java.time.LocalDateTime\nimport java.time.ZoneOffset.UTC\nimport java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME\n\nfun HTML.renderIndex(query: String?, totalCount: Long, tweets: List<Search>) {\n\thead {\n\t\tmeta(charset = \"utf-8\")\n\t\tmeta(name = \"viewport\", content = \"width=device-width, initial-scale=1.0\")\n\t\ttitle(\"Dodo Tweet Archive\")\n\t\tlink(rel = \"stylesheet\", href = \"/static/chota.min.css\")\n\t\tmeta(name = \"twitter:dnt\", content = \"on\")\n\t\tscript(src = \"https://platform.twitter.com/widgets.js\") {\n\t\t\tasync = true\n\t\t\tcharset = \"utf-8\"\n\t\t}\n\t}\n\tbody {\n\t\tnav(classes = \"nav\") {\n\t\t\tdiv(classes = \"nav-center\") {\n\t\t\t\ta(href = \"/\", classes = \"brand\") {\n\t\t\t\t\t+\"Dodo 🐦\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdiv(classes = \"container\") {\n\t\t\tdiv(classes = \"row\") {\n\t\t\t\tdiv(classes = \"col\") {\n\t\t\t\t\tform(action = \"/\", method = get, classes = \"is-center\") {\n\t\t\t\t\t\tdiv(classes = \"grouped\") {\n\t\t\t\t\t\t\tinput(name = \"q\", type = text) {\n\t\t\t\t\t\t\t\tplaceholder = \"Search term\"\n\t\t\t\t\t\t\t\tautoFocus = true\n\t\t\t\t\t\t\t\tif (query != null) {\n\t\t\t\t\t\t\t\t\tvalue = query\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tinput(type = submit) {\n\t\t\t\t\t\t\t\tvalue = \"Search $totalCount tweets\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdiv(classes = \"row\") {\n\t\t\t\tdiv(classes = \"col\") {\n\t\t\t\t\tfor (tweet in tweets) {\n\t\t\t\t\t\ttweet(tweet)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tscript(src = \"/static/app.js\") {\n\t\t\tasync = true\n\t\t\tcharset = \"utf-8\"\n\t\t}\n\t}\n}\n\nprivate fun FlowContent.tweet(tweet: Search) {\n\tblockQuote(\"twitter-tweet tw-align-center\") {\n\t\tattributes[\"data-cards\"] = \"hidden\"\n\t\tattributes[\"data-conversation\"] = \"none\"\n\n\t\tp {\n\t\t\t+tweet.status_text\n\n\t\t\tif (tweet.quoted_text != null) {\n\t\t\t\tblockQuote {\n\t\t\t\t\tp {\n\t\t\t\t\t\t+tweet.quoted_text\n\t\t\t\t\t}\n\t\t\t\t\tp {\n\t\t\t\t\t\t+\"— \"\n\t\t\t\t\t\ttwitterHandleLink(tweet.quoted_user_handle!!)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tp {\n\t\t\t+\"— \"\n\t\t\tif (tweet.retweeted_user_handle != null) {\n\t\t\t\ttwitterHandleLink(tweet.retweeted_user_handle)\n\t\t\t\t+\" retweeted by \"\n\t\t\t}\n\t\t\ttwitterHandleLink(tweet.status_user_handle)\n\t\t}\n\t\tp {\n\t\t\ta(href = \"https://twitter.com/${tweet.status_user_handle}/status/${tweet.status_id}\") {\n\t\t\t\trenderUnixTime(tweet.status_unix_time)\n\t\t\t}\n\t\t}\n\t}\n}\n\nprivate fun FlowContent.twitterHandleLink(handle: String) {\n\ta(href = \"https://twitter.com/$handle\") {\n\t\trel = \"noreferrer noopener\"\n\t\t+\"@$handle\"\n\t}\n}\n\nprivate fun FlowContent.renderUnixTime(unixTime: Long) {\n\ttime {\n\t\tval ldt = LocalDateTime.ofInstant(Instant.ofEpochMilli(unixTime), UTC)\n\t\tval formatted = ISO_LOCAL_DATE_TIME.format(ldt) + \"Z\"\n\t\tdateTime = formatted\n\t\t+formatted\n\t}\n}\n"
  },
  {
    "path": "src/main/kotlin/com/jakewharton/dodo/main.kt",
    "content": "@file:JvmName(\"Main\")\n\npackage com.jakewharton.dodo\n\nimport com.github.ajalt.clikt.core.CliktCommand\nimport com.github.ajalt.clikt.core.NoOpCliktCommand\nimport com.github.ajalt.clikt.core.subcommands\nimport com.github.ajalt.clikt.parameters.options.default\nimport com.github.ajalt.clikt.parameters.options.help\nimport com.github.ajalt.clikt.parameters.options.option\nimport com.github.ajalt.clikt.parameters.options.required\nimport com.github.ajalt.clikt.parameters.types.int\nimport io.ktor.application.call\nimport io.ktor.html.respondHtml\nimport io.ktor.http.content.resources\nimport io.ktor.http.content.static\nimport io.ktor.response.respondBytes\nimport io.ktor.routing.get\nimport io.ktor.routing.post\nimport io.ktor.routing.routing\nimport io.ktor.server.engine.embeddedServer\nimport io.ktor.server.netty.Netty\nimport twitter4j.Twitter\n\nfun main(vararg args: String) {\n\tNoOpCliktCommand(name = \"dodo\")\n\t\t.subcommands(SyncCommand(), RunCommand())\n\t\t.main(args)\n}\n\nprivate abstract class DodoCommand(\n\tname: String,\n\thelp: String,\n) : CliktCommand(\n\tname = name,\n\thelp = help\n) {\n\tprivate val dbPath by option(\"--db\", metavar = \"FILE\")\n\t\t.required()\n\t\t.help(\"Sqlite database file\")\n\tprivate val accessToken by option(metavar = \"KEY\")\n\t\t.required()\n\t\t.help(\"OAuth access token\")\n\tprivate val accessSecret by option(metavar = \"KEY\")\n\t\t.required()\n\t\t.help(\"OAuth access token secret\")\n\tprivate val apiKey by option(metavar = \"KEY\")\n\t\t.required()\n\t\t.help(\"OAuth consumer API key\")\n\tprivate val apiSecret by option(metavar = \"KEY\")\n\t\t.required()\n\t\t.help(\"OAuth consumer API secret\")\n\n\toverride fun run() {\n\t\tval twitter = Twitter.newBuilder()\n\t\t\t.oAuthAccessToken(accessToken, accessSecret)\n\t\t\t.oAuthConsumer(apiKey, apiSecret)\n\t\t\t.jsonStoreEnabled(true)\n\t\t\t.build()\n\n\t\twithDatabase(dbPath) { db ->\n\t\t\tval dodo = Dodo(twitter, db.tweetQueries, db.tweetIndexQueries)\n\t\t\trun(dodo)\n\t\t}\n\t}\n\n\tabstract fun run(dodo: Dodo)\n}\n\nprivate class SyncCommand : DodoCommand(\n\tname = \"sync\",\n\thelp = \"Perform a one-time sync of the latest tweets\",\n) {\n\toverride fun run(dodo: Dodo) {\n\t\tdodo.sync()\n\t}\n}\n\nprivate class RunCommand : DodoCommand(\n\tname = \"run\",\n\thelp = \"Start an HTTP server for displaying tweets and performing syncs\",\n) {\n\tprivate val port by option(metavar = \"PORT\").int()\n\t\t.default(defaultPort)\n\t\t.help(\"Port for the HTTP server (default $defaultPort)\")\n\n\toverride fun run(dodo: Dodo) {\n\t\tembeddedServer(Netty, port) {\n\t\t\trouting {\n\t\t\t\tstatic(\"/static\") {\n\t\t\t\t\tresources(\"static\")\n\t\t\t\t}\n\t\t\t\tget(\"/\") {\n\t\t\t\t\tval query = call.request.queryParameters[\"q\"]\n\t\t\t\t\tval totalCount = dodo.totalCount()\n\t\t\t\t\tval tweets = if (query != null) dodo.search(query) else emptyList()\n\t\t\t\t\tcall.respondHtml {\n\t\t\t\t\t\trenderIndex(query, totalCount, tweets)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpost(\"/sync\") {\n\t\t\t\t\tdodo.sync()\n\t\t\t\t\tcall.respondBytes(byteArrayOf())\n\t\t\t\t}\n\t\t\t}\n\t\t}.start(wait = true)\n\t}\n\n\tcompanion object {\n\t\tprivate const val defaultPort = 8098\n\t}\n}\n"
  },
  {
    "path": "src/main/kotlin/com/jakewharton/dodo/twitter4j.kt",
    "content": "package com.jakewharton.dodo\n\nimport twitter4j.v1.Status\n\nval Status.displayText: String get() {\n\treturn buildString {\n\t\tvar lastIndex = 0\n\t\tfor (urlEntity in urlEntities.sortedBy { it.start }) {\n\t\t\tappend(text, lastIndex, urlEntity.start)\n\t\t\tappend(urlEntity.expandedURL)\n\t\t\tlastIndex = urlEntity.end\n\t\t}\n\t\tappend(text, lastIndex, text.length)\n\t}\n}\n"
  },
  {
    "path": "src/main/resources/logback.xml",
    "content": "<configuration>\n\t<appender name=\"STDOUT\" class=\"ch.qos.logback.core.ConsoleAppender\">\n\t\t<encoder>\n\t\t\t<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>\n\t\t</encoder>\n\t</appender>\n\n\t<root level=\"trace\">\n\t\t<appender-ref ref=\"STDOUT\"/>\n\t</root>\n\n\t<logger name=\"io.netty\" level=\"INFO\"/>\n\t<logger name=\"twitter4j\" level=\"INFO\"/>\n</configuration>\n"
  },
  {
    "path": "src/main/resources/static/app.js",
    "content": "let elements = document.getElementsByTagName(\"time\")\n\nfor (let i = 0; i < elements.length; i++) {\n\tlet node = elements[i];\n\tnode.innerHTML = new Date(Date.parse(node.getAttribute(\"datetime\"))).toLocaleString()\n}\n"
  },
  {
    "path": "src/main/sqldelight/com/jakewharton/dodo/db/tweet.sq",
    "content": "CREATE TABLE tweet(\n\tstatus_id INTEGER NOT NULL PRIMARY KEY,\n\tstatus_user_id INTEGER NOT NULL,\n\tstatus_user_handle TEXT NOT NULL,\n\tstatus_user_name TEXT NOT NULL,\n\tstatus_text TEXT NOT NULL,\n\tstatus_unix_time INTEGER NOT NULL,\n\n\t-- Retweet: If one is non-null, all are non-null.\n\tretweeted_id INTEGER,\n\tretweeted_user_id INTEGER,\n\tretweeted_user_handle TEXT,\n\tretweeted_user_name TEXT,\n\tretweeted_unix_time INTEGER,\n\n\t-- Quote tweet: If one is non-null, all are non-null.\n\tquoted_id INTEGER,\n\tquoted_user_id INTEGER,\n\tquoted_user_handle TEXT,\n\tquoted_user_name TEXT,\n\tquoted_text TEXT,\n\tquoted_unix_time INTEGER,\n\n\tjson TEXT NOT NULL\n);\nCREATE UNIQUE INDEX tweet_status_id ON tweet(status_id);\n\nnewest:\nSELECT MAX(status_id) AS status_id\nFROM tweet\n;\n\ninsert:\nINSERT INTO tweet\nVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n;\n\ntotalCount:\nSELECT COUNT(status_id) AS count\nFROM tweet\n;\n"
  },
  {
    "path": "src/main/sqldelight/com/jakewharton/dodo/db/tweetIndex.sq",
    "content": "CREATE VIRTUAL TABLE tweet_index USING fts5(\n  status_id INTEGER UNINDEXED,\n  status_text TEXT,\n  status_user_name TEXT,\n  status_user_handle TEXT,\n  retweeted_user_handle TEXT,\n  retweeted_user_name TEXT,\n  quoted_user_handle TEXT,\n  quoted_user_name TEXT,\n  quoted_text TEXT\n);\n\nCREATE TRIGGER tweet_after_insert AFTER INSERT ON tweet BEGIN\n  INSERT INTO tweet_index(\n    status_id,\n    status_text,\n    status_user_name,\n    status_user_handle,\n    retweeted_user_handle,\n    retweeted_user_name,\n    quoted_user_handle,\n    quoted_user_name,\n    quoted_text\n  )\n  VALUES (\n    new.status_id,\n    new.status_text,\n    new.status_user_name,\n    new.status_user_handle,\n    new.retweeted_user_handle,\n    new.retweeted_user_name,\n    new.quoted_user_handle,\n    new.quoted_user_name,\n    new.quoted_text\n  );\nEND;\n\nsearch:\nSELECT\n\ttweet.status_id,\n\ttweet.status_user_handle,\n\ttweet.status_text,\n\ttweet.status_unix_time,\n\ttweet.retweeted_user_handle,\n\ttweet.retweeted_unix_time,\n\ttweet.quoted_user_handle,\n\ttweet.quoted_text,\n\ttweet.quoted_unix_time\nFROM tweet\nINNER JOIN tweet_index ON tweet.status_id=tweet_index.status_id\nWHERE tweet_index MATCH ?1\nORDER BY bm25(tweet_index);\n"
  },
  {
    "path": "src/main/sqldelight/migrations/1.sqm",
    "content": "DROP TABLE tweet;\n\nCREATE TABLE tweet(\n\tstatus_id INTEGER NOT NULL PRIMARY KEY,\n\tstatus_user_id INTEGER NOT NULL,\n\tstatus_user_name TEXT NOT NULL,\n\tstatus_text TEXT NOT NULL,\n\n\tretweet_id INTEGER,\n\tretweet_user_id INTEGER,\n\tretweet_user_name TEXT,\n\n\tquoted_id INTEGER,\n\tquoted_user_id INTEGER,\n\tquoted_user_name TEXT,\n\tquoted_text TEXT,\n\n\tjson TEXT NOT NULL\n);\n"
  },
  {
    "path": "src/main/sqldelight/migrations/2.sqm",
    "content": "CREATE TABLE tweet2(\n\tstatus_id INTEGER NOT NULL PRIMARY KEY,\n\tstatus_user_id INTEGER NOT NULL,\n\tstatus_user_name TEXT NOT NULL,\n\tstatus_text TEXT NOT NULL,\n\tstatus_unix_time INTEGER NOT NULL,\n\n\tretweeted_id INTEGER,\n\tretweeted_user_id INTEGER,\n\tretweeted_user_name TEXT,\n\tretweeted_unix_time INTEGER,\n\n\tquoted_id INTEGER,\n\tquoted_user_id INTEGER,\n\tquoted_user_name TEXT,\n\tquoted_text TEXT,\n\tquoted_unix_time INTEGER,\n\n\tjson TEXT NOT NULL\n);\n\nINSERT INTO tweet2\nSELECT status_id\n     , status_user_id\n     , status_user_name\n     , status_text\n     , 0 -- status_unix_time\n     , retweet_id\n     , retweet_user_id\n     , retweet_user_name\n     , 0 -- retweeted_unix_time\n     , quoted_id\n     , quoted_user_id\n     , quoted_user_name\n     , quoted_text\n     , 0 -- quoted_unix_time\n     , json\nFROM tweet\n;\n\nDROP TABLE tweet;\nALTER TABLE tweet2 RENAME TO tweet;\n"
  },
  {
    "path": "src/main/sqldelight/migrations/3.sqm",
    "content": "CREATE TABLE tweet2(\n\tstatus_id INTEGER NOT NULL PRIMARY KEY,\n\tstatus_user_id INTEGER NOT NULL,\n\tstatus_user_handle TEXT NOT NULL,\n\tstatus_user_name TEXT NOT NULL,\n\tstatus_text TEXT NOT NULL,\n\tstatus_unix_time INTEGER NOT NULL,\n\n\t-- Retweet: If one is non-null, all are non-null.\n\tretweeted_id INTEGER,\n\tretweeted_user_id INTEGER,\n\tretweeted_user_handle TEXT,\n\tretweeted_user_name TEXT,\n\tretweeted_unix_time INTEGER,\n\n\t-- Quote tweet: If one is non-null, all are non-null.\n\tquoted_id INTEGER,\n\tquoted_user_id INTEGER,\n\tquoted_user_handle TEXT,\n\tquoted_user_name TEXT,\n\tquoted_text TEXT,\n\tquoted_unix_time INTEGER,\n\n\tjson TEXT NOT NULL\n);\n\nINSERT INTO tweet2\nSELECT status_id\n     , status_user_id\n     , status_user_name\n     , status_user_name -- repurpose name (which was the handle) as display name\n     , status_text\n     , status_unix_time\n     , retweeted_id\n     , retweeted_user_id\n     , retweeted_user_name\n     , retweeted_user_name -- repurpose name (which was the handle) as display name\n     , retweeted_unix_time\n     , quoted_id\n     , quoted_user_id\n     , quoted_user_name\n     , quoted_user_name -- repurpose name (which was the handle) as display name\n     , quoted_text\n     , quoted_unix_time\n     , json\nFROM tweet\n;\n\nDROP TABLE tweet;\nALTER TABLE tweet2 RENAME TO tweet;\n"
  },
  {
    "path": "src/main/sqldelight/migrations/4.sqm",
    "content": "CREATE VIRTUAL TABLE tweet_index USING fts5(\n  status_id INTEGER UNINDEXED,\n  status_text TEXT,\n  status_user_name TEXT,\n  status_user_handle TEXT,\n  retweeted_user_handle TEXT,\n  retweeted_user_name TEXT,\n  quoted_user_handle TEXT,\n  quoted_user_name TEXT,\n  quoted_text TEXT\n);\n\nINSERT INTO tweet_index\nSELECT status_id,\n  status_text,\n  status_user_name,\n  status_user_handle,\n  retweeted_user_handle,\n  retweeted_user_name,\n  quoted_user_handle,\n  quoted_user_name,\n  quoted_text\nFROM tweet;\n\nCREATE TRIGGER tweet_after_insert AFTER INSERT ON tweet BEGIN\n  INSERT INTO tweet_index(\n    status_id,\n    status_text,\n    status_user_name,\n    status_user_handle,\n    retweeted_user_handle,\n    retweeted_user_name,\n    quoted_user_handle,\n    quoted_user_name,\n    quoted_text\n  )\n  VALUES (\n    new.status_id,\n    new.status_text,\n    new.status_user_name,\n    new.status_user_handle,\n    new.retweeted_user_handle,\n    new.retweeted_user_name,\n    new.quoted_user_handle,\n    new.quoted_user_name,\n    new.quoted_text\n  );\nEND;\n"
  },
  {
    "path": "src/main/sqldelight/migrations/5.sqm",
    "content": "CREATE UNIQUE INDEX tweet_status_id ON tweet(status_id);\n"
  },
  {
    "path": "src/test/kotlin/com/jakewharton/dodo/Twitter4jTest.kt",
    "content": "package com.jakewharton.dodo\n\nimport com.google.common.truth.Truth.assertThat\nimport org.junit.Test\n\nclass Twitter4jTest {\n\t@Test fun displayTextNoUrlEntitiesReturnsOriginal() {\n\t\tval status = TestStatus(\n\t\t\t\"This is some text\",\n\t\t\temptyList(),\n\t\t)\n\t\tassertThat(status.displayText).isEqualTo(\"This is some text\")\n\t}\n\n\t@Test fun displayTextUrlFirst() {\n\t\tval status = TestStatus(\n\t\t\t\"This is some text\",\n\t\t\tlistOf(TestURLEntity(\"Expanded\", 0, 4))\n\t\t)\n\t\tassertThat(status.displayText).isEqualTo(\"Expanded is some text\")\n\t}\n\n\t@Test fun displayTextUrlLast() {\n\t\tval status = TestStatus(\n\t\t\t\"This is some text\",\n\t\t\tlistOf(TestURLEntity(\"expanded\", 13, 17))\n\t\t)\n\t\tassertThat(status.displayText).isEqualTo(\"This is some expanded\")\n\t}\n\n\t@Test fun displayTextUrlOutOfOrder() {\n\t\tval status = TestStatus(\n\t\t\t\"This is some text\",\n\t\t\tlistOf(\n\t\t\t\tTestURLEntity(\"expanded\", 13, 17),\n\t\t\t\tTestURLEntity(\"Expanded\", 0, 4),\n\t\t\t)\n\t\t)\n\t\tassertThat(status.displayText).isEqualTo(\"Expanded is some expanded\")\n\t}\n}\n"
  },
  {
    "path": "src/test/kotlin/com/jakewharton/dodo/twitter4jFakes.kt",
    "content": "package com.jakewharton.dodo\n\nimport twitter4j.v1.Status\nimport twitter4j.v1.URLEntity\n\n/** A minimal working subset of [Status] for testing purposes only. */\ndata class TestStatus(\n\tprivate val text: String,\n\tprivate val urlEntities: List<URLEntity>\n) : Status {\n\toverride fun getText() = text\n\toverride fun getURLEntities() = urlEntities.toTypedArray()\n\n\toverride fun getId() = TODO(\"Not yet implemented\")\n\toverride fun getRateLimitStatus() = TODO(\"Not yet implemented\")\n\toverride fun getAccessLevel() = TODO(\"Not yet implemented\")\n\toverride fun getUserMentionEntities() = TODO(\"Not yet implemented\")\n\toverride fun getHashtagEntities() = TODO(\"Not yet implemented\")\n\toverride fun getMediaEntities() = TODO(\"Not yet implemented\")\n\toverride fun getSymbolEntities() = TODO(\"Not yet implemented\")\n\toverride fun getCreatedAt() = TODO(\"Not yet implemented\")\n\toverride fun getDisplayTextRangeStart() = TODO(\"Not yet implemented\")\n\toverride fun getDisplayTextRangeEnd() = TODO(\"Not yet implemented\")\n\toverride fun getSource() = TODO(\"Not yet implemented\")\n\toverride fun isTruncated() = TODO(\"Not yet implemented\")\n\toverride fun getInReplyToStatusId() = TODO(\"Not yet implemented\")\n\toverride fun getInReplyToUserId() = TODO(\"Not yet implemented\")\n\toverride fun getInReplyToScreenName() = TODO(\"Not yet implemented\")\n\toverride fun getGeoLocation() = TODO(\"Not yet implemented\")\n\toverride fun getPlace() = TODO(\"Not yet implemented\")\n\toverride fun isFavorited() = TODO(\"Not yet implemented\")\n\toverride fun isRetweeted() = TODO(\"Not yet implemented\")\n\toverride fun getFavoriteCount() = TODO(\"Not yet implemented\")\n\toverride fun getUser() = TODO(\"Not yet implemented\")\n\toverride fun isRetweet() = TODO(\"Not yet implemented\")\n\toverride fun getRetweetedStatus() = TODO(\"Not yet implemented\")\n\toverride fun getContributors() = TODO(\"Not yet implemented\")\n\toverride fun getRetweetCount() = TODO(\"Not yet implemented\")\n\toverride fun isRetweetedByMe() = TODO(\"Not yet implemented\")\n\toverride fun getCurrentUserRetweetId() = TODO(\"Not yet implemented\")\n\toverride fun isPossiblySensitive() = TODO(\"Not yet implemented\")\n\toverride fun getLang() = TODO(\"Not yet implemented\")\n\toverride fun getScopes() = TODO(\"Not yet implemented\")\n\toverride fun getWithheldInCountries() = TODO(\"Not yet implemented\")\n\toverride fun getQuotedStatusId() = TODO(\"Not yet implemented\")\n\toverride fun getQuotedStatus() = TODO(\"Not yet implemented\")\n\toverride fun getQuotedStatusPermalink() = TODO(\"Not yet implemented\")\n\n\toverride fun compareTo(other: Status?) = TODO(\"Not yet implemented\")\n}\n\ndata class TestURLEntity(\n\tprivate val expandedUrl: String,\n\tprivate val start: Int,\n\tprivate val end: Int,\n) : URLEntity {\n\toverride fun getStart() = start\n\toverride fun getEnd() = end\n\toverride fun getExpandedURL() = expandedUrl\n\n\toverride fun getText() = TODO(\"Not yet implemented\")\n\toverride fun getURL() = TODO(\"Not yet implemented\")\n\toverride fun getDisplayURL() = TODO(\"Not yet implemented\")\n}\n"
  }
]