Compare commits
No commits in common. "796c2dde92d30e330d805b25252a024b7f990950" and "0b9fe434d872d810640ba6d1e9fc07a068c79a5a" have entirely different histories.
796c2dde92
...
0b9fe434d8
1123
RELEASES.md
1123
RELEASES.md
File diff suppressed because it is too large
Load Diff
80
generate_keys.sh
Normal file
80
generate_keys.sh
Normal file
@ -0,0 +1,80 @@
|
||||
#!/bin/env sh
|
||||
|
||||
persist_dir=/persist
|
||||
target_dir=${persist_dir}/comma
|
||||
# Change target dir from sunnylink to comma to make this no longer a test
|
||||
|
||||
|
||||
# Function to remount /persist as read-only
|
||||
cleanup() {
|
||||
echo "Remounting ${persist_dir} as read-only..."
|
||||
sudo mount -o remount,ro ${persist_dir}
|
||||
}
|
||||
|
||||
# Function to check and backup existing keys
|
||||
backup_keys() {
|
||||
if [ -f "id_rsa" ] || [ -f "id_rsa.pub" ]; then
|
||||
timestamp=$(date +%s)
|
||||
backup_base="id_rsa_backup_$timestamp"
|
||||
backup_private="$backup_base"
|
||||
backup_public="${backup_base}.pub"
|
||||
|
||||
# Ensure we're not overwriting an existing backup
|
||||
counter=0
|
||||
while [ -f "$backup_private" ] || [ -f "$backup_public" ]; do
|
||||
counter=$((counter + 1))
|
||||
backup_private="${backup_base}_$counter"
|
||||
backup_public="${backup_base}_$counter.pub"
|
||||
done
|
||||
|
||||
# Backup the keys
|
||||
cp id_rsa "$backup_private"
|
||||
cp id_rsa.pub "$backup_public"
|
||||
|
||||
# Verify the backup
|
||||
original_private_hash=$(sha256sum id_rsa | cut -d ' ' -f 1)
|
||||
backup_private_hash=$(sha256sum "$backup_private" | cut -d ' ' -f 1)
|
||||
original_public_hash=$(sha256sum id_rsa.pub | cut -d ' ' -f 1)
|
||||
backup_public_hash=$(sha256sum "$backup_public" | cut -d ' ' -f 1)
|
||||
|
||||
if [ "$original_private_hash" = "$backup_private_hash" ] && [ "$original_public_hash" = "$backup_public_hash" ]; then
|
||||
echo "Backup verified successfully."
|
||||
# Safe to delete original keys after successful backup verification
|
||||
else
|
||||
echo "Backup verification failed. Aborting operation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Existing keys backed up as $backup_private and $backup_public"
|
||||
fi
|
||||
}
|
||||
|
||||
# Remount /persist as read-write
|
||||
sudo mount -o remount,rw ${persist_dir}
|
||||
|
||||
# Ensure the directory exists
|
||||
mkdir -p ${target_dir}
|
||||
cd ${target_dir}
|
||||
|
||||
# Check for and backup existing keys
|
||||
#backup_keys
|
||||
|
||||
# Generate new keys
|
||||
if ! ssh-keygen -t rsa -b 4096 -m PEM -f id_rsa -N ''; then
|
||||
echo "Failed to generate new RSA keys. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
chmod +r id_rsa
|
||||
# Convert the generated SSH public key to PEM format and store it temporarily
|
||||
if ! openssl rsa -pubout -in id_rsa -out id_rsa.pub -outform PEM; then
|
||||
echo "Failed to convert the public key to PEM format. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Display the public key
|
||||
echo "Displaying the public key:"
|
||||
cat id_rsa.pub
|
||||
|
||||
# Cleanup will be called automatically due to trap on EXIT
|
||||
#echo "Operation completed successfully. System will reboot now."
|
||||
#sudo reboot
|
@ -1,11 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 设置 Mapbox 公钥和密钥
|
||||
echo "pk.eyJ1IjoibWF3ZWl5dXdlaXdlaSIsImEiOiJjbGtrdjhhMHUwbWwzM3VwYzVtbXkwY2lrIn0.-u-QP8-tfrhAIpvQiNMsOw" > /data/params/d/MapboxPublicKey
|
||||
echo "sk.eyJ1IjoibWF3ZWl5dXdlaXdlaSIsImEiOiJjbG15NHN1dDMwdWc5MmxwaDdkZ3Z5dHNyIn0.pk06qTKkAZyBC1Z37v8i0A" > /data/params/d/MapboxSecretKey
|
||||
|
||||
# 设置适当的权限
|
||||
chmod 644 /data/params/d/MapboxPublicKey
|
||||
chmod 644 /data/params/d/MapboxSecretKey
|
||||
export API_HOST=https://api.konik.ai
|
||||
export ATHENA_HOST=wss://athena.konik.ai
|
||||
|
||||
exec ./launch_chffrplus.sh
|
||||
|
@ -15,6 +15,12 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.9.2/dist/js/uikit.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.9.2/dist/js/uikit-icons.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode:'fc2724b3c96a7f244b2211f05c5264be',
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
@ -61,209 +67,149 @@
|
||||
.amap-info-content {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#map-section {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 添加 API 密钥输入表单 -->
|
||||
<div id="api-keys-section" class="uk-card uk-card-default uk-card-body uk-margin-bottom">
|
||||
<h3 class="uk-card-title">请输入高德地图 API 密钥</h3>
|
||||
<div class="uk-margin">
|
||||
<label class="uk-form-label" for="security-js-code">安全密钥 (Security JS Code):</label>
|
||||
<input class="uk-input" type="text" id="security-js-code" placeholder="请输入 securityJsCode">
|
||||
</div>
|
||||
<div class="uk-margin">
|
||||
<label class="uk-form-label" for="api-key">API 密钥 (Key):</label>
|
||||
<input class="uk-input" type="text" id="api-key" placeholder="请输入 API key">
|
||||
</div>
|
||||
<button class="uk-button uk-button-primary" id="load-map-btn">加载地图</button>
|
||||
</div>
|
||||
<script type="text/javascript"
|
||||
src="https://webapi.amap.com/maps?v=1.4.2&key=faf2f8ab406a8da1231ef7e10d501b65"></script>
|
||||
|
||||
<!-- 地图和搜索区域 -->
|
||||
<div id="map-section">
|
||||
<div class="uk-grid-match uk-grid-small uk-text-center" uk-grid>
|
||||
<div class="uk-width-1-3@m">
|
||||
<select id="save_type" class="uk-select">
|
||||
<option value="recent">最近</option>
|
||||
<option value="home">住家</option>
|
||||
<option value="work">工作</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-expand@m">
|
||||
<input class="uk-input" type="text" id="keyword" name="keyword"
|
||||
placeholder="请输入关键字:(选定后搜索)" onfocus='this.value=""' />
|
||||
</div>
|
||||
<!-- Rest of the HTML body content -->
|
||||
<div class="uk-grid-match uk-grid-small uk-text-center" uk-grid>
|
||||
<div class="uk-width-1-3@m">
|
||||
<select id="save_type" class="uk-select">
|
||||
<option value="recent">最近</option>
|
||||
<option value="home">住家</option>
|
||||
<option value="work">工作</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-expand@m">
|
||||
<input class="uk-input" type="text" id="keyword" name="keyword"
|
||||
placeholder="请输入关键字:(选定后搜索)" onfocus='this.value=""' />
|
||||
</div>
|
||||
<input type="hidden" id="longitude" />
|
||||
<input type="hidden" id="latitude" />
|
||||
<div style="height: 600px" id="container"></div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="longitude" />
|
||||
<input type="hidden" id="latitude" />
|
||||
<div style="height: 600px" id="container"></div>
|
||||
<script type="text/javascript">
|
||||
// 全局变量声明
|
||||
var windowsArr = [];
|
||||
var markers = [];
|
||||
var map = null;
|
||||
var infoWindow = null;
|
||||
var autocomplete = null;
|
||||
var initMapFunction = function() {
|
||||
windowsArr = [];
|
||||
markers = [];
|
||||
map = new AMap.Map("container", {
|
||||
resizeEnable: true,
|
||||
center: [{{lat}}, {{lon}}],
|
||||
zoom: 13,
|
||||
keyboardEnable: false
|
||||
});
|
||||
var markers = [];
|
||||
var map = new AMap.Map("container", {
|
||||
resizeEnable: true,
|
||||
center: [{{lat}}, {{lon}}], //地图中心点
|
||||
zoom: 13, //地图显示的缩放级别
|
||||
keyboardEnable: false,
|
||||
});
|
||||
|
||||
// 定义打开信息窗体的函数
|
||||
function openInfo(name, addr, lng, lat) {
|
||||
// 构建信息窗体中显示的内容
|
||||
var info = [];
|
||||
info.push('<div class="uk-card uk-card-default uk-card-body">');
|
||||
info.push('<a class="uk-card-badge uk-label" onClick="javascript:infoWindow.close()" uk-close></a>');
|
||||
info.push("<h3 style=\"padding-top: 10px;\" class=\"uk-card-title\">" + name + "</h3>");
|
||||
info.push("<p>" + addr + "</p>");
|
||||
info.push('<div class="uk-card-footer">');
|
||||
info.push('<form name="navForm" method="post">');
|
||||
info.push(' <input type="hidden" name="lat" value="' + lat + '">');
|
||||
info.push(' <input type="hidden" name="lon" value="' + lng + '">');
|
||||
info.push(' <input type="hidden" name="save_type" value="' + document.getElementById("save_type").value + '">');
|
||||
info.push(' <input type="hidden" name="name" value="' + name + '">');
|
||||
info.push(' <input class="uk-button uk-button-primary" type="submit" value="导航" >');
|
||||
info.push('</form>');
|
||||
info.push('</div>');
|
||||
info.push("</div>");
|
||||
var infoWindow;
|
||||
function openInfo(name, addr, lng, lat) {
|
||||
//构建信息窗体中显示的内容
|
||||
var info = [];
|
||||
info.push('<div class="uk-card uk-card-default uk-card-body">');
|
||||
info.push('<a class="uk-card-badge uk-label" onClick="javascript:infoWindow.close()" uk-close></a>');
|
||||
info.push("<h3 style=\"padding-top: 10px;\" class=\"uk-card-title\">" + name + "</h3>");
|
||||
info.push("<p>" + addr + "</p>");
|
||||
info.push('<div class="uk-card-footer">');
|
||||
info.push('<form name="navForm" method="post">');
|
||||
info.push(' <input type="hidden" name="lat" value="' + lat + '">');
|
||||
info.push(' <input type="hidden" name="lon" value="' + lng + '">');
|
||||
info.push(' <input type="hidden" name="save_type" value="' + document.getElementById("save_type").value + '">');
|
||||
info.push(' <input type="hidden" name="name" value="' + name + '">');
|
||||
info.push(' <input class="uk-button uk-button-primary" type="submit" value="导航" >');
|
||||
info.push('</form>');
|
||||
info.push('</div>');
|
||||
info.push("</div>");
|
||||
|
||||
var pos = new AMap.LngLat(lng, lat);
|
||||
infoWindow = new AMap.InfoWindow({
|
||||
position: pos,
|
||||
isCustom: true,
|
||||
offset: new AMap.Pixel(0, -30),
|
||||
content: info.join("") // 使用默认信息窗体框样式,显示信息内容
|
||||
});
|
||||
var pos = new AMap.LngLat(lng, lat)
|
||||
infoWindow = new AMap.InfoWindow({
|
||||
position: pos,
|
||||
isCustom: true,
|
||||
offset: new AMap.Pixel(0, -30),
|
||||
content: info.join(""), //使用默认信息窗体框样式,显示信息内容
|
||||
});
|
||||
|
||||
infoWindow.open(map, pos);
|
||||
}
|
||||
infoWindow.open(map, pos);
|
||||
}
|
||||
AMap.plugin(["AMap.Autocomplete", "AMap.PlaceSearch"], function () {
|
||||
var autoOptions = {
|
||||
city: "全国", //城市,默认全国
|
||||
input: "keyword", //使用联想输入的input的id
|
||||
};
|
||||
autocomplete = new AMap.Autocomplete(autoOptions);
|
||||
var placeSearch = new AMap.PlaceSearch({
|
||||
map: "",
|
||||
});
|
||||
AMap.event.addListener(autocomplete, "select", function (e) {
|
||||
//TODO 针对选中的poi实现自己的功能
|
||||
//重寫搜尋點及其提示資訊begin=====
|
||||
placeSearch.setCity(e.poi.adcode);
|
||||
if (e.poi && e.poi.location) {
|
||||
map.setZoom(17);
|
||||
map.setCenter(e.poi.location);
|
||||
}
|
||||
placeSearch.search(e.poi.name, check_dest); //關鍵字查詢查詢
|
||||
|
||||
// 加载插件
|
||||
AMap.plugin(["AMap.Autocomplete", "AMap.PlaceSearch"], function() {
|
||||
var autoOptions = {
|
||||
city: "全国", // 城市,默认全国
|
||||
input: "keyword" // 使用联想输入的input的id
|
||||
};
|
||||
autocomplete = new AMap.Autocomplete(autoOptions);
|
||||
var placeSearch = new AMap.PlaceSearch({
|
||||
map: ""
|
||||
});
|
||||
|
||||
// 添加选择事件监听器
|
||||
AMap.event.addListener(autocomplete, "select", function(e) {
|
||||
// 重写搜索点及其提示信息
|
||||
placeSearch.setCity(e.poi.adcode);
|
||||
if (e.poi && e.poi.location) {
|
||||
map.setZoom(17);
|
||||
map.setCenter(e.poi.location);
|
||||
}
|
||||
placeSearch.search(e.poi.name, check_dest); // 关键字查询
|
||||
|
||||
function check_dest(status, result) {
|
||||
if (status === "complete" && result.info === "OK") {
|
||||
for (var h = 0; h < result.poiList.pois.length; h++) {
|
||||
// 返回搜索列表循环绑定marker
|
||||
var jy = result.poiList.pois[h]["location"]; // 经纬度
|
||||
var name = result.poiList.pois[h]["name"]; // 地址
|
||||
var marker = new AMap.Marker({ // 加点
|
||||
map: map,
|
||||
position: jy
|
||||
});
|
||||
marker.extData = {
|
||||
getLng: jy["lng"],
|
||||
getLat: jy["lat"],
|
||||
name: name,
|
||||
address: result.poiList.pois[h]["address"]
|
||||
}; // 自定义传入的参数
|
||||
|
||||
marker.on("click", function(e) {
|
||||
var hs = e.target.extData;
|
||||
openInfo(
|
||||
hs["name"],
|
||||
hs["address"],
|
||||
hs["getLng"],
|
||||
hs["getLat"]
|
||||
);
|
||||
});
|
||||
markers.push(marker);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 添加地图点击事件
|
||||
map.on('click', function(e) {
|
||||
map.remove(markers);
|
||||
document.getElementById('longitude').value = e.lnglat.getLng();
|
||||
document.getElementById('latitude').value = e.lnglat.getLat();
|
||||
var lnglatXY = [e.lnglat.getLng(), e.lnglat.getLat()];
|
||||
var marker = new AMap.Marker({
|
||||
map: map,
|
||||
position: lnglatXY
|
||||
});
|
||||
marker.extData = {
|
||||
getLng: e.lnglat.getLng(),
|
||||
getLat: e.lnglat.getLat()
|
||||
};
|
||||
|
||||
marker.on("click", function(e) {
|
||||
var hs = e.target.extData;
|
||||
openInfo(
|
||||
"",
|
||||
"(" + hs["getLat"] + ", " + hs["getLng"] + ")",
|
||||
hs["getLng"],
|
||||
hs["getLat"]
|
||||
);
|
||||
});
|
||||
markers.push(marker);
|
||||
if (typeof(infoWindow) != "undefined") {
|
||||
infoWindow.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('load-map-btn').addEventListener('click', function() {
|
||||
var securityJsCode = document.getElementById('security-js-code').value;
|
||||
var apiKey = document.getElementById('api-key').value;
|
||||
|
||||
if (!securityJsCode || !apiKey) {
|
||||
alert('请输入安全密钥和 API 密钥');
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置安全配置
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode: securityJsCode
|
||||
};
|
||||
|
||||
// 加载高德地图 API
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = 'https://webapi.amap.com/maps?v=1.4.2&key=' + apiKey;
|
||||
script.onload = function() {
|
||||
initMapFunction();
|
||||
};
|
||||
document.head.appendChild(script);
|
||||
|
||||
// 显示地图区域
|
||||
document.getElementById('api-keys-section').style.display = 'none';
|
||||
document.getElementById('map-section').style.display = 'block';
|
||||
function check_dest(status, result) {
|
||||
if (status === "complete" && result.info === "OK") {
|
||||
for (var h = 0; h < result.poiList.pois.length; h++) {
|
||||
//返回搜尋列表迴圈繫結marker
|
||||
var jy = result.poiList.pois[h]["location"]; //經緯度
|
||||
var name = result.poiList.pois[h]["name"]; //地址
|
||||
marker = new AMap.Marker({
|
||||
//加點
|
||||
map: map,
|
||||
position: jy,
|
||||
});
|
||||
marker.extData = {
|
||||
getLng: jy["lng"],
|
||||
getLat: jy["lat"],
|
||||
name: name,
|
||||
address: result.poiList.pois[h]["address"],
|
||||
}; //自定義想傳入的引數
|
||||
|
||||
marker.on("click", function (e) {
|
||||
var hs = e.target.extData;
|
||||
var content = openInfo(
|
||||
hs["name"],
|
||||
hs["address"],
|
||||
hs["getLng"],
|
||||
hs["getLat"]
|
||||
);
|
||||
});
|
||||
markers.push(marker);
|
||||
}
|
||||
}
|
||||
}
|
||||
//重寫搜尋點及其提示資訊end=====
|
||||
});
|
||||
});
|
||||
var clickEventListener = map.on('click', function(e) {
|
||||
map.remove(markers);
|
||||
document.getElementById('longitude').value = e.lnglat.getLng();
|
||||
document.getElementById('latitude').value = e.lnglat.getLat();
|
||||
lnglatXY = [e.lnglat.getLng(), e.lnglat.getLat()];
|
||||
var marker = new AMap.Marker({
|
||||
//加點
|
||||
map: map,
|
||||
position: lnglatXY,
|
||||
});
|
||||
marker.extData = {
|
||||
getLng: e.lnglat.getLng(),
|
||||
getLat: e.lnglat.getLat(),
|
||||
}; //自定義想傳入的引數
|
||||
|
||||
marker.on("click", function (e) {
|
||||
var hs = e.target.extData;
|
||||
var content = openInfo(
|
||||
"",
|
||||
"(" + hs["getLat"] + ", " + hs["getLng"] + ")",
|
||||
hs["getLng"],
|
||||
hs["getLat"]
|
||||
);
|
||||
});
|
||||
markers.push(marker);
|
||||
if (typeof(infoWindow) != "undefined") {
|
||||
infoWindow.close();
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化地图的函数
|
||||
function initMap() {
|
||||
initMapFunction();
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -340,7 +340,7 @@ def hardware_thread(end_event, hw_queue) -> None:
|
||||
if TICI and HARDWARE.get_device_type() == "tici":
|
||||
if not os.path.isfile("/persist/comma/living-in-the-moment"):
|
||||
if not Path("/data/media").is_mount():
|
||||
pass #set_offroad_alert_if_changed("Offroad_StorageMissing", True)
|
||||
set_offroad_alert_if_changed("Offroad_StorageMissing", True)
|
||||
else:
|
||||
# check for bad NVMe
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user