Compare commits

..

No commits in common. "master" and "preview" have entirely different histories.

13 changed files with 23 additions and 155 deletions

View File

@ -1,2 +1 @@
ARCAST_DESKTOP_ADDITIONAL_CHROME_ARGS=
ARCAST_DESKTOP_INSTANCE_ID=

2
.gitignore vendored
View File

@ -2,5 +2,3 @@
/dist
/.env
/tools
.mktools/
/.gitea-release

View File

@ -5,9 +5,6 @@ GITCHLOG_ARGS ?=
SHELL := /bin/bash
JDK_PATH ?= /usr/lib/jvm/java-11-openjdk
MKT_GITEA_RELEASE_PROJECT := arcast
MKT_GITEA_RELEASE_ORG := arcad
GOTEST_ARGS ?= -short
watch: tools/modd/bin/modd deps ## Watching updated files - live reload
@ -19,7 +16,7 @@ test: test-go ## Executing tests
test-go: deps
( set -o allexport && source .env && set +o allexport && go test -v -count=1 $(GOTEST_ARGS) ./... )
build: build-desktop build-android build-client ## Build artefacts
build: build-desktop build-mobile build-client ## Build artefacts
build-desktop: deps ## Build executable
CGO_ENABLED=0 go build \
@ -33,12 +30,12 @@ build-client: deps ## Build executable
-o ./bin/client \
./cmd/client
build-android: tools/gogio/bin/gogio deps ## Build executable
build-mobile: tools/gogio/bin/gogio deps ## Build executable
mkdir -p dist
GOOS=android CGO_CFLAGS="-I${JDK_PATH}/include -I${JDK_PATH}/include/linux -w" tools/gogio/bin/gogio -target android -buildmode archive -o android/app/libs/mobile.aar -x ./cmd/mobile
( cd android && ./gradlew assembleDebug )
install-android: build-android
install-android: build-mobile
adb install android/app/build/outputs/apk/debug/app-debug.apk
adb shell monkey -p com.cadoles.arcast_player -c android.intent.category.LAUNCHER 1
@ -61,34 +58,3 @@ tools/modd/bin/modd:
tools/gogio/bin/gogio:
mkdir -p tools/gogio/bin
GOBIN=$(PWD)/tools/gogio/bin go install gioui.org/cmd/gogio@latest
gitea-release: .mktools build
rm -rf .gitea-release
mkdir -p .gitea-release
cp ./bin/desktop .gitea-release/arcad_player_linux_amd64
cp ./bin/client .gitea-release/arcad_client_linux_amd64
cp ./android/app/build/outputs/apk/debug/app-debug.apk .gitea-release/arcast_player_debug.apk
MKT_GITEA_RELEASE_PROJECT="arcast" \
MKT_GITEA_RELEASE_ORG="arcad" \
MKT_GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \
MKT_GITEA_RELEASE_VERSION="$(MKT_PROJECT_VERSION)" \
MKT_GITEA_RELEASE_NAME="$(MKT_PROJECT_VERSION)" \
MKT_GITEA_RELEASE_COMMITISH_TARGET="$$(git rev-parse HEAD)" \
MKT_GITEA_RELEASE_IS_DRAFT="false" \
MKT_GITEA_RELEASE_IS_PRERELEASE="false" \
MKT_GITEA_RELEASE_BODY="" \
MKT_GITEA_RELEASE_ATTACHMENTS="$$(find .gitea-release/* -type f)" \
$(MAKE) mkt-gitea-release
.PHONY: mktools
mktools:
rm -rf .mktools
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL)
.mktools:
$(MAKE) mktools
-include .mktools/*.mk

View File

@ -1,35 +0,0 @@
# Arcast
Serveur de diffusion de contenu (Web) pour afficheurs numériques (Linux et Android).
## Téléchargement
### Client en ligne de commande
Le client en ligne de commande vous permet de contrôler votre flotte de serveurs Arcast à partir de votre shell.
[Démonstration d'utilisation du client](https://asciinema.org/a/627836)
#### Dernière version
- Linux: [`amd64`](https://forge.cadoles.com/arcad/arcast/releases/download/latest/arcad_client_linux_amd64)
### Application Android
L'application `arcast_player` pour Android permet de transformer votre appareil Android en afficheur numérique.
#### Dernière version
- [`debug`](https://forge.cadoles.com/arcad/arcast/releases/download/latest/arcast_player_debug.apk)
### Application de bureau
L'application `arcast_player` pour Linux permet de transformer votre poste GNU/Linux en afficheur numérique.
#### Pré-requis
Avoir [Chromium](https://www.chromium.org/chromium-projects/) (ou `Google Chrome`) installé sur son poste GNU/Linux.
#### Dernière version
- Linux: [`amd64`](https://forge.cadoles.com/arcad/arcast/releases/download/latest/arcad_player_linux_amd64)

View File

@ -1 +0,0 @@
/mobile.aar

BIN
android/app/libs/mobile.aar Normal file

Binary file not shown.

View File

@ -6,11 +6,8 @@
<uses-feature android:glEsVersion="0x00030000"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"

View File

@ -13,13 +13,11 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.cadoles.arcast_player.ui.theme.ArcastplayerTheme
import org.gioui.GioActivity
import android.view.WindowManager
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
startActivity(Intent(this, GioActivity::class.java))
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}

View File

@ -9,6 +9,6 @@ func main() {
command.Main(
"arcast",
"Arcast desktop player",
player.Root().Subcommands...,
player.Root(),
)
}

View File

@ -6,7 +6,6 @@ package main
import (
"context"
"os"
"sync"
"forge.cadoles.com/arcad/arcast/pkg/browser/gioui"
"forge.cadoles.com/arcad/arcast/pkg/server"
@ -15,14 +14,17 @@ import (
"gioui.org/layout"
"gioui.org/op"
"github.com/gioui-plugins/gio-plugins/plugin"
"github.com/gioui-plugins/gio-plugins/safedata"
"github.com/gioui-plugins/gio-plugins/safedata/giosafedata"
"github.com/gioui-plugins/gio-plugins/webviewer/webview"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/logger"
)
const instanceIDSecretIdentifier = "instance_id"
// Android permissions
_ "net"
_ "gioui.org/app/permission/networkstate"
_ "gioui.org/app/permission/storage"
_ "gioui.org/app/permission/wakelock"
)
func main() {
ctx := context.Background()
@ -34,12 +36,6 @@ func main() {
browser := gioui.NewBrowser(window)
var safeDataConfig safedata.Config
var safeDataConfigWaigGroup sync.WaitGroup
var initSafeDataConfig sync.Once
safeDataConfigWaigGroup.Add(1)
go func() {
ops := new(op.Ops)
for {
@ -54,30 +50,16 @@ func main() {
gtx := layout.NewContext(ops, evt)
browser.Layout(gtx)
evt.Frame(gtx.Ops)
case app.ViewEvent:
initSafeDataConfig.Do(func() {
defer safeDataConfigWaigGroup.Done()
safeDataConfig = giosafedata.NewConfigFromViewEvent(window, evt, "com.cadoles.arcast_player")
})
}
}
}()
go func() {
for {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
safeDataConfigWaigGroup.Wait()
safe := safedata.NewSafeData(safeDataConfig)
instanceID, err := getInstanceIDFromSafeData(safe)
if err != nil {
logger.Fatal(ctx, "could not retrieve instance id", logger.CapturedE(errors.WithStack(err)))
}
server := server.New(browser, server.WithInstanceID(instanceID))
server := server.New(browser)
if err := server.Start(); err != nil {
logger.Fatal(ctx, "could not start server", logger.CapturedE(errors.WithStack(err)))
@ -97,27 +79,3 @@ func main() {
app.Main()
}
func getInstanceIDFromSafeData(safe *safedata.SafeData) (string, error) {
instanceIDSecret, err := safe.Get(instanceIDSecretIdentifier)
if err != nil && err.Error() != "not found" {
return "", errors.Wrapf(err, "could not retrieve instance id secret")
}
var instanceID string
if len(instanceIDSecret.Data) > 0 {
instanceID = string(instanceIDSecret.Data)
} else {
instanceID = server.NewRandomInstanceID()
instanceIDSecret.Identifier = instanceIDSecretIdentifier
instanceIDSecret.Data = []byte(instanceID)
instanceIDSecret.Description = "Arcast player instance identifier"
if err := safe.Set(instanceIDSecret); err != nil {
return "", errors.Wrapf(err, "could not save instance id secret")
}
}
return instanceID, nil
}

View File

@ -21,19 +21,12 @@ func Run() *cli.Command {
EnvVars: []string{"ARCAST_DESKTOP_ADDITIONAL_CHROME_ARGS"},
Value: cli.NewStringSlice("incognito"),
},
&cli.StringFlag{
Name: "instance-id",
EnvVars: []string{"ARCAST_DESKTOP_INSTANCE_ID"},
Value: "",
},
&cli.IntFlag{
Name: "window-height",
EnvVars: []string{"ARCAST_DESKTOP_WINDOW_HEIGHT"},
Value: defaults.Height,
},
&cli.IntFlag{
Name: "window-width",
EnvVars: []string{"ARCAST_DESKTOP_WINDOW_WIDTH"},
Value: defaults.Width,
},
},
@ -64,12 +57,7 @@ func Run() *cli.Command {
}
}()
instanceID := ctx.String("instance-id")
if instanceID == "" {
instanceID = server.NewRandomInstanceID()
}
server := server.New(browser, server.WithInstanceID(instanceID))
server := server.New(browser)
if err := server.Start(); err != nil {
return errors.Wrap(err, "could not start server")

View File

@ -4,5 +4,5 @@ modd.conf
.env {
prep: make build-client
prep: make build-desktop
daemon: make run RUN_CMD="bin/desktop --debug --log-level debug run"
daemon: make run RUN_CMD="bin/desktop --debug --log-level debug player run"
}