from origin repo gh:ddworken/hishtory, commit 480630e9181167b51554f4407db55717d9b7e4dd

This commit is contained in:
setop
2022-11-13 10:56:08 +01:00
commit 96d048fba6
99 changed files with 12962 additions and 0 deletions

2
backend/web/landing/www/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules
bower_components

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; URL='https://github.com/ddworken/hishtory'" />
</head>
<body>
<p>See <a href="https://github.com/ddworken/hishtory">here</a>.</p>
</body>
</html>

View File

@@ -0,0 +1,40 @@
"""
A small install script to download the correct hishtory binary for the current OS/architecture.
The hishtory binary is in charge of installing itself, this just downloads the correct binary and
executes it.
"""
import json
import urllib.request
import platform
import sys
import os
with urllib.request.urlopen('https://api.hishtory.dev/api/v1/download') as response:
resp_body = response.read()
download_options = json.loads(resp_body)
if platform.system() == 'Linux':
download_url = download_options['linux_amd_64_url']
elif platform.system() == 'Darwin' and platform.machine() == 'arm64':
download_url = download_options['darwin_arm_64_url']
elif platform.system() == 'Darwin' and platform.machine() == 'x86_64':
download_url = download_options['darwin_amd_64_url']
else:
print(f"No hishtory binary for system={platform.system()}, machine={platform.machine()}!\nIf you believe this is a mistake, please open an issue here: https://github.com/ddworken/hishtory/issues")
sys.exit(1)
with urllib.request.urlopen(download_url) as response:
hishtory_binary = response.read()
tmpdir = os.environ.get('TMPDIR', '') or '/tmp/'
tmpFilePath = tmpdir+'hishtory-client'
if os.path.exists(tmpFilePath):
os.remove(tmpFilePath)
with open(tmpFilePath, 'wb') as f:
f.write(hishtory_binary)
os.system('chmod +x ' + tmpFilePath)
exitCode = os.system(tmpFilePath + ' install')
if exitCode != 0:
raise Exception("failed to install downloaded hishtory client via `" + tmpFilePath +" install` (is that directory mounted noexec? Consider setting an alternate directory via the TMPDIR environment variable)!")
print('Succesfully installed hishtory! Open a new terminal, try running a command, and then running `hishtory query`.')