Merge pull request #571 from NicolasConstant/topic_updated-docs

updated electron build
This commit is contained in:
Nicolas Constant 2023-04-23 15:45:28 -04:00 committed by GitHub
commit cb342ce9b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11781 additions and 13642 deletions

View File

@ -1,37 +0,0 @@
name: Build/release
on: push
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 16
- name: Npm Install
run: |
npm i
shell: bash
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.token }}
# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
skip_build: true

View File

@ -34,7 +34,7 @@
<div class="header__download-box--buttons">
<p>
<h4 class="header__download-box--subtitle">Try it in your browser!</h4>
<h4 class="header__download-box--subtitle">Use it in your browser!</h4>
<a href="#" class="download-button download-button__web"
title="what are you waiting for? click!"
onClick="window.open('https://sengi.nicolas-constant.com'+'?qt='+ (new Date()).getTime(),'Sengi','toolbar=no,location=no,status=no,menubar=no,scrollbars=no, resizable=yes,width=377,height=800'); return false;"
@ -43,7 +43,7 @@
<br />
<br />
<h4 class="header__download-box--subtitle">Or download the desktop client:</h4>
<h4 class="header__download-box--subtitle">Or download the desktop client <span id="electron-version"></span>:</h4>
<div id="download-buttons" style="display: none;">
<a id="windows" href class="download-button" title="download client for windows">
<i class="fab fa-windows"></i>
@ -75,7 +75,7 @@
</div>
<div>
<a class="header__old-releases" href="https://github.com/NicolasConstant/sengi/releases/"
<a class="header__old-releases" href="https://github.com/NicolasConstant/sengi-electron/releases/"
title="browse previous releases">browse previous releases</a>
</div>
</div>
@ -215,6 +215,12 @@
return myJson;
}
const getLastElectronRelease = async () => {
const response = await fetch('https://api.github.com/repos/NicolasConstant/sengi-electron/releases/latest');
const myJson = await response.json();
return myJson;
}
function getOS() {
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
@ -242,6 +248,9 @@
let lastRelease = await getLastRelease();
let version = lastRelease.tag_name;
let lastElectronRelease = await getLastElectronRelease();
let electronVersion = lastElectronRelease.tag_name;
var downloadButtons = document.getElementById('download-buttons');
downloadButtons.style.display = 'block';
@ -249,12 +258,15 @@
downloadButtonsNojs.style.display = 'none';
var sengiVersion = document.getElementById('sengi-version');
sengiVersion.textContent = `Current version: ${version}`;
sengiVersion.textContent = `Current version: v${version}`;
document.getElementById('windows').href = `https://github.com/NicolasConstant/sengi/releases/download/${version}/Sengi-${version}-win.exe`;
document.getElementById('mac').href = `https://github.com/NicolasConstant/sengi/releases/download/${version}/Sengi-${version}-mac.dmg`;
document.getElementById('deb').href = `https://github.com/NicolasConstant/sengi/releases/download/${version}/Sengi-${version}-linux.deb`;
document.getElementById('appimage').href = `https://github.com/NicolasConstant/sengi/releases/download/${version}/Sengi-${version}-linux.AppImage`;
var htmlElectronVersion = document.getElementById('electron-version');
htmlElectronVersion.textContent = `(${electronVersion})`;
document.getElementById('windows').href = `https://github.com/NicolasConstant/sengi-electron/releases/download/${electronVersion}/Sengi-${electronVersion.replace('v', '')}-win.exe`;
document.getElementById('mac').href = `https://github.com/NicolasConstant/sengi-electron/releases/download/${electronVersion}/Sengi-${electronVersion.replace('v', '')}-mac.dmg`;
document.getElementById('deb').href = `https://github.com/NicolasConstant/sengi-electron/releases/download/${electronVersion}/Sengi-${electronVersion.replace('v', '')}-linux.deb`;
document.getElementById('appimage').href = `https://github.com/NicolasConstant/sengi-electron/releases/download/${electronVersion}/Sengi-${electronVersion.replace('v', '')}-linux.AppImage`;
let userOs = getOS();

View File

@ -1,238 +0,0 @@
const { join } = require("path");
const { app, Menu, MenuItem, BrowserWindow, shell } = require("electron");
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win;
const globalAny = global;
if (process.env.NODE_ENV !== 'development') {
globalAny.__static = require('path').join(__dirname, '/assets/icons').replace(/\\/g, '\\\\');
}
function createWindow() {
// Set icon
let icon = join(globalAny.__static, '/png/512x512.png');
if (process.platform === "win32") {
icon = join(globalAny.__static, '/win/icon.ico');
}
// Create the browser window
win = new BrowserWindow({
width: 377,
height: 800,
title: "Sengi",
icon: icon,
backgroundColor: "#131925",
useContentSize: true,
webPreferences: {
spellcheck: false
}
// webPreferences: {
// contextIsolation: true,
// nodeIntegration: false,
// nodeIntegrationInWorker: false
// }
});
win.setAutoHideMenuBar(true);
win.setMenuBarVisibility(false);
const sengiUrl = "https://sengi.nicolas-constant.com";
win.loadURL(sengiUrl);
const template = [
{
label: "View",
submenu: [
{
label: "Return on Sengi",
click() {
win.loadURL(sengiUrl);
}
},
{ type: "separator" },
{ role: "reload" },
{ role: "forcereload" },
{ type: "separator" },
{ role: "resetzoom" },
{ role: "zoomin", accelerator: "CommandOrControl+numadd" },
{ role: "zoomout", accelerator: "CommandOrControl+numsub" },
{ type: "separator" },
{ role: "togglefullscreen" },
{ type: "separator" },
{ role: "close" },
{ role: "quit" }
]
},
{
role: "help",
submenu: [
{ role: "toggledevtools" },
{
label: "Open GitHub project",
click() {
require("electron").shell.openExternal(
"https://github.com/NicolasConstant/sengi"
);
}
}
]
}
];
const menu = Menu.buildFromTemplate(template);
win.setMenu(menu);
// Check if we are on a MAC
if (process.platform === "darwin") {
// Create our menu entries so that we can use MAC shortcuts
Menu.setApplicationMenu(
Menu.buildFromTemplate([
{
label: "Sengi",
submenu: [
{ role: "close" },
{ role: 'quit' }
]
},
// {
// label: "File",
// submenu: [
// ]
// },
{
label: "Edit",
submenu: [
{ role: "undo" },
{ role: "redo" },
{ type: "separator" },
{ role: "cut" },
{ role: "copy" },
{ role: "paste" },
{ role: "pasteandmatchstyle" },
{ role: "delete" },
{ role: "selectall" }
]
},
// {
// label: "Format",
// submenu: [
// ]
// },
{
label: "View",
submenu: [
{
label: "Return on Sengi",
click() {
win.loadURL(sengiUrl);
}
},
{ type: "separator" },
{ role: "reload" },
{ role: "forcereload" },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
},
// {
// label: "Window",
// submenu: [
// ]
// },
{
role: "Help",
submenu: [
{ role: "toggledevtools" },
{
label: "Open GitHub project",
click() {
require("electron").shell.openExternal(
"https://github.com/NicolasConstant/sengi"
);
}
}
]
}
])
);
}
//open external links to browser
win.webContents.on("new-window", function (event, url) {
event.preventDefault();
shell.openExternal(url);
});
// Emitted when the window is closed.
win.on("closed", () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
// win.webContents.on('context-menu', (event, params) => {
// const menu = new Menu();
// // Add each spelling suggestion
// for (const suggestion of params.dictionarySuggestions) {
// menu.append(new MenuItem({
// label: suggestion,
// click: () => mainWindow.webContents.replaceMisspelling(suggestion)
// }));
// }
// // Allow users to add the misspelled word to the dictionary
// if (params.misspelledWord) {
// menu.append(
// new MenuItem({
// label: 'Add to dictionary',
// click: () => mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)
// }));
// }
// menu.popup();
// });
}
app.commandLine.appendSwitch("force-color-profile", "srgb");
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
app.quit();
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (win) {
if (win.isMinimized()) win.restore()
win.focus()
}
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on("ready", createWindow);
}
// Quit when all windows are closed.
app.on("window-all-closed", () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("activate", () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});

25100
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,13 +20,8 @@
"test": "ng test",
"test-nowatch": "ng test --watch=false",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "electron .",
"electron-prod": "ng build --prod && electron .",
"electron-debug": "ng build && electron .",
"dist": "npm run build && electron-builder --publish onTagOrDraft",
"travis": "electron-builder --publish onTagOrDraft",
"release": "electron-builder --mac --windows --linux --publish always"
"e2e": "ng e2e",
"dist": "npm run build"
},
"private": true,
"dependencies": {
@ -48,9 +43,9 @@
"@fortawesome/free-brands-svg-icons": "^5.7.0",
"@fortawesome/free-regular-svg-icons": "^5.7.0",
"@fortawesome/free-solid-svg-icons": "^5.7.0",
"@ngxs/storage-plugin": "^3.2.0",
"@ngxs/store": "^3.2.0",
"angular2-hotkeys": "^2.1.5",
"@ngxs/storage-plugin": "~3.2.0",
"@ngxs/store": "~3.2.0",
"angular2-hotkeys": "~2.1.5",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"emojione": "~4.5.0",
@ -71,8 +66,6 @@
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"electron": "^23.1.3",
"electron-builder": "^23.6.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",

View File

@ -520,7 +520,8 @@ export class MastodonService {
getCustomEmojis(account: AccountInfo): Promise<Emoji[]> {
let route = `https://${account.instance}${this.apiRoutes.getCustomEmojis}`;
return this.httpClient.get<Emoji[]>(route).toPromise();
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
return this.httpClient.get<Emoji[]>(route, { headers: headers }).toPromise();
}
getScheduledStatuses(account: AccountInfo): Promise<ScheduledStatus[]> {