Skip to content

Commit 83847df

Browse files
committed
Merge branch 'Release-3.4' into 'master'
Release 3.4 Closes nextcloud#70, nextcloud#71, and nextcloud#79 See merge request joendres/filelink-nextcloud!47
2 parents 2988b06 + 0dae5f7 commit 83847df

23 files changed

+995
-293
lines changed

.gitlab-ci.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
image: node:lts
22

33
cache:
4-
key: ${CI_COMMIT_REF_SLUG}
4+
key: node_modules
55
paths:
66
- node_modules/
77

8-
before_script:
9-
- npm install node-fetch
10-
- npm install web-ext
11-
- npm install jshint
12-
138
lint:
149
stage: test
10+
before_script:
11+
- npm install --loglevel error web-ext
12+
- npm install --loglevel error jshint
1513
script:
1614
# web-ext fails if parameters of different run modes are set
1715
- unset WEB_EXT_API_KEY
@@ -21,6 +19,9 @@ lint:
2119

2220
pages:
2321
stage: deploy
22+
before_script:
23+
- npm install --loglevel error node-fetch
24+
- npm install --loglevel error web-ext
2425
script:
2526
- node build-tools/build-pages.js
2627
# web-ext fails if parameters of different run modes are set
@@ -37,9 +38,11 @@ pages:
3738

3839
sign:
3940
stage: deploy
41+
before_script:
42+
- npm install --loglevel error web-ext
4043
script:
4144
# web-ext sign always fails (as documented), so manipulate the return code
42-
- npx web-ext sign --channel=listed --api-url-prefix=https://addons.thunderbird.net/api/v3 ; true
45+
- 'npx web-ext sign --channel=listed --api-url-prefix=https://addons.thunderbird.net/api/v3 || true'
4346
environment:
4447
name: production
4548
url: https://addons.thunderbird.net/de/thunderbird/addon/filelink-nextcloud-owncloud/

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
3.4.0 2020-02-18
2+
- Close #27: Show Nextcloud/ownCloud flavor and version
3+
- Close #70: Show product name instead of account name
4+
- Close #79: Warn about unsupported version
5+
- Small changes to styling
6+
17
3.3.0 2020-01-04
28
- Catalan translation by @josepmanel
39
- Spanish translation by @josepmanel (Close #3)

src/_locales/ca/messages.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
"resetButton": {
1212
"message": "Reinciar"
1313
},
14-
"detailSummary": {
15-
"message": "Ajuda"
16-
},
1714
"serverUrl": {
1815
"message": "URL del servidor"
1916
},
@@ -63,5 +60,11 @@
6360
"content": "$2"
6461
}
6562
}
63+
},
64+
"success": {
65+
"message": "Correcte"
66+
},
67+
"error_0": {
68+
"message": "Error desconegut"
6669
}
6770
}

src/_locales/de/messages.json

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,25 @@
5959
"full": {
6060
"content": "$2"
6161
}
62-
},
63-
"success": {
64-
"message": "Alles OK"
65-
},
66-
"error_0": {
67-
"message": "Unbekanner Fehler"
6862
}
63+
},
64+
"success": {
65+
"message": "Alles OK"
66+
},
67+
"error_0": {
68+
"message": "Unbekanner Fehler"
69+
},
70+
"error_cloud_unreachable": {
71+
"message": "Keine Verbindung zur Cloud. Prüfe Server-URL und Netzwerkverbindung"
72+
},
73+
"error_no_cloud": {
74+
"message": "Keine kompatible Cloud unter dieser URL"
75+
},
76+
"unsupported_cloud": {
77+
"message": "Datenverlust droht: Veraltete Version von Nextcloud oder ownCloud. Bitte den Cloud-Admin um ein Update"
78+
},
79+
"obsolete_version": {
80+
"description": "This is displayed instead of the icon if the cloud version is not supported, so it should be quite short and contain exactly two lines.",
81+
"message": "Veraltete<br>Cloud"
6982
}
7083
}

src/_locales/en/messages.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,18 @@
6666
},
6767
"error_0": {
6868
"message": "Unknown error"
69+
},
70+
"error_cloud_unreachable": {
71+
"message": "No connection. Check Server URL and network conection."
72+
},
73+
"error_no_cloud": {
74+
"message": "No compatible cloud at this URL."
75+
},
76+
"unsupported_cloud": {
77+
"message": "Obsolete version of Nextcloud or ownCloud. You might loose data. Ask your cloud admin to update."
78+
},
79+
"obsolete_version": {
80+
"description": "This is displayed instead of the icon if the cloud version is not supported, so it should be quite short and contain exactly two lines.",
81+
"message": "Obsolete<br>version"
6982
}
7083
}

src/_locales/es/messages.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
"resetButton": {
1212
"message": "Reinicia"
1313
},
14-
"detailSummary": {
15-
"message": "Ayuda"
16-
},
1714
"serverUrl": {
1815
"message": "URL del servidor"
1916
},
@@ -63,5 +60,11 @@
6360
"content": "$2"
6461
}
6562
}
63+
},
64+
"success": {
65+
"message": "Correcto"
66+
},
67+
"error_0": {
68+
"message": "Error desconocido"
6669
}
6770
}

src/background.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
const ncc = new CloudConnection(accountId);
3030
ncc.load()
3131
.then(() => ncc.updateConfigured())
32-
.then(() => ncc.updateFreeSpaceInfo());
32+
.then(() => ncc.updateFreeSpaceInfo())
33+
.then(() => ncc.updateCloudVersion())
34+
.then(() => ncc.store());
3335
}
3436
});
3537
})();

src/lib/cloudconnection.js

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,51 @@ class CloudConnection {
125125
* Thunderbirds cloudFileAccount
126126
*/
127127
async updateFreeSpaceInfo() {
128-
this._doApiCall(apiUrlUserInfo + this.username)
129-
.then(data => {
130-
if (data && data.quota) {
131-
browser.cloudFile.updateAccount(this._accountId,
132-
{
133-
spaceRemaining: data.quota.free >= 0 ? data.quota.free : -1,
134-
spaceUsed: data.quota.used > 0 ? data.quota.used : -1,
135-
});
136-
}
137-
});
128+
let data = await this._doApiCall(apiUrlUserInfo + this.username);
129+
if (data && data.quota) {
130+
await browser.cloudFile.updateAccount(this._accountId,
131+
{
132+
spaceRemaining: data.quota.free >= 0 ? data.quota.free : -1,
133+
spaceUsed: data.quota.used > 0 ? data.quota.used : -1,
134+
});
135+
}
136+
}
137+
138+
/**
139+
*
140+
* @param {string} url Base URL of the cloud
141+
* @returns {*} versionstring and type
142+
*/
143+
static async fetchCloudVersion(url) {
144+
let response = await fetch(url + "/status.php");
145+
let status = await response.json();
146+
let major = parseInt(status.versionstring.split(/\./)[0]);
147+
let retval = {
148+
type: null,
149+
versionstring: status.versionstring,
150+
productname: status.productname,
151+
};
152+
if (major >= 16) {
153+
retval.type = "Nextcloud";
154+
} else if (major === 10 && status.needsDbUpgrade !== undefined) {
155+
retval.type = "ownCloud";
156+
} else {
157+
retval.type = "Unsupported";
158+
}
159+
return retval;
160+
}
161+
162+
/**
163+
* Set cloudtype and versionstring of this object
164+
*/
165+
async updateCloudVersion() {
166+
try {
167+
let res = await CloudConnection.fetchCloudVersion(this.serverUrl);
168+
this.versionstring = res.versionstring;
169+
this.cloudtype = res.type;
170+
this.productname = res.productname;
171+
} catch (error) {
172+
}
138173
}
139174

140175
/**

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"description": "__MSG_extensionDescription__",
1111
"homepage_url": "https://gitlab.com/joendres/filelink-nextcloud",
1212
"author": "Johannes Endres",
13-
"version": "3.3.0",
13+
"version": "3.4.0",
1414
"icons": {
1515
"48": "icon48.png"
1616
},

src/prefspane/Checkbox.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)