Changeset 19416 in josm


Ignore:
Timestamp:
2025-06-24T14:05:53+02:00 (4 days ago)
Author:
stoecker
Message:

fix #24298 - add JOSM API indication to remote control

Location:
trunk/src/org/openstreetmap/josm/io/remotecontrol
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java

    r16825 r19416  
    3232     */
    3333    static final int protocolMajorVersion = 1;
    34     static final int protocolMinorVersion = 12;
     34    static final int protocolMinorVersion = 13;
    3535
    3636    /**
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r19200 r19416  
    2929
    3030import org.openstreetmap.josm.data.Version;
     31import org.openstreetmap.josm.data.preferences.JosmUrls;
    3132import org.openstreetmap.josm.gui.help.HelpUtil;
     33import org.openstreetmap.josm.io.OsmApi;
    3234import org.openstreetmap.josm.io.remotecontrol.handler.AddNodeHandler;
    3335import org.openstreetmap.josm.io.remotecontrol.handler.AddWayHandler;
     
    7274     * changes.
    7375     */
    74     public static final String PROTOCOLVERSION = Json.createObjectBuilder()
    75             .add("protocolversion", Json.createObjectBuilder()
    76                     .add("major", RemoteControl.protocolMajorVersion)
    77                     .add("minor", RemoteControl.protocolMinorVersion))
    78             .add("application", JOSM_REMOTE_CONTROL)
    79             .add("version", Version.getInstance().getVersion())
    80             .build().toString();
     76    public static String getProtocolVersion() {
     77        String OsmServerUrl = OsmApi.getOsmApi().getServerUrl();
     78        String defaultOsmApiUrl = JosmUrls.getInstance().getDefaultOsmApiUrl();
     79        return Json.createObjectBuilder()
     80                .add("protocolversion", Json.createObjectBuilder()
     81                        .add("major", RemoteControl.protocolMajorVersion)
     82                        .add("minor", RemoteControl.protocolMinorVersion))
     83                .add("application", JOSM_REMOTE_CONTROL)
     84                .add("version", Version.getInstance().getVersion())
     85                .add("osm_server", OsmServerUrl.equals(defaultOsmApiUrl) ? "default" : "custom")
     86                .build().toString();
     87    }
    8188
    8289    /** The socket this processor listens on */
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/VersionHandler.java

    r11567 r19416  
    2020    protected void handleRequest() throws RequestHandlerErrorException,
    2121            RequestHandlerBadRequestException {
    22         content = RequestProcessor.PROTOCOLVERSION;
     22        content = RequestProcessor.getProtocolVersion();
    2323        contentType = "application/json";
    2424        if (args.containsKey("jsonp")) {
Note: See TracChangeset for help on using the changeset viewer.