Skip to content

Commit 05c7b52

Browse files
authored
Merge branch 'master' into dependabot/maven/com.fasterxml.jackson.core-jackson-core-2.20.0
2 parents c38e0e8 + b0940a2 commit 05c7b52

7 files changed

Lines changed: 51 additions & 153 deletions

File tree

module/scripts/index/commons-importing-controller.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
1-
//Internationalization init
2-
var lang = navigator.language.split("-")[0]
3-
|| navigator.userLanguage.split("-")[0];
4-
var dictionary = "";
5-
$.ajax({
6-
url : "command/core/load-language?",
7-
type : "POST",
8-
async : false,
9-
data : {
10-
module : "commons",
11-
// lang : lang
12-
},
13-
success : function(data) {
14-
dictionary = data['dictionary'];
15-
lang = data['lang'];
16-
}
17-
});
18-
$.i18n().load(dictionary, lang);
19-
// End internationalization
1+
I18NUtil.init("commons");
202

213
Refine.CommonsImportingController = function(createProjectUI) {
224
this._createProjectUI = createProjectUI;

module/styles/commons-importing-controller.less

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2727
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
*/
29-
@import-less url("theme.less");
3029

3130
.commons-panel {
3231
margin-bottom: 2em;
@@ -89,8 +88,8 @@ table.parsing-options-table {
8988

9089
.commons-importing-wizard-header {
9190
font-size: 1.3em;
92-
background: @chrome_primary;
93-
padding: @padding_tight;
91+
background: var(--chrome-primary);
92+
padding: var(--padding-tight);
9493
}
9594

9695
.commons-importing-parsing-data-panel {
@@ -112,7 +111,7 @@ table.parsing-options-table {
112111
font-size: 1.3em;
113112
position: absolute;
114113
overflow: auto;
115-
border-top: 5px solid @chrome_primary;
114+
border-top: 5px solid var(--chrome-primary);
116115
background: white;
117-
padding: @padding_looser;
116+
padding: var(--padding-looser);
118117
}

module/styles/theme.less

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

pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.openrefine.extensions</groupId>
66
<artifactId>refine-commons-extension</artifactId>
7-
<version>0.1.4-SNAPSHOT</version>
7+
<version>0.1.5-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<name>OpenRefine - Commons extension</name>
@@ -20,9 +20,9 @@
2020
</licenses>
2121

2222
<properties>
23-
<openrefine.version>3.9.2</openrefine.version>
24-
<jackson.version>2.20.0</jackson.version>
25-
<wdtk.version>0.12.1-SNAPSHOT</wdtk.version>
23+
<openrefine.version>3.9.5</openrefine.version>
24+
<jackson.version>2.18.3</jackson.version>
25+
<wdtk.version>0.17.0</wdtk.version>
2626
<swc-parser-lazy.version>3.1.9</swc-parser-lazy.version>
2727
<surefire.version>3.5.3</surefire.version>
2828
</properties>
@@ -36,8 +36,8 @@
3636
<artifactId>maven-compiler-plugin</artifactId>
3737
<version>3.14.0</version>
3838
<configuration>
39-
<source>1.8</source>
40-
<target>1.8</target>
39+
<source>11</source>
40+
<target>11</target>
4141
<encoding>UTF-8</encoding>
4242
<showDeprecation>false</showDeprecation>
4343
</configuration>
@@ -80,7 +80,7 @@
8080
<plugin>
8181
<groupId>org.apache.maven.plugins</groupId>
8282
<artifactId>maven-clean-plugin</artifactId>
83-
<version>3.4.1</version>
83+
<version>3.5.0</version>
8484
<configuration>
8585
<filesets>
8686
<fileset>
@@ -132,13 +132,13 @@
132132
<scope>provided</scope>
133133
</dependency>
134134
<dependency>
135-
<groupId>org.openrefine.dependencies.wdtk</groupId>
135+
<groupId>org.wikidata.wdtk</groupId>
136136
<artifactId>wdtk-datamodel</artifactId>
137137
<version>${wdtk.version}</version>
138138
<scope>provided</scope>
139139
</dependency>
140140
<dependency>
141-
<groupId>org.openrefine.dependencies.wdtk</groupId>
141+
<groupId>org.wikidata.wdtk</groupId>
142142
<artifactId>wdtk-util</artifactId>
143143
<version>${wdtk.version}</version>
144144
<scope>provided</scope>

src/main/java/org/openrefine/extensions/commons/importer/FileFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public FileFetcher(String apiUrl, String categoryName, boolean subcategories) {
4343
*/
4444
public void getCallResults(String category) throws IOException {
4545

46-
OkHttpClient client = new OkHttpClient.Builder().build();
46+
OkHttpClient client = HttpClient.getClient();
4747
urlBase = HttpUrl.parse(apiUrl).newBuilder()
4848
.addQueryParameter("action", "query")
4949
.addQueryParameter("list", "categorymembers")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.openrefine.extensions.commons.importer;
2+
3+
import java.io.IOException;
4+
5+
import okhttp3.Interceptor;
6+
import okhttp3.OkHttpClient;
7+
import okhttp3.Request;
8+
import okhttp3.Response;
9+
10+
public class HttpClient {
11+
12+
private static final String USER_AGENT = "OpenRefine-Commons-Extension/0.1.* (https://github.com/OpenRefine/CommonsExtension)";
13+
14+
public static OkHttpClient getClient() {
15+
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new UserAgentInterceptor(USER_AGENT)).build();
16+
return client;
17+
}
18+
19+
static class UserAgentInterceptor implements Interceptor {
20+
21+
private final String userAgent;
22+
23+
public UserAgentInterceptor(String userAgent) {
24+
this.userAgent = userAgent;
25+
}
26+
27+
@Override
28+
public Response intercept(Chain chain) throws IOException {
29+
return chain.proceed(chain.request().newBuilder()
30+
.header("User-Agent", userAgent)
31+
.build());
32+
}
33+
}
34+
private static OkHttpClient client;
35+
}

src/main/java/org/openrefine/extensions/commons/importer/RelatedCategoryFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public List<List<String>> getRelatedCategories(List <FileRecord> fileRecordOrigi
6060
while (titlesIndex < fileRecordOriginal.size()) {
6161
titles += "|" + fileRecordOriginal.get(titlesIndex++).fileName;
6262
}
63-
OkHttpClient client = new OkHttpClient.Builder().build();
63+
OkHttpClient client = HttpClient.getClient();
6464
HttpUrl urlRelatedCategoriesBase = HttpUrl.parse(apiUrl).newBuilder()
6565
.addQueryParameter("action", "query")
6666
.addQueryParameter("prop", "categories")

0 commit comments

Comments
 (0)