Compare commits
No commits in common. "e4ca2eecce316990e9af154c4f678c52bbcb79ce" and "bcac3d716e0ceb9a3305428a215da119c985425a" have entirely different histories.
e4ca2eecce
...
bcac3d716e
4 changed files with 7 additions and 87 deletions
|
|
@ -53,7 +53,7 @@ def ls_packages(path):
|
||||||
packages = set()
|
packages = set()
|
||||||
items = path.listdir()
|
items = path.listdir()
|
||||||
for item in items:
|
for item in items:
|
||||||
if item.is_dir and '.' in item.basename and not item.with_child('disable').exists:
|
if item.is_dir and '.' in item.basename:
|
||||||
packages.add(item.basename)
|
packages.add(item.basename)
|
||||||
elif item.is_file and item.extension == 'apk':
|
elif item.is_file and item.extension == 'apk':
|
||||||
package = item.basename.split('-')[0]
|
package = item.basename.split('-')[0]
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,9 @@ log = vlogging.getLogger(__name__, 'getcrx')
|
||||||
FILENAME_BADCHARS = '\\/:*?<>|"'
|
FILENAME_BADCHARS = '\\/:*?<>|"'
|
||||||
|
|
||||||
WEBSTORE_URL = 'https://chrome.google.com/webstore/detail/{extension_id}'
|
WEBSTORE_URL = 'https://chrome.google.com/webstore/detail/{extension_id}'
|
||||||
CRX_URL = 'https://clients2.google.com/service/update2/crx?response=redirect&prodversion=121.0.6167.161&acceptformat=crx2,crx3&x=id%3D{extension_id}%26uc'
|
CRX_URL = 'https://clients2.google.com/service/update2/crx?response=redirect&prodversion=83.0.4103.116&acceptformat=crx2,crx3&x=id%3D{extension_id}%26uc'
|
||||||
USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36'
|
|
||||||
|
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
session.headers={'User-Agent': USER_AGENT}
|
|
||||||
|
|
||||||
def sanitize_filename(name):
|
def sanitize_filename(name):
|
||||||
for c in FILENAME_BADCHARS:
|
for c in FILENAME_BADCHARS:
|
||||||
|
|
@ -31,7 +29,7 @@ def sanitize_filename(name):
|
||||||
|
|
||||||
def get_webstore_name_version(extension_id):
|
def get_webstore_name_version(extension_id):
|
||||||
url = WEBSTORE_URL.format(extension_id=extension_id)
|
url = WEBSTORE_URL.format(extension_id=extension_id)
|
||||||
response = session.get(url, timeout=60)
|
response = session.get(url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
70
makespam.py
70
makespam.py
|
|
@ -1,70 +0,0 @@
|
||||||
import time
|
|
||||||
import textwrap
|
|
||||||
import re
|
|
||||||
import html
|
|
||||||
import pyperclip
|
|
||||||
|
|
||||||
TEMPLATE = '''
|
|
||||||
<article>
|
|
||||||
{selectheaders}
|
|
||||||
<details>
|
|
||||||
<summary>Headers</summary>
|
|
||||||
<pre>
|
|
||||||
{headers}
|
|
||||||
</pre>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
{body}
|
|
||||||
</article>
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
print('Copy the body...')
|
|
||||||
pyperclip.copy('')
|
|
||||||
while pyperclip.paste() == '':
|
|
||||||
time.sleep(0.5)
|
|
||||||
body = html.escape(pyperclip.paste())
|
|
||||||
body = body.replace('\r', '')
|
|
||||||
body = [line.strip() for line in body.splitlines()]
|
|
||||||
body = [line for line in body if line]
|
|
||||||
body = ['<p>' + line + '</p>' for line in body]
|
|
||||||
body = '\n'.join(body)
|
|
||||||
body = textwrap.indent(body, ' ')
|
|
||||||
|
|
||||||
print('Copy the headers...')
|
|
||||||
pyperclip.copy('')
|
|
||||||
while pyperclip.paste() == '':
|
|
||||||
time.sleep(0.5)
|
|
||||||
headers = html.escape(pyperclip.paste())
|
|
||||||
headers = headers.replace('\r', '')
|
|
||||||
headers = [line.rstrip() for line in headers.splitlines()]
|
|
||||||
headers = [line for line in headers if line]
|
|
||||||
headers = '\n'.join(headers)
|
|
||||||
|
|
||||||
keyed = {}
|
|
||||||
for line in headers.splitlines():
|
|
||||||
key = re.search(r'^([A-Za-z\-]+): ', line, flags=re.MULTILINE)
|
|
||||||
if key is None:
|
|
||||||
continue
|
|
||||||
key = key.group(1)
|
|
||||||
line = line.replace(key + ':', '<p><b>' + key + '</b>:')
|
|
||||||
keyed[key] = line
|
|
||||||
|
|
||||||
selectheaders = [
|
|
||||||
keyed.get('From'),
|
|
||||||
keyed.get('Reply-To'),
|
|
||||||
keyed.get('Return-Path'),
|
|
||||||
keyed.get('To'),
|
|
||||||
keyed.get('Bcc'),
|
|
||||||
keyed.get('Subject'),
|
|
||||||
keyed.get('Date'),
|
|
||||||
]
|
|
||||||
selectheaders = [s for s in selectheaders if s]
|
|
||||||
selectheaders = '\n'.join(selectheaders)
|
|
||||||
selectheaders = textwrap.indent(selectheaders, ' ')
|
|
||||||
|
|
||||||
spam = TEMPLATE.format(body=body, headers=headers, selectheaders=selectheaders)
|
|
||||||
print(spam)
|
|
||||||
pyperclip.copy(spam)
|
|
||||||
|
|
@ -109,8 +109,7 @@ article .photograph:last-of-type
|
||||||
{
|
{
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
.photograph img,
|
.photograph img
|
||||||
.photograph video
|
|
||||||
{
|
{
|
||||||
max-height: 92vh;
|
max-height: 92vh;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
|
@ -287,19 +286,12 @@ pre,
|
||||||
<p>Click each photo to view its full resolution. Click the number to download it.</p>
|
<p>Click each photo to view its full resolution. Click the number to download it.</p>
|
||||||
|
|
||||||
{% for file in files %}
|
{% for file in files %}
|
||||||
{% if file.extension == 'jpg' %}
|
|
||||||
<article class="photograph">
|
<article class="photograph">
|
||||||
<a target="_blank" href="{{urlroot}}{{file.relative_to('.', simple=True)}}"><img loading="lazy" src="{{urlroot}}thumbs/small_{{file.relative_to('.', simple=True)}}"/></a>
|
<a target="_blank" href="{{urlroot}}{{file.relative_to('.', simple=True)}}"><img loading="lazy" src="{{urlroot}}thumbs/small_{{file.relative_to('.', simple=True)}}"/></a>
|
||||||
{% if with_download_links %}
|
{% if with_download_links %}
|
||||||
<a class="download_link" download="{{file.basename}}" href="{{urlroot}}{{file.relative_to('.', simple=True)}}">#{{loop.index}}/{{files|length}}</a>
|
<a class="download_link" download="{{file.basename}}" href="{{urlroot}}{{file.relative_to('.', simple=True)}}">#{{loop.index}}/{{files|length}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</article>
|
</article>
|
||||||
{% elif file.extension in ['mp4', 'mov'] %}
|
|
||||||
<article class="photograph">
|
|
||||||
<p>{{file.replace_extension('').basename}}</p>
|
|
||||||
<video controls preload="none" src="{{urlroot}}{{file.relative_to('.', simple=True)}}" poster="{{urlroot}}thumbs/small_{{file.replace_extension('jpg').relative_to('.', simple=True)}}"></video>
|
|
||||||
</article>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
@ -340,7 +332,7 @@ function get_center_img()
|
||||||
{
|
{
|
||||||
const element = document.elementFromPoint(center_x, center_y);
|
const element = document.elementFromPoint(center_x, center_y);
|
||||||
console.log(element);
|
console.log(element);
|
||||||
if (element.tagName === "IMG" || element.tagName === "VIDEO")
|
if (element.tagName === "IMG")
|
||||||
{
|
{
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
@ -353,7 +345,7 @@ function get_center_img()
|
||||||
}
|
}
|
||||||
function next_img(img)
|
function next_img(img)
|
||||||
{
|
{
|
||||||
const images = Array.from(document.querySelectorAll("img,video"));
|
const images = Array.from(document.images);
|
||||||
const this_index = images.indexOf(img);
|
const this_index = images.indexOf(img);
|
||||||
if (this_index === images.length-1)
|
if (this_index === images.length-1)
|
||||||
{
|
{
|
||||||
|
|
@ -363,7 +355,7 @@ function next_img(img)
|
||||||
}
|
}
|
||||||
function previous_img(img)
|
function previous_img(img)
|
||||||
{
|
{
|
||||||
const images = Array.from(document.querySelectorAll("img,video"));
|
const images = Array.from(document.images);
|
||||||
const this_index = images.indexOf(img);
|
const this_index = images.indexOf(img);
|
||||||
if (this_index === 0)
|
if (this_index === 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue