Skip to content

Commit 9f1d6b0

Browse files
Merge branch 'develop' into 99-bug-what-to-do-with-ignored-todocss
2 parents 57ca4d9 + bb3b7a4 commit 9f1d6b0

File tree

18 files changed

+369
-28
lines changed

18 files changed

+369
-28
lines changed

.all-contributorsrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"projectName": "Edirom-Online-Frontend",
3+
"projectOwner": "Edirom"
4+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
release:
5+
types: [published] # Triggers only when a release is published (not created or edited)
6+
7+
jobs:
8+
build-and-push:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v6
13+
14+
- name: Login to Docker Hub
15+
uses: docker/login-action@v3
16+
with:
17+
username: vifebot
18+
password: ${{ secrets.VIFEBOT_DOCKERHUB_TOKEN }}
19+
20+
- name: Build and push Docker image
21+
run: |
22+
IMAGE_NAME="edirom/edirom-online-frontend"
23+
TAG=${GITHUB_REF#refs/tags/}
24+
25+
docker build -t $IMAGE_NAME:$TAG .
26+
docker push $IMAGE_NAME:$TAG

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "resources/js/edirom-core-web-components"]
55
path = resources/js/edirom-core-web-components
66
url = https://github.com/Edirom/edirom-core-web-components.git
7+
[submodule "resources/js/edirom-audio-player"]
8+
path = resources/js/edirom-audio-player
9+
url = https://github.com/Edirom/edirom-audio-player.git

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ identifiers:
3737
value: 10.5281/zenodo.17977921
3838
description: Edirom Online Frontend
3939
repository-code: https://github.com/Edirom/Edirom-Online-Frontend
40-
commit: 217acc399c1755badb3a28b39bb858642e58844e
40+
commit: d16d8e671aa5755814c4c3c67b963cc8156119f7
4141
abstract: >-
4242
Edirom Online Frontend is the frontend for the Edirom
4343
Online which is used for the presentation and
4444
analysis of critical musical editions in a digital format,
4545
particularly in the fields of musicology and philology.
4646
license: GPL-3.0
4747
version: v1.2.0
48-
date-released: 2026-02-04
48+
date-released: 2026-03-02

Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#######################################
2+
# Multi-stage Dockerfile
3+
# 1. Set up the build environment
4+
# 2. Build Edirom-Online packages
5+
# 3. Run the nginx and deploy frontend
6+
#######################################
7+
8+
9+
#########################
10+
# 1. Build Environment
11+
#########################
12+
13+
FROM eclipse-temurin:8-jdk-focal as builder
14+
15+
ARG ANT_VERSION=1.10.12
16+
ARG BE_PORT=8080
17+
18+
19+
# Install wget and unzip and ruby and other dependencies
20+
RUN apt-get update && apt-get install -y --no-install-recommends \
21+
curl \
22+
sudo \
23+
wget \
24+
git \
25+
unzip \
26+
libfreetype6 \
27+
fontconfig \
28+
ruby-full \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
# Download and extract Apache Ant to opt folder
32+
RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \
33+
wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \
34+
echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \
35+
tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \
36+
ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \
37+
unlink apache-ant-${ANT_VERSION}-bin.tar.gz && \
38+
unlink apache-ant-${ANT_VERSION}-bin.tar.gz.sha512
39+
40+
# Download and install SenchaCmd Community Edition
41+
RUN curl --silent http://cdn.sencha.com/cmd/7.0.0.40/no-jre/SenchaCmd-7.0.0.40-linux-amd64.sh.zip -o /tmp/senchaCmd.zip && \
42+
unzip /tmp/senchaCmd.zip -d /tmp && \
43+
unlink /tmp/senchaCmd.zip && \
44+
chmod o+x /tmp/SenchaCmd-7.0.0.40-linux-amd64.sh && \
45+
/tmp/SenchaCmd-7.0.0.40-linux-amd64.sh -Dall=true -q -dir /opt/Sencha/Cmd/7.0.0.40 && \
46+
unlink /tmp/SenchaCmd-7.0.0.40-linux-amd64.sh
47+
48+
# Put ant and sencha in the path
49+
ENV PATH="/opt/ant/bin:/opt/Sencha/Cmd:${PATH}"
50+
51+
52+
############################
53+
# 2. Edirom-Online Frontend
54+
############################
55+
56+
# Get build for Edirom-Online Frontend
57+
WORKDIR /opt/eo-frontend
58+
59+
COPY . .
60+
61+
RUN echo "Writing backend.port=$BE_PORT to local.properties…"; \
62+
if [ -f "./local.properties" ]; then \
63+
sed -i '/^backend\.port=/d' local.properties; \
64+
echo "backend.port=$BE_PORT" >> local.properties; \
65+
else \
66+
echo "backend.port=$BE_PORT" >> local.properties; \
67+
fi && \
68+
echo "Building Frontend XAR..." && \
69+
./build.sh
70+
71+
#########################
72+
# 3. Run/deploy nginx
73+
#########################
74+
75+
# Use nginx as the base image
76+
FROM nginx:alpine
77+
78+
# copy build files to directory
79+
COPY --from=builder /opt/eo-frontend/build/ /usr/share/nginx/html/

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@ Please note that this project is released with a [Contributor Code of Conduct].
121121
Please cite the software/repository using the information provided under "Cite this repository" on the right hand side. The APA and BIBTeX citations are fed by information from the CITATION.cff file in this repository which you can also use as a source.
122122
If you intend to cite unreleased branches or commits please use the commit hash in the citation.
123123

124+
## Contributors
125+
126+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
127+
<!-- prettier-ignore-start -->
128+
<!-- markdownlint-disable -->
129+
130+
<!-- markdownlint-restore -->
131+
<!-- prettier-ignore-end -->
132+
133+
<!-- ALL-CONTRIBUTORS-LIST:END -->
134+
124135
## License
125136

126137
Edirom-Online Frontend is released to the public under the terms of the [MIT] open source license.

app/Application.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Ext.define('EdiromOnline.Application', {
2323

2424
controllers: [
2525
'AJAXController',
26+
'ConfigController',
2627
'CookieController',
2728
'LanguageController',
2829
'PreferenceController',
@@ -79,7 +80,16 @@ Ext.define('EdiromOnline.Application', {
7980

8081
launch: function() {
8182
var me = this;
82-
83+
84+
me.getController('ConfigController').loadConfig(function (config) {
85+
me.backendURL = config.backendURL || me.backendURL;
86+
me.initializeApplication();
87+
}, me);
88+
},
89+
90+
initializeApplication: function () {
91+
var me = this;
92+
8393
window.getActiveEdition = Ext.bind(this.getActiveEdition, this);
8494

8595
me.addEvents('workSelected');
@@ -108,12 +118,12 @@ Ext.define('EdiromOnline.Application', {
108118
// If there is only one edition in the backend load it directly
109119
}else if(!Array.isArray(editions)) {
110120
this.activeEdition = editions.id;
111-
this.loadEdiromForEdition();
121+
me.loadEdiromForEdition();
112122

113123
// If there is only one edition in the backend load it directly
114124
}else if(editions.length == 1) {
115125
this.activeEdition = editions[0].id;
116-
this.loadEdiromForEdition();
126+
me.loadEdiromForEdition();
117127

118128
// If there are multiple editions in the backend show a selection screen
119129
}else {
@@ -188,7 +198,7 @@ Ext.define('EdiromOnline.Application', {
188198
2, // retries
189199
false // async
190200
);
191-
201+
192202
me.getController('PreferenceController').initPreferences(me.activeEdition);
193203
me.getController('LanguageController').initLangFile(me.activeEdition, 'de');
194204
me.getController('LanguageController').initLangFile(me.activeEdition, 'en');
@@ -222,7 +232,6 @@ Ext.define('EdiromOnline.Application', {
222232
editionCssLink.href = this.backendURL.split('apps/')[0] + me.getController('PreferenceController').getPreference('additional_css_path', true).split("xmldb:exist:///db/")[1];
223233
document.getElementsByTagName("head")[0].appendChild(editionCssLink);
224234
}
225-
226235
},
227236

228237
initDataStores: function() {

app/controller/ConfigController.js

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
Ext.define('EdiromOnline.controller.ConfigController', {
2+
extend: 'Ext.app.Controller',
3+
4+
config: null,
5+
6+
init: function () {
7+
},
8+
9+
/**
10+
* Load config from config.json
11+
* @param {Function} callback Callback function after successful loading
12+
* @param {Object} scope Scope for the callback
13+
*/
14+
async loadConfig(callback, scope) {
15+
try {
16+
const response = await fetch('config.json', {
17+
method: 'GET',
18+
headers: {
19+
'Content-Type': 'application/json'
20+
}
21+
});
22+
23+
if (!response.ok) {
24+
throw new Error(`Status: ${response.status}`);
25+
}
26+
27+
this.config = await response.json();
28+
console.info('config.json for backendURL loaded.');
29+
30+
if (callback) {
31+
callback.call(scope || this, this.config);
32+
}
33+
} catch (e) {
34+
console.log('No custom config.json found or syntax error – Using default configuration.');
35+
this.loadDefaultConfig(callback, scope);
36+
}
37+
},
38+
39+
/**
40+
* Handles errors when loading the configuration
41+
* @param {Function} callback Callback function
42+
* @param {Object} scope Scope for the callback
43+
*/
44+
loadDefaultConfig: function (callback, scope) {
45+
var me = this;
46+
47+
// Fallback-Konfiguration
48+
me.config = {
49+
backendURL: '@backend.url@'
50+
};
51+
52+
if (callback) {
53+
Ext.callback(callback, scope || me, [me.config]);
54+
}
55+
},
56+
57+
/**
58+
* Returns a configuration value
59+
* @param {String} key The configuration key
60+
* @param {*} defaultValue Default value if key doesn't exist
61+
* @return {*} The configuration value
62+
*/
63+
getConfig: function (key, defaultValue) {
64+
if (!this.config) {
65+
console.warn('Configuration not loaded yet');
66+
return defaultValue;
67+
}
68+
69+
return this.config[key] !== undefined ? this.config[key] : defaultValue;
70+
},
71+
72+
/**
73+
* Returns the complete configuration
74+
* @return {Object} The configuration object
75+
*/
76+
getFullConfig: function () {
77+
return this.config || {};
78+
},
79+
80+
/**
81+
* Sets a configuration value
82+
* @param {String|Object} key The configuration key or an object with key-value pairs
83+
* @param {*} value The value to set (ignored if key is an object)
84+
* @return {Boolean} True if the operation was successful
85+
*/
86+
setConfig: function (key, value) {
87+
var me = this;
88+
89+
// Initialize config if not already loaded
90+
if (!me.config) {
91+
me.config = {};
92+
}
93+
94+
try {
95+
if (Ext.isObject(key)) {
96+
// If key is an object, merge it with existing config
97+
me.config = Ext.apply(me.config, key);
98+
console.log('Configuration updated with object:', key);
99+
} else if (Ext.isString(key)) {
100+
// Set single key-value pair
101+
me.config[key] = value;
102+
console.log('Configuration updated:', key, '=', value);
103+
} else {
104+
console.warn('Invalid key type for setConfig. Expected string or object.');
105+
return false;
106+
}
107+
108+
return true;
109+
} catch (e) {
110+
console.error('Error setting configuration:', e);
111+
return false;
112+
}
113+
},
114+
115+
/**
116+
* Checks if a configuration key exists
117+
* @param {String} key The configuration key to check
118+
* @return {Boolean} True if the key exists
119+
*/
120+
hasConfig: function (key) {
121+
return this.config && this.config.hasOwnProperty(key);
122+
}
123+
});

app/controller/window/about/AboutWindow.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Ext.define('EdiromOnline.controller.window.about.AboutWindow', {
2727
init: function() {
2828
this.control({
2929
'aboutWindow': {
30-
afterlayout : this.onAfterLayout
30+
afterlayout : this.onAfterLayout
3131
}
3232
});
3333
},
@@ -36,11 +36,13 @@ Ext.define('EdiromOnline.controller.window.about.AboutWindow', {
3636

3737
var me = this;
3838

39-
if(view.initialized) return;
39+
var configController = EdiromOnline.getApplication().getController('ConfigController');
40+
var backendURL = configController && configController.hasConfig('backendURL') ? configController.getConfig('backendURL') : '@backend.url@';
41+
42+
if (view.initialized) return;
4043
view.initialized = true;
4144

4245
// Specify URLs of CITATION.cff files of frontend and backend
43-
const backendURL = '@backend.url@';
4446
const frontendURL = location.origin + location.pathname.replaceAll("/index.html", "/");
4547
const frontendURLcitation = frontendURL + 'resources/CITATION.cff';
4648
const backendURLcitation = backendURL + 'resources/CITATION.cff';

app/controller/window/audio/AudioView.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,29 @@ Ext.define('EdiromOnline.controller.window.audio.AudioView', {
4040
view.initialized = true;
4141

4242
var uri = view.uri;
43-
var type = view.type;
4443

45-
view.setIFrameURL(this.application.backendURL + 'data/xql/getAudioPlayer.xql?uri=' + uri);
44+
// get tracks from backend
45+
var tracks = '[{ "title": "Loading...", "src": "" }]';
46+
47+
// ajax request to get audio information
48+
window.doAJAXRequest('data/xql/getAudio.xql',
49+
'GET',
50+
{
51+
uri: uri
52+
},
53+
Ext.bind(function(response){
54+
// get tracks from response
55+
var resp = Ext.decode(response.responseText);
56+
tracks = resp.audios;
57+
58+
// tracks into string format for audio player
59+
tracks = JSON.stringify(tracks);
60+
61+
// attach audio player custom element to DOM
62+
view.attachPlayer(tracks);
63+
64+
}, me)
65+
);
66+
4667
}
4768
});

0 commit comments

Comments
 (0)