<%-- - Copyright (C) 2017-2025 Ignite Realtime Foundation. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> <%@ page contentType="text/html; charset=UTF-8" %> <%@ page import="org.jivesoftware.util.ParamUtils" %> <%@ page import="org.jivesoftware.openfire.container.PluginManager" %> <%@ page import="java.nio.file.Path" %> <%@ page import="java.io.*" %> <%@ page import="java.nio.charset.StandardCharsets" %> <% webManager.init(request, response, session, application, out ); final boolean showReadme = ParamUtils.getBooleanParameter( request, "showReadme", false); final boolean showChangelog = ParamUtils.getBooleanParameter(request, "showChangelog", false); if (showReadme || showChangelog ) { final PluginManager pluginManager = webManager.getXMPPServer().getPluginManager(); final String pluginName = ParamUtils.getParameter(request, "plugin" ); pluginManager.getPluginByCanonicalName( pluginName ).ifPresent(plugin -> { final Path filePath; final Path pluginPath = pluginManager.getPluginPath( plugin ); if ( showChangelog ) { filePath = pluginPath.resolve( "changelog.html" ); } else { filePath = pluginPath.resolve( "readme.html" ); } if ( filePath.toFile().exists() ) { try ( final BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( filePath.toFile() ), StandardCharsets.UTF_8) ) ) { String line; while ((line = in.readLine()) != null) { response.getWriter().println( line ); } } catch ( IOException ioe ) { ioe.printStackTrace(); } } }); } %>