Add warning with WebUSB-incompatible browser

This commit is contained in:
lights0123 2020-10-28 22:13:32 -04:00
parent b400f43f6f
commit d08aac0db1
No known key found for this signature in database
GPG key ID: 28F315322E37972F
3 changed files with 55 additions and 40 deletions

View file

@ -111,34 +111,3 @@ jobs:
name: `${name}_${version}_${arch}.AppImage`, name: `${name}_${version}_${arch}.AppImage`,
data: await fs.readFile(`${process.env.GITHUB_WORKSPACE}/desktop/src-tauri/target/release/bundle/appimage/n-link.AppImage`) data: await fs.readFile(`${process.env.GITHUB_WORKSPACE}/desktop/src-tauri/target/release/bundle/appimage/n-link.AppImage`)
}); });
deploy-web:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ matrix.platform }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
ubuntu-18.04-yarn-
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 12
- name: install app dependencies
run: yarn
- name: Build
run: |
yarn workspace web run generate
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./web/dist
publish_branch: gh-pages
cname: n-link.lights0123.com

View file

@ -1,3 +1,5 @@
# N-Link # N-Link
Free, cross-platform, CX-II compatible computer linking program for the TI-Nspire Free, cross-platform, CX-II compatible computer linking program for the TI-Nspire
For usage instructions, see https://lights0123.com/n-link/

View file

@ -1,26 +1,33 @@
<template> <template>
<div class="home h-full overflow-hidden"> <div class="home h-full overflow-hidden">
<div class="flex flex-row h-full"> <div class="flex flex-row h-full">
<div class="flex-shrink-0 border-r w-64"> <div class="flex flex-col flex-shrink-0 border-r w-64">
<device-select :selected.sync="selectedCalculator" /> <device-select
<div class="overflow-auto h-full px-4 py-4"> :selected.sync="selectedCalculator"
:class="webUSB || 'opacity-50 pointer-events-none'"
/>
<div class="overflow-auto flex flex-col h-full px-4 py-4">
<div v-if="needsDrivers"> <div v-if="needsDrivers">
<h1 class="text-3xl">Drivers required</h1> <h1 class="text-3xl">Drivers required</h1>
<p>The WinUSB driver is required to use this device.</p> <p>The WinUSB driver is required to use this device.</p>
<p class="text-center mt-2"> <p class="text-center mt-2">
<a href="#" class="text-blue-600" @click.prevent="installDrivers" <a href="#" class="text-blue-600" @click.prevent="installDrivers">
>See installation instructions</a See installation instructions
> </a>
</p> </p>
</div> </div>
<div <div
v-else-if="calculator && !calculator.info" v-else-if="calculator && !calculator.info"
class="flex items-center justify-center h-full" class="flex items-center justify-center flex-grow"
> >
<div class="lds-dual-ring" /> <div class="lds-dual-ring" />
</div> </div>
<div v-else-if="calculator && calculator.info"> <div v-else-if="calculator && calculator.info">
<calc-info :info="calculator.info" :dev="selectedCalculator" native-upload /> <calc-info
:info="calculator.info"
:dev="selectedCalculator"
native-upload
/>
<label class="inline-flex items-center cursor-pointer mr-2 mt-4"> <label class="inline-flex items-center cursor-pointer mr-2 mt-4">
<input <input
v-model="showHidden" v-model="showHidden"
@ -32,10 +39,31 @@
> >
</label> </label>
</div> </div>
<div v-if="!(calculator && !calculator.info)" class="flex-grow" />
<div class="mt-4 select-text">
<p>
<a
href="https://lights0123.com/n-link/"
target="_blank"
class="text-blue-600 underline"
>
N-Link</a
>
©
<a
href="https://lights0123.com/"
target="_blank"
class="text-blue-600 underline"
>
Ben Schattinger</a
>
</p>
<p>Licensed under the GPL v3.0</p>
</div>
</div> </div>
</div> </div>
<div class="w-full"> <div class="w-full">
<div class="h-full"> <div v-if="webUSB" class="h-full">
<file-browser <file-browser
v-if="calculator && calculator.info" v-if="calculator && calculator.info"
:dev="selectedCalculator" :dev="selectedCalculator"
@ -43,6 +71,18 @@
native-upload native-upload
/> />
</div> </div>
<div
v-else
class="flex flex-col items-center justify-center h-full select-text"
>
<p class="text-3xl">Your browser doesn't support WebUSB</p>
<a
href="https://lights0123.com/n-link/"
class="text-xl text-blue-600 underline"
>
Check out the desktop version instead
</a>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -121,6 +161,10 @@ export default class Home extends Vue {
); );
} }
get webUSB() {
return process.client ? !!(navigator as any).usb : true;
}
installDrivers() { installDrivers() {
open('https://lights0123.com/n-link/#windows'); open('https://lights0123.com/n-link/#windows');
} }