Skip to content

Commit a4c15d4

Browse files
author
BitK
committed
Fixed html rendering as plaintext
1 parent 951f1a8 commit a4c15d4

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

src/main/kotlin/yesweburp/Globals.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import java.awt.Desktop
66
import java.io.PrintWriter
77
import java.net.URI
88

9-
const val VERSION = "2.0.0"
9+
const val VERSION = "2.0.1"
1010

1111
lateinit var callbacks: IBurpExtenderCallbacks
1212
lateinit var helpers: IExtensionHelpers

src/main/kotlin/yesweburp/ui/programs/ProgramInfoPanel.kt

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ import yesweburp.ui.matchSizes
1212
import java.awt.*
1313
import java.awt.event.MouseAdapter
1414
import java.awt.event.MouseEvent
15+
import java.awt.font.TextAttribute
1516
import java.lang.StrictMath.min
1617
import java.util.*
1718
import javax.swing.Box
19+
import javax.swing.JEditorPane
1820
import javax.swing.JLabel
1921
import javax.swing.JTable
2022
import javax.swing.border.EmptyBorder
23+
import kotlin.reflect.jvm.internal.impl.resolve.calls.inference.CapturedType
2124

2225

2326
class ProgramInfoPanel(program: Program) : BorderPanel() {
@@ -35,19 +38,10 @@ class ProgramInfoPanel(program: Program) : BorderPanel() {
3538
override fun mouseClicked(e: MouseEvent?) {
3639
openInBrowser("https://yeswehack.com/programs/${program.slug}")
3740
}
38-
39-
override fun mouseEntered(e: MouseEvent?) {
40-
super.mouseEntered(e)
41-
text = "<html><u>${program.title}</u></html>"
42-
}
43-
44-
override fun mouseExited(e: MouseEvent?) {
45-
super.mouseExited(e)
46-
text = program.title
47-
}
4841
})
4942
}
5043

44+
5145
val privateLabel = Label {
5246
if (program.public) {
5347
text = "Public"
@@ -66,21 +60,23 @@ class ProgramInfoPanel(program: Program) : BorderPanel() {
6660

6761
matchSizes(privateLabel, configButton)
6862
add(privateLabel, gridY = 0)
69-
add(Box.createHorizontalGlue(), gridY = 0, weightX = 1.0, fill = GridBagConstraints.HORIZONTAL )
63+
add(Box.createHorizontalGlue(), gridY = 0, weightX = 1.0, fill = GridBagConstraints.HORIZONTAL)
7064
add(title, gridY = 0)
71-
add(Box.createHorizontalGlue(), gridY = 0, weightX = 1.0, fill = GridBagConstraints.HORIZONTAL )
65+
add(Box.createHorizontalGlue(), gridY = 0, weightX = 1.0, fill = GridBagConstraints.HORIZONTAL)
7266
add(configButton, gridY = 0)
7367
}
7468
}
7569

7670
private class HTMLBox(rules: String) : BorderPanel() {
7771
init {
7872
border = EmptyBorder(5, 0, 0, 0)
79-
val css = "html{width:600px;padding:5px;font-family: InriaSans,Arial,sans-serif;} p{text-align: justify} img{max-width:100%}"
80-
val htmlRules = Label("<html><head><style>${css}</style></head><body>${rules}</body></html>") {
81-
verticalAlignment = JLabel.TOP
82-
isOpaque = true
83-
}
73+
val css =
74+
"html{width:600px;padding:5px;font-family: InriaSans,Arial,sans-serif;} p{text-align: justify} img{max-width:100%}"
75+
val htmlRules =
76+
JEditorPane("text/html", "<html><head><style>${css}</style></head><body>${rules}</body></html>")
77+
htmlRules.isEditable = false
78+
htmlRules.isOpaque = true
79+
htmlRules.alignmentY = JEditorPane.TOP_ALIGNMENT
8480
center = ScrollPane(htmlRules) {
8581
maximumSize = Dimension(Int.MAX_VALUE, Int.MAX_VALUE)
8682
verticalScrollBar.unitIncrement = 16

0 commit comments

Comments
 (0)