<?xml version="1.0" encoding="UTF-8"?>
<!--

    BleachBit
    Copyright (C) 2008-2025 Andrew Ziem
    https://www.bleachbit.org

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

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    @app Opera
    @url https://www.opera.com/
    @os Windows, Linux
    @cleanerversion v1.6.1
    @cleanerdate 2019-03-29
    @cleanerby Andrew Ziem (2009-10-04 - 2018-11-20) & theatre-x (2014-11-04) & Tobias B. Besemer (2019-03-13 - 2019-03-29)
    @tested ok
    @testeddate
    @testedby
    @note Opera version 15 switched layout engine to Blink like Chromium
    @note Unlike Chromium, Opera does not support multiple profiles

-->
<cleaner id="opera">
  <label>Opera</label>
  <description>Web browser</description>
  <running type="exe" os="linux" same_user="true">opera</running>
  <running type="exe" os="windows" same_user="true">opera.exe</running>
  <var name="base">
    <!-- On Windows 10, Opera 68 created "Opera Stable" and "Opera Next" directories.
        The "Opera Next" is for Opera beta.
        -->
    <value os="windows" search="glob">%AppData%\Opera Software\Opera*</value>
    <value os="linux">$XDG_CONFIG_HOME/opera</value>
  </var>
  <var name="profile">
    <value os="windows" search="glob">%AppData%\Opera Software\Opera*</value>
    <value os="linux">$XDG_CONFIG_HOME/opera</value>
    <!-- examples:
        ~/snap/opera/current/.config/opera
        ~/snap/opera-beta/60/.config/opera-beta
        -->
    <value os="linux" search="glob">~/snap/opera*/*/.config/opera*</value>
  </var>
  <var name="localapp">
    <value os="windows" search="glob">%LocalAppData%\Opera Software\Opera*</value>
  </var>
  <option id="cache">
    <label>Cache</label>
    <description>Delete the web cache, which reduces time to display revisited pages</description>
    <action command="delete" search="walk.all" path="$$base$$/ShaderCache"/>
    <action command="delete" search="walk.all" path="$$profile$$/File System"/>
    <action command="delete" search="walk.all" path="$$profile$$/Service Worker"/>
    <action command="delete" search="walk.files" path="$$profile$$/GPUCache/"/>
    <action command="delete" search="file" path="$$profile$$/Preferences.backup"/>
    <action command="json" search="file" path="$$profile$$/Preferences" address="dns_prefetching/host_referral_list"/>
    <action command="json" search="file" path="$$profile$$/Preferences" address="dns_prefetching/startup_list"/>
    <action command="json" search="file" path="$$profile$$/Preferences" address="net/http_server_properties/servers"/>
    <!-- suggestions.cache was found on Opera 56 but not on Google Chrome 69 -->
    <action command="delete" search="file" path="$$profile$$/suggestions_cache.json"/>
    <!-- Linux-specific -->
    <action command="delete" search="walk.files" path="$XDG_CACHE_HOME/opera/"/>
    <!-- Opera will complain if you delete ~/snap/opera/common/.cache/gdk-pixbuf-loaders.cache -->
    <action command="delete" search="walk.files" path="~/snap/opera/common/.cache/opera"/>
    <action command="delete" search="walk.files" path="~/snap/opera-beta/common/.cache/opera-beta"/>
    <!-- Windows-specific -->
    <action command="delete" search="walk.files" path="$$localapp$$\Cache\"/>
    <action command="delete" search="walk.files" path="$$localapp$$\Media Cache\"/>
    <!-- below are entries valid before Opera 15 -->
    <action command="delete" search="walk.files" path="%LocalAppData%\Opera\Opera*\cache\"/>
    <action command="delete" search="walk.files" path="%LocalAppData%\Opera\Opera*\opcache\"/>
    <action command="delete" search="walk.files" path="%LocalAppData%\Opera\Opera*\thumbnails\"/>
    <action command="delete" search="walk.files" path="%LocalAppData%\Opera\Opera*\profile\cache4\"/>
    <action command="delete" search="walk.files" path="%LocalAppData%\Opera\Opera*\profile\opcache\"/>
    <action command="delete" search="walk.files" path="~/.opera/cache/"/>
    <action command="delete" search="walk.files" path="~/.opera/cache4/"/>
    <action command="delete" search="walk.files" path="~/.opera/opcache/"/>
    <action command="delete" search="walk.files" path="~/.opera/thumbnails/"/>
  </option>
  <option id="cookies">
    <label>Cookies</label>
    <description>Delete cookies, which contain information such as web site preferences, authentication, and tracking identification</description>
    <action command="delete" search="file" path="$$profile$$/Cookies"/>
    <action command="delete" search="file" path="$$profile$$/Cookies-journal"/>
    <action command="delete" search="file" path="$$profile$$/Extension Cookies"/>
    <action command="delete" search="file" path="$$profile$$/Extension Cookies-journal"/>
    <action command="delete" search="walk.all" path="$$profile$$/IndexedDB/"/>
    <!-- below are entries valid before Opera 15 -->
    <!-- example: C:\Documents and Settings\user\Application Data\Opera\Opera\cookies.txt -->
    <!-- example: C:\Documents and Settings\user\Application Data\Opera\Opera 11.00 beta\cookies.txt -->
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\cookies4.dat"/>
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\profile\cookies4.dat"/>
    <action command="delete" search="file" path="~/.opera/cookies4.dat"/>
  </option>
  <option id="dom">
    <label>DOM Storage</label>
    <description>Delete HTML5 cookies</description>
    <action command="chrome.databases_db" search="file" path="$$profile$$/databases/Databases.db"/>
    <action command="delete" search="walk.all" path="$$profile$$/databases/http*/"/>
    <action command="delete" search="walk.all" path="$$profile$$/Local Storage/leveldb"/>
    <!-- below are entries valid before Opera 15 -->
    <action command="delete" search="walk.all" path="%AppData%\Opera\Opera*\pstorage\"/>
    <action command="delete" search="walk.all" path="~/.opera/pstorage/"/>
  </option>
  <option id="form_history">
    <label>Form history</label>
    <description>A history of forms entered in web sites</description>
    <action command="chrome.autofill" search="file" path="$$profile$$/Web Data"/>
  </option>
  <option id="history">
    <label>History</label>
    <description>Delete the history which includes visited sites, downloads, and thumbnails</description>
    <!-- keep /History before /Favicons -->
    <action command="chrome.history" search="file" path="$$profile$$/History"/>
    <action command="chrome.favicons" search="file" path="$$profile$$/Favicons"/>
    <action command="delete" search="file" path="$$profile$$/History-journal"/>
    <action command="delete" search="file" path="$$profile$$/History Provider Cache"/>
    <action command="delete" search="file" path="$$profile$$/Favicons-journal"/>
    <action command="delete" search="file" path="$$profile$$/Network Action Predictor"/>
    <action command="delete" search="file" path="$$profile$$/Network Action Predictor-journal"/>
    <action command="delete" search="file" path="$$profile$$/Origin Bound Certs-journal"/>
    <action command="delete" search="file" path="$$profile$$/Shortcuts"/>
    <action command="delete" search="file" path="$$profile$$/Shortcuts-journal"/>
    <action command="delete" search="file" path="$$profile$$/Visited Links"/>
    <action command="delete" search="file" path="$$profile$$/QuotaManager"/>
    <action command="delete" search="file" path="$$profile$$/QuotaManager-journal"/>
    <!-- Windows-specific -->
    <action command="delete" search="walk.files" path="$$profile$$\JumpListIconsOld\"/>
    <action command="delete" search="walk.files" path="$$profile$$\JumpListIcons\"/>
    <!-- Opera 68 beta on Windows has "Jump List Icons" spelled with space -->
    <action command="delete" search="walk.files" path="$$profile$$\Jump List Icons\"/>
    <action command="delete" search="walk.files" path="$$profile$$\Jump List IconsOld\"/>
    <!-- below are entries valid before Opera 15 -->
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\download.dat"/>
    <action command="delete" search="file" path="%AppData%\Opera\Opera\profile\download.dat"/>
    <action command="delete" search="file" path="~/.opera/download.dat"/>
    <action command="delete" search="file" path="%AppData%\Opera\Opera*\search_field_history.dat"/>
    <action command="delete" search="file" path="~/.opera/search_field_history.dat"/>
    <!-- global.dat is in Opera 9, global_history.dat is in Opera 10 -->
    <action command="delete" search="file" path="%AppData%\Opera\Opera\profile\global.dat"/>
    <action command="delete" search="file" path="%AppData%\Opera\Opera\profile\typed_history.xml"/>
    <action command="delete" search="file" path="%AppData%\Opera\Opera\profile\vlink4.dat"/>
    <action command="delete" search="file" path="%LocalAppData%\Opera\Opera\profile\vps\????\md.dat"/>
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\global_history.dat"/>
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\typed_history.xml"/>
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\vlink4.dat"/>
    <action command="delete" search="glob" path="%LocalAppData%\Opera\Opera*\icons\*.gif"/>
    <action command="delete" search="glob" path="%LocalAppData%\Opera\Opera*\icons\*.ico"/>
    <action command="delete" search="glob" path="%LocalAppData%\Opera\Opera*\icons\*.idx"/>
    <action command="delete" search="glob" path="%LocalAppData%\Opera\Opera*\vps\????\md.dat"/>
    <action command="delete" search="file" path="~/.opera/global.dat"/>
    <action command="delete" search="file" path="~/.opera/global_history.dat"/>
    <action command="delete" search="file" path="~/.opera/typed_history.xml"/>
    <action command="delete" search="file" path="~/.opera/vlink4.dat"/>
    <action command="delete" search="glob" path="~/.opera/icons/*.gif"/>
    <action command="delete" search="glob" path="~/.opera/icons/*.ico"/>
    <action command="delete" search="glob" path="~/.opera/icons/*.idx"/>
    <action command="delete" search="glob" path="~/.opera/vps/????/md.dat"/>
  </option>
  <option id="passwords">
    <label>Passwords</label>
    <description>A database of usernames and passwords as well as a list of sites that should not store passwords</description>
    <warning>This option will delete your saved passwords.</warning>
    <action command="delete" search="file" path="$$profile$$/Login Data"/>
    <action command="delete" search="file" path="$$profile$$/Login Data-journal"/>
    <!-- below are entries valid before Opera 15 -->
    <action command="delete" search="file" path="~/.opera/wand.dat"/>
  </option>
  <option id="session">
    <label>Session</label>
    <description>Delete the current and last sessions</description>
    <action command="delete" search="file" path="$$profile$$/Current Session"/>
    <action command="delete" search="file" path="$$profile$$/Current Tabs"/>
    <action command="delete" search="file" path="$$profile$$/Last Session"/>
    <action command="delete" search="walk.all" path="$$profile$$/Extension State"/>
    <!-- Last Tabs was found on Opera 56 but not on Google Chrome 69 -->
    <action command="delete" search="file" path="$$profile$$/Last Tabs"/>
    <!-- Session Storage were found on Opera 68 but not on Google Chrome 80 -->
    <action command="delete" search="walk.all" path="$$profile$$/Session Storage"/>
    <!-- below are entries valid before Opera 15 -->
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\sessions\autosave.win"/>
    <action command="delete" search="glob" path="%AppData%\Opera\Opera*\sessions\autosave.win.bak"/>
    <action command="delete" search="file" path="~/.opera/sessions/autosave.win"/>
    <action command="delete" search="file" path="~/.opera/sessions/autosave.win.bak"/>
  </option>
  <option id="vacuum">
    <label>Vacuum</label>
    <description>Clean database fragmentation to reduce space and improve speed without removing any data</description>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/autoupdate_checker.sqlite"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/Cookies"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/History"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/Login Data"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/Origin Bound Certs"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/Network Action Predictor"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/previews_opt_out.db"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/QuotaManager"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/Shortcuts"/>
    <!-- Before about January 2016 Thumbnails was an SQLite file, by Google Chrome 48 it is a folder -->
    <action command="sqlite.vacuum" search="file" path="$$profile$$/Thumbnails" type="f"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/Web Data"/>
    <action command="sqlite.vacuum" search="file" path="$$profile$$/databases/Databases.db"/>
    <action command="sqlite.vacuum" search="glob" path="$$profile$$/databases/http*/?"/>
    <action command="sqlite.vacuum" search="glob" path="$$profile$$/databases/http*/??"/>
  </option>
  <option id="site_preferences">
    <label>Site preferences</label>
    <description>Settings for individual sites</description>
    <action command="json" search="file" path="$$profile$$/Preferences" address="profile/content_settings/exceptions"/>
  </option>
</cleaner>
